aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/jit-reader-host.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-05-20 10:50:39 -0400
committerSimon Marchi <simon.marchi@efficios.com>2020-05-20 10:50:50 -0400
commit41977d16e4ee5b9ad01abf2cfce6edbfb6d79541 (patch)
tree46af3678d259d1b8b736c473707c5997c34bf0d3 /gdb/testsuite/gdb.base/jit-reader-host.c
parentb4757f2e45f292c9f0e48e8dbdc003e5dbfca5ed (diff)
downloadgdb-41977d16e4ee5b9ad01abf2cfce6edbfb6d79541.zip
gdb-41977d16e4ee5b9ad01abf2cfce6edbfb6d79541.tar.gz
gdb-41977d16e4ee5b9ad01abf2cfce6edbfb6d79541.tar.bz2
gdb/testsuite: check mmap ret val against MAP_FAILED
Fixup a few spots in the testsuite that use mmap to consistently check the return value against MAP_FAILED. One spot in gdb.base/coredump-filter.c checked against NULL, that is wrong. The other spots either didn't check, or checked against -1. MAP_FAILED has the value -1, at least on Linux, but it's better to check against the documented define. gdb/testsuite/ChangeLog: PR gdb/26016 * gdb.base/coredump-filter.c (do_mmap): Check mmap ret val against MAP_FAILED. * gdb.base/coremaker.c (mmapdata): Likewise. * gdb.base/jit-reader-host.c (main): Likewise. * gdb.base/sym-file-loader.c (load): Likewise. (load_shlib): Likewise.
Diffstat (limited to 'gdb/testsuite/gdb.base/jit-reader-host.c')
-rw-r--r--gdb/testsuite/gdb.base/jit-reader-host.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/jit-reader-host.c b/gdb/testsuite/gdb.base/jit-reader-host.c
index f9c4833..0cf653f 100644
--- a/gdb/testsuite/gdb.base/jit-reader-host.c
+++ b/gdb/testsuite/gdb.base/jit-reader-host.c
@@ -15,6 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -59,6 +60,8 @@ main (int argc, char **argv)
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
char *code_end = code;
+ assert (code != MAP_FAILED);
+
/* "JIT" function_stack_mangle. */
memcpy (code_end, jit_function_stack_mangle_code,
sizeof (jit_function_stack_mangle_code));