+2013-12-19 Gabriel Krisman Bertazi <gabriel@krisman.be>
+
+ PR breakpoints/16297
+ * breakpoint.c (breakpoint_hit_catch_syscall): Return immediately
+ when expected syscall is hit.
+
2013-12-19 Tom Tromey <tromey@redhat.com>
* ser-unix.c (hardwire_ops): New global.
VEC_iterate (int, c->syscalls_to_be_caught, i, iter);
i++)
if (syscall_number == iter)
- break;
- /* Not the same. */
- if (!iter)
- return 0;
+ return 1;
+
+ return 0;
}
return 1;
+2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ PR breakpoints/16297
+ * gdb.base/catch-syscall.c (read_syscall, pipe_syscall)
+ (write_syscall): New variables.
+ (main): Create a pipe, write 1 byte in it, and read 1 byte from
+ it.
+ * gdb.base/catch-syscall.exp (all_syscalls): Include "pipe,
+ "write" and "read" syscalls.
+ (fill_all_syscalls_numbers): Improve the way to obtain syscalls
+ numbers.
+
2013-12-19 Keven Boell <keven.boell@intel.com>
* gdb.fortran/module.exp: Completion matches fortran module
static int close_syscall = SYS_close;
static int chroot_syscall = SYS_chroot;
+/* GDB had a bug where it couldn't catch syscall number 0 (PR 16297).
+ In most GNU/Linux architectures, syscall number 0 is
+ restart_syscall, which can't be called from userspace. However,
+ the "read" syscall is zero on x86_64. */
+static int read_syscall = SYS_read;
+static int pipe_syscall = SYS_pipe;
+static int write_syscall = SYS_write;
static int exit_group_syscall = SYS_exit_group;
int
main (void)
{
+ int fd[2];
+ char buf1[2] = "a";
+ char buf2[2];
+
/* A close() with a wrong argument. We are only
interested in the syscall. */
close (-1);
chroot (".");
+ pipe (fd);
+
+ write (fd[1], buf1, sizeof (buf1));
+ read (fd[0], buf2, sizeof (buf2));
+
/* The last syscall. Do not change this. */
_exit (0);
}
# All (but the last) syscalls from the example code
# They are ordered according to the file, so do not change this.
-set all_syscalls { "close" "chroot" }
+set all_syscalls { "close" "chroot" "pipe" "write" "read" }
set all_syscalls_numbers { }
# The last syscall (exit()) does not return, so
# This procedure fills the vector "all_syscalls_numbers" with the proper
# numbers for the used syscalls according to the architecture.
proc fill_all_syscalls_numbers {} {
- global all_syscalls_numbers last_syscall_number
+ global all_syscalls_numbers last_syscall_number all_syscalls
+
+ foreach syscall $all_syscalls {
+ lappend all_syscalls_numbers [get_integer_valueof "${syscall}_syscall" -1]
+ }
- set close_syscall [get_integer_valueof "close_syscall" -1]
- set chroot_syscall [get_integer_valueof "chroot_syscall" -1]
- set all_syscalls_numbers [list $close_syscall $chroot_syscall]
set last_syscall_number [get_integer_valueof "exit_group_syscall" -1]
}