This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix for PR breakpoints/16297: Fix catch syscall to work with syscall 0
- From: Gabriel Krisman Bertazi <gabriel at krisman dot be>
- To: gdb-patches at sourceware dot org
- Date: Sun, 15 Dec 2013 01:57:50 -0200
- Subject: [PATCH] Fix for PR breakpoints/16297: Fix catch syscall to work with syscall 0
- Authentication-results: sourceware.org; auth=none
Hello,
This is a fix for bug 16297. The problem occurs when the user attempts
to catch any syscall 0 (such as syscall read on Linux/x86_64). GDB was
not able to catch the syscall and was missing the breakpoint.
Now, breakpoint_hit_catch_syscall returns immediately when it finds the
correct syscall number, avoiding a following check for the end of the
search vector, that returns a no hit if the syscall number was zero.
I already sent the form to FSF so I can sign the copyright
assigment.
--
Gabriel Krisman Bertazi
2013-12-15 Gabriel Krisman Bertazi <gabriel@krisman.be>
PR breakpoints/16297
* breakpoint.c (breakpoint_hit_catch_syscall): Return immediately
when expected syscall is hit.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 589aa19..e798d1a 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -8325,10 +8325,9 @@ breakpoint_hit_catch_syscall (const struct bp_location *bl,
VEC_iterate (int, c->syscalls_to_be_caught, i, iter);
i++)
if (syscall_number == iter)
- break;
+ return 1;
/* Not the same. */
- if (!iter)
- return 0;
+ return 0;
}
return 1;