From 7f82dfc7f0654b735a1dbe5d9d2d2948f175ba64 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Tue, 17 Nov 2009 09:41:33 +0000 Subject: [PATCH] gdb/ Fix wrong debug output with `set debug infrun 1'. * gdb/infrun.c (handle_inferior_event ): New variable old_chain. Temporarily switch INFERIOR_PTID. * target.h (target_stopped_by_watchpoint): Extend the comment. (target_stopped_data_address): New comment. --- gdb/ChangeLog | 8 ++++++++ gdb/infrun.c | 5 +++++ gdb/target.h | 9 ++++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 25547324ea2..9ff24470067 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2009-11-17 Jan Kratochvil + + Fix wrong debug output with `set debug infrun 1'. + * gdb/infrun.c (handle_inferior_event ): New variable + old_chain. Temporarily switch INFERIOR_PTID. + * target.h (target_stopped_by_watchpoint): Extend the comment. + (target_stopped_data_address): New comment. + 2009-11-16 Tom Tromey * xcoffread.c (scan_xcoff_symtab): Update. diff --git a/gdb/infrun.c b/gdb/infrun.c index 98e215c7e74..3c171673352 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3135,6 +3135,9 @@ targets should add new threads to the thread list themselves in non-stop mode.") { struct regcache *regcache = get_thread_regcache (ecs->ptid); struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct cleanup *old_chain = save_inferior_ptid (); + + inferior_ptid = ecs->ptid; fprintf_unfiltered (gdb_stdlog, "infrun: stop_pc = %s\n", paddress (gdbarch, stop_pc)); @@ -3151,6 +3154,8 @@ targets should add new threads to the thread list themselves in non-stop mode.") fprintf_unfiltered (gdb_stdlog, "infrun: (no data address available)\n"); } + + do_cleanups (old_chain); } if (stepping_past_singlestep_breakpoint) diff --git a/gdb/target.h b/gdb/target.h index e4421e90e30..c957b2a6310 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1144,7 +1144,7 @@ extern char *normal_pid_to_str (ptid_t ptid); /* Hardware watchpoint interfaces. */ /* Returns non-zero if we were stopped by a hardware watchpoint (memory read or - write). */ + write). Only the INFERIOR_PTID task is being queried. */ #define target_stopped_by_watchpoint \ (*current_target.to_stopped_by_watchpoint) @@ -1192,8 +1192,11 @@ extern char *normal_pid_to_str (ptid_t ptid); #define target_remove_hw_breakpoint(gdbarch, bp_tgt) \ (*current_target.to_remove_hw_breakpoint) (gdbarch, bp_tgt) -#define target_stopped_data_address(target, x) \ - (*target.to_stopped_data_address) (target, x) +/* Return non-zero if target knows the data address which triggered this + target_stopped_by_watchpoint, in such case place it to *ADDR_P. Only the + INFERIOR_PTID task is being queried. */ +#define target_stopped_data_address(target, addr_p) \ + (*target.to_stopped_data_address) (target, addr_p) #define target_watchpoint_addr_within_range(target, addr, start, length) \ (*target.to_watchpoint_addr_within_range) (target, addr, start, length) -- 2.30.2