[sergio-catch-syscall] gdb.base/reread.exp regression
Jan Kratochvil
jan.kratochvil@redhat.com
Fri Jan 9 13:11:00 GMT 2009
On Fri, 09 Jan 2009 02:37:13 +0100, Sérgio Durigan Júnior wrote:
> On Fri, 2009-01-09 at 01:01 +0100, Jan Kratochvil wrote:
> > #gdb
> > (2009-01-09 00:39:23) jankratochvil: sergiodj: Could you please verify - I have a regression in archer-sergio-catch-syscall on both x86 and x86_64 for: gdb.base/reread.exp: second pass: run to foo()
> > (2009-01-09 00:39:26) jankratochvil: Starting program: /home/jkratoch/redhat/archer-sergio-catch-syscall/gdb/testsuite/gdb.base/reread
> > (2009-01-09 00:39:26) jankratochvil: Program received signal SIGSEGV, Segmentation fault.
> > (2009-01-09 00:39:26) jankratochvil: 0xd50482f4 in ?? ()
[...]
> Unfortunately, I couldn't reproduce the bug using a x86 architecture
Attached a possible fix - the bp_entry_breakpoint address got stale on an
inferior reload.
Sure there should be more a callback during breakpoint_re_set() than this way.
I just chose a proven method of existing remove_thread_event_breakpoints() but
I guess the proper way would be to use a catchpoint
with new `struct breakpoint_ops' specific for bp_entry_breakpoint.
> (I don't have a x86_64 available here).
This gdb.base/reread.exp regression I had reproducible on both x86 and x86_64
(particularly x86 running as a -m32 build on x86_64 but it should not matter).
Regards,
Jan
-------------- next part --------------
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 143d4b0..09b3171 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -4403,11 +4403,13 @@ disable_overlay_breakpoints (void)
}
int
-create_entry_breakpoint ()
+create_entry_breakpoint (void)
{
CORE_ADDR taddr, entry_addr;
struct breakpoint *b;
+ delete_entry_breakpoint ();
+
taddr = entry_point_address ();
/* Make certain that the address points at real code, and not a
function descriptor. */
@@ -4427,6 +4429,20 @@ create_entry_breakpoint ()
return 1;
}
+/* Remove the breakpoint from create_entry_breakpoint. To be called in the
+ same moments as remove_thread_event_breakpoints (or its caller
+ disable_thread_event_reporting) are being called. */
+
+void
+delete_entry_breakpoint (void)
+{
+ struct breakpoint *b, *temp;
+
+ ALL_BREAKPOINTS_SAFE (b, temp)
+ if (b->type == bp_entry_breakpoint)
+ delete_breakpoint (b);
+}
+
struct breakpoint *
create_thread_event_breakpoint (CORE_ADDR address)
{
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 384a156..4ef3c78 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -913,6 +913,9 @@ extern int catching_syscall_number (int syscall_number);
or 1 if everything went OK. */
extern int create_entry_breakpoint (void);
+/* Remove the breakpoint from create_entry_breakpoint. */
+extern void delete_entry_breakpoint (void);
+
/* Tell a breakpoint to be quiet. */
extern void make_breakpoint_silent (struct breakpoint *);
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 4b317f6..20a85d1 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1681,6 +1681,8 @@ linux_nat_detach (struct target_ops *ops, char *args, int from_tty)
int status;
enum target_signal sig;
+ delete_entry_breakpoint ();
+
if (target_can_async_p ())
linux_nat_async (NULL, 0);
@@ -2896,6 +2898,9 @@ linux_nat_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
if (debug_linux_nat_async)
fprintf_unfiltered (gdb_stdlog, "LLW: enter\n");
+ if (ourstatus->kind == TARGET_WAITKIND_EXECD)
+ delete_entry_breakpoint ();
+
/* The first time we get here after starting a new inferior, we may
not have added it to the LWP list yet - this is the earliest
moment at which we know its PID. */
@@ -3330,6 +3335,9 @@ linux_nat_mourn_inferior (struct target_ops *ops)
there are other viable forks to debug. Delete the exiting
one and context-switch to the first available. */
linux_fork_mourn_inferior ();
+
+ /* It would fail with a warning before the inherited mourn calls above. */
+ delete_entry_breakpoint ();
}
static LONGEST
More information about the Archer
mailing list