From 4aa7a7f553f9bc09fa503bf82d41038763319479 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Fri, 8 Oct 2004 17:30:48 +0000 Subject: 2004-10-08 Jeff Johnston * target.h (to_stopped_data_address): Change prototype to take a CORE_ADDR pointer and return an int. * target.c (update_current_target): Change to_stopped_data_address to match new prototype. (debug_to_stopped_data_address): Change appropriately. * breakpoint.c (bpstat_stop_status): Change call to target_stopped_data_address to use new prototype. * frv-tdep.c (frv_have_stopped_data_address): New function. (frv_stopped_data_address): Change to new prototype and functionality. * ia64-linux-nat.c (ia64_stopped_data_address): Change to new prototype and functionality. (ia64_stopped_by_watchpoint): New function. * i386-nat.c (i386_stopped_data_address): Change to new prototype and functionality. (i386_stopped_by_watchpoint): New function. * remote.c (remote_stopped_data_address): Change to new prototype and functionality. * remote-m32r-sdi.c (m32r_stopped_data_address): Ditto. * config/frv/tm-frv.h (frv_stopped_data_address): Change prototype. (STOPPED_BY_WATCHPOINT): Change to use frv_have_stopped_data_address. * config/i386/nm-i386.h (STOPPED_BY_WATCHPOINT): Change to use new i386_stopped_by_watchpoint function. (i386_stopped_by_watchpoint): New prototype. (i386_stoppped_data_address): Change to new prototype. * config/ia64/nm-linux.h (STOPPED_BY_WATCHPOINT): Change to use new ia64_stopped_by_watchpoint function. (ia64_stopped_by_watchpoint): New prototype. (ia64_stopped_data_address): Ditto. --- gdb/i386-nat.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'gdb/i386-nat.c') diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c index 95b4609..6b5f49b 100644 --- a/gdb/i386-nat.c +++ b/gdb/i386-nat.c @@ -564,14 +564,16 @@ i386_region_ok_for_watchpoint (CORE_ADDR addr, int len) return nregs <= DR_NADDR ? 1 : 0; } -/* If the inferior has some watchpoint that triggered, return the - address associated with that watchpoint. Otherwise, return zero. */ +/* If the inferior has some watchpoint that triggered, set the + address associated with that watchpoint and return non-zero. + Otherwise, return zero. */ -CORE_ADDR -i386_stopped_data_address (void) +int +i386_stopped_data_address (CORE_ADDR *addr_p) { CORE_ADDR addr = 0; int i; + int rc = 0; dr_status_mirror = I386_DR_LOW_GET_STATUS (); @@ -586,6 +588,7 @@ i386_stopped_data_address (void) && I386_DR_GET_RW_LEN (i) != 0) { addr = dr_mirror[i]; + rc = 1; if (maint_show_dr) i386_show_dr ("watchpoint_hit", addr, -1, hw_write); } @@ -593,7 +596,16 @@ i386_stopped_data_address (void) if (maint_show_dr && addr == 0) i386_show_dr ("stopped_data_addr", 0, 0, hw_write); - return addr; + if (rc) + *addr_p = addr; + return rc; +} + +int +i386_stopped_by_watchpoint (void) +{ + CORE_ADDR addr = 0; + return i386_stopped_data_address (&addr); } /* Return non-zero if the inferior has some break/watchpoint that -- cgit v1.1