This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

single-step breakpoints


Hi Daniel,

There a slight problem with insert_single_step_breakpoint() and
remove_single_step_breakpoints().  On OpenBSD, inserting a breakpoint
into the kernel-provided signal trampoline, may fail.  Unfortunately,
the caller of insert_single_step_breakpoint() never notices this, and
calls remove_single_step_breakpoints() to remove the breakpoints.
Unfortunately that makes us hit the gdb_assert() in there.

This patch makes us avoid this while still making an attempt to catch
misuse of the interface.


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* breakpoint.c (remove_single_step_breakpoints): Bail out early if
	no breakpoints are inserted.

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.225
diff -u -p -r1.225 breakpoint.c
--- breakpoint.c 18 Apr 2006 19:20:06 -0000 1.225
+++ breakpoint.c 25 Apr 2006 20:03:21 -0000
@@ -7726,6 +7726,9 @@ insert_single_step_breakpoint (CORE_ADDR
 void
 remove_single_step_breakpoints (void)
 {
+  if (single_step_breakpoints[0] == NULL && single_step_breakpoints[1] == NULL)
+    return;
+
   gdb_assert (single_step_breakpoints[0] != NULL);
 
   /* See insert_single_step_breakpoint for more about this deprecated


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]