aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/break-catch-syscall.c2
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.base/catch-syscall.exp3
4 files changed, 17 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c6ad0bb..e4a5ed8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2021-02-05 Tom de Vries <tdevries@suse.de>
+
+ PR breakpoints/27313
+ * break-catch-syscall.c (catch_syscall_split_args): Reject negative
+ syscall numbers.
+
2021-02-05 Tom Tromey <tom@tromey.com>
* compile/compile-c-support.c (get_compile_context)
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c
index 9772ac0..7335377 100644
--- a/gdb/break-catch-syscall.c
+++ b/gdb/break-catch-syscall.c
@@ -390,6 +390,8 @@ catch_syscall_split_args (const char *arg)
syscall_number = (int) strtol (cur_name, &endptr, 0);
if (*endptr == '\0')
{
+ if (syscall_number < 0)
+ error (_("Unknown syscall number '%d'."), syscall_number);
get_syscall_by_number (gdbarch, syscall_number, &s);
result.push_back (s.number);
}
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 { }