diff options
author | Tom de Vries <tdevries@suse.de> | 2021-02-05 17:47:07 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2021-02-05 17:47:07 +0100 |
commit | 0e857c82883cff04ccc8868762c78b0e94ccde91 (patch) | |
tree | 2da77697ed1016db5c8fadd40e36327f88d57085 /gdb/testsuite | |
parent | bdfea17ea9bbd9f92ad19a70d770af42473d9c07 (diff) | |
download | gdb-0e857c82883cff04ccc8868762c78b0e94ccde91.zip gdb-0e857c82883cff04ccc8868762c78b0e94ccde91.tar.gz gdb-0e857c82883cff04ccc8868762c78b0e94ccde91.tar.bz2 |
[gdb/breakpoints] Fix segfault for catch syscall -1
Using a hello world a.out, I run into a segfault:
...
$ gcc hello.c
$ gdb -batch a.out -ex "catch syscall -1" -ex r
Catchpoint 1 (syscall -1)
Aborted (core dumped)
...
Fix this by erroring out if a negative syscall number is used in the
catch syscall command.
Tested on x86_64-linux.
gdb/ChangeLog:
2021-02-05 Tom de Vries <tdevries@suse.de>
PR breakpoints/27313
* break-catch-syscall.c (catch_syscall_split_args): Reject negative
syscall numbers.
gdb/testsuite/ChangeLog:
2021-02-05 Tom de Vries <tdevries@suse.de>
PR breakpoints/27313
* gdb.base/catch-syscall.exp: Check that "catch syscall -1" is
rejected.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/catch-syscall.exp | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 84f0647..5875843 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2021-02-05 Tom de Vries <tdevries@suse.de> + PR breakpoints/27313 + * gdb.base/catch-syscall.exp: Check that "catch syscall -1" is + rejected. + +2021-02-05 Tom de Vries <tdevries@suse.de> + * gdb.dwarf2/main-subprogram.exp: Add KFAIL for PR symtab/24549. * gdb.fortran/mixed-lang-stack.exp: Same. diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp index b45cb82..a92730c 100644 --- a/gdb/testsuite/gdb.base/catch-syscall.exp +++ b/gdb/testsuite/gdb.base/catch-syscall.exp @@ -54,6 +54,9 @@ gdb_test_multiple "continue" $test { } } +# Test-case for PR27313. Verify that negative syscall numbers are refused. +gdb_test "catch syscall -1" "Unknown syscall number '-1'\\." + # All (but the last) syscalls from the example code. It is filled in # proc setup_all_syscalls. set all_syscalls { } |