[RFC/WIP PATCH 01/14] Breakpoints always-inserted and the record target

Pedro Alves pedro@codesourcery.com
Mon Nov 28 15:39:00 GMT 2011


I tried running the testsuite with always-inserted forced on, and got
a bunch of regressions on gdb.reverse/ with the record target.

Breakpoints always-inserted and the record target don't play along
well currently.  E.g., if you set a breakpoint while recording, the
breakpoint is installed in the live target.  When the target stops,
the breakpoint is left inserted (due to always-inserted).  Now, if
e.g., you rewind history, and replay, and the program needs to step
over a breakpoint, infrun will try to remove the breakpoint
temporarily to do the usual step-over-breakpoint dance.  But, record.c
is actually wired to ignore breakpoint insertions and removals when
replaying.  This means breakpoint.c now considers the breakpoint
not-inserted, but the breakpoint insn is still planted on the target.
If you set a new breakpoint at the same location, breakpoint.c
(thinking there's no breakpoint inserted at that address), will
happilly try to insert the new breakpoint, but, since the breakpoint
insn from the other breakpoint is still planted in memory,
breakpoint.c will think we're trying to set a breakpoint on top of a
permanent breakpoint.  Things go downhill from here.  This happens
e.g., sigall-reverse.exp.

For now, simply disable always-inserted if record is on, exactly like
we already disable displaced stepping.
---
 gdb/breakpoint.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index fa80018..37e177b 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -67,6 +67,7 @@
 #include "continuations.h"
 #include "stack.h"
 #include "skip.h"
+#include "record.h"
 
 /* readline include files */
 #include "readline/readline.h"
@@ -377,8 +378,9 @@ show_always_inserted_mode (struct ui_file *file, int from_tty,
 int
 breakpoints_always_inserted_mode (void)
 {
-  return (always_inserted_mode == always_inserted_on
-	  || (always_inserted_mode == always_inserted_auto && non_stop));
+  return ((always_inserted_mode == always_inserted_on
+	   || (always_inserted_mode == always_inserted_auto && non_stop))
+	  && !RECORD_IS_USED);
 }
 
 void _initialize_breakpoint (void);



More information about the Gdb-patches mailing list