2004-10-08 Jeff Johnston <jjohnstn@redhat.com>
* 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.
This commit is contained in:
parent
ac77d04f5d
commit
4aa7a7f553
12 changed files with 146 additions and 47 deletions
|
@ -1,3 +1,35 @@
|
|||
2004-10-08 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2004-10-08 Paul Hilfinger <Hilfinger@gnat.com>
|
||||
|
||||
* ada-typeprint.c (ada_print_type): Use int_string for printing
|
||||
|
|
|
@ -2741,8 +2741,7 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid, int stopped_by_watchpoint)
|
|||
struct value *v;
|
||||
int found = 0;
|
||||
|
||||
addr = target_stopped_data_address ();
|
||||
if (addr == 0)
|
||||
if (!target_stopped_data_address (¤t_target, &addr))
|
||||
continue;
|
||||
for (v = b->val_chain; v; v = v->next)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Target definitions for the Fujitsu FR-V, for GDB, the GNU Debugger.
|
||||
Copyright 2000 Free Software Foundation, Inc.
|
||||
Copyright 2000, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
|
@ -33,10 +33,11 @@ extern int frv_check_watch_resources (int type, int cnt, int ot);
|
|||
#define STOPPED_BY_WATCHPOINT(W) \
|
||||
((W).kind == TARGET_WAITKIND_STOPPED \
|
||||
&& (W).value.sig == TARGET_SIGNAL_TRAP \
|
||||
&& (frv_stopped_data_address() != ((CORE_ADDR)0)))
|
||||
extern CORE_ADDR frv_stopped_data_address(void);
|
||||
&& frv_have_stopped_data_address())
|
||||
extern int frv_have_stopped_data_address(void);
|
||||
|
||||
/* Use these macros for watchpoint insertion/deletion. */
|
||||
#define target_stopped_data_address() frv_stopped_data_address()
|
||||
#define target_stopped_data_address(target, x) frv_stopped_data_address(x)
|
||||
extern int frv_stopped_data_address(CORE_ADDR *addr_p);
|
||||
|
||||
#include "solib.h" /* Include support for shared libraries. */
|
||||
|
|
|
@ -47,10 +47,10 @@ extern int i386_region_ok_for_watchpoint (CORE_ADDR addr, int len);
|
|||
triggered. */
|
||||
extern int i386_stopped_by_hwbp (void);
|
||||
|
||||
/* If the inferior has some break/watchpoint that triggered, return
|
||||
the address associated with that break/watchpoint. Otherwise,
|
||||
return zero. */
|
||||
extern CORE_ADDR i386_stopped_data_address (void);
|
||||
/* If the inferior has some break/watchpoint that triggered, set
|
||||
the address associated with that break/watchpoint and return
|
||||
true. Otherwise, return false. */
|
||||
extern int i386_stopped_data_address (CORE_ADDR *);
|
||||
|
||||
/* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is
|
||||
unused. Return 0 on success, EBUSY on failure. */
|
||||
|
@ -91,9 +91,11 @@ extern int i386_remove_hw_breakpoint (CORE_ADDR addr, void *shadow);
|
|||
|
||||
#define HAVE_CONTINUABLE_WATCHPOINT 1
|
||||
|
||||
#define STOPPED_BY_WATCHPOINT(W) (i386_stopped_data_address () != 0)
|
||||
extern int i386_stopped_by_watchpoint (void);
|
||||
|
||||
#define target_stopped_data_address() i386_stopped_data_address ()
|
||||
#define STOPPED_BY_WATCHPOINT(W) (i386_stopped_by_watchpoint () != 0)
|
||||
|
||||
#define target_stopped_data_address(target, x) i386_stopped_data_address(x)
|
||||
|
||||
/* Use these macros for watchpoint insertion/removal. */
|
||||
|
||||
|
|
|
@ -58,8 +58,12 @@ extern int ia64_cannot_store_register (int regno);
|
|||
#define HAVE_STEPPABLE_WATCHPOINT 1
|
||||
|
||||
#define STOPPED_BY_WATCHPOINT(W) \
|
||||
ia64_linux_stopped_by_watchpoint (inferior_ptid)
|
||||
extern CORE_ADDR ia64_linux_stopped_by_watchpoint (ptid_t ptid);
|
||||
ia64_linux_stopped_by_watchpoint ()
|
||||
extern int ia64_linux_stopped_by_watchpoint ();
|
||||
|
||||
#define target_stopped_data_address(target, x) \
|
||||
ia64_linux_stopped_data_address(x)
|
||||
extern int ia64_linux_stopped_data_address (CORE_ADDR *addr_p);
|
||||
|
||||
#define target_insert_watchpoint(addr, len, type) \
|
||||
ia64_linux_insert_watchpoint (inferior_ptid, addr, len, type)
|
||||
|
|
|
@ -1293,8 +1293,8 @@ frv_check_watch_resources (int type, int cnt, int ot)
|
|||
}
|
||||
|
||||
|
||||
CORE_ADDR
|
||||
frv_stopped_data_address (void)
|
||||
int
|
||||
frv_stopped_data_address (CORE_ADDR *addr_p)
|
||||
{
|
||||
CORE_ADDR brr, dbar0, dbar1, dbar2, dbar3;
|
||||
|
||||
|
@ -1305,15 +1305,24 @@ frv_stopped_data_address (void)
|
|||
dbar3 = read_register (dbar3_regnum);
|
||||
|
||||
if (brr & (1<<11))
|
||||
return dbar0;
|
||||
*addr_p = dbar0;
|
||||
else if (brr & (1<<10))
|
||||
return dbar1;
|
||||
*addr_p = dbar1;
|
||||
else if (brr & (1<<9))
|
||||
return dbar2;
|
||||
*addr_p = dbar2;
|
||||
else if (brr & (1<<8))
|
||||
return dbar3;
|
||||
*addr_p = dbar3;
|
||||
else
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
frv_have_stopped_data_address (void)
|
||||
{
|
||||
CORE_ADDR addr = 0;
|
||||
return frv_stopped_data_address (&addr);
|
||||
}
|
||||
|
||||
static CORE_ADDR
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -636,12 +636,13 @@ ia64_linux_remove_watchpoint (ptid_t ptid, CORE_ADDR addr, int len)
|
|||
return -1;
|
||||
}
|
||||
|
||||
CORE_ADDR
|
||||
ia64_linux_stopped_by_watchpoint (ptid_t ptid)
|
||||
int
|
||||
ia64_linux_stopped_data_address (CORE_ADDR *addr_p)
|
||||
{
|
||||
CORE_ADDR psr;
|
||||
int tid;
|
||||
struct siginfo siginfo;
|
||||
ptid_t ptid = inferior_ptid;
|
||||
|
||||
tid = TIDGET(ptid);
|
||||
if (tid == 0)
|
||||
|
@ -659,7 +660,15 @@ ia64_linux_stopped_by_watchpoint (ptid_t ptid)
|
|||
for the next instruction */
|
||||
write_register_pid (IA64_PSR_REGNUM, psr, ptid);
|
||||
|
||||
return (CORE_ADDR) siginfo.si_addr;
|
||||
*addr_p = (CORE_ADDR)siginfo.si_addr;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
ia64_linux_stopped_by_watchpoint (void)
|
||||
{
|
||||
CORE_ADDR addr;
|
||||
return ia64_linux_stopped_data_address (&addr);
|
||||
}
|
||||
|
||||
LONGEST
|
||||
|
|
|
@ -1450,16 +1450,23 @@ m32r_remove_watchpoint (CORE_ADDR addr, int len, int type)
|
|||
return 0;
|
||||
}
|
||||
|
||||
CORE_ADDR
|
||||
m32r_stopped_data_address (void)
|
||||
int
|
||||
m32r_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
|
||||
{
|
||||
return hit_watchpoint_addr;
|
||||
int rc = 0;
|
||||
if (hit_watchpoint_addr != 0x00000000)
|
||||
{
|
||||
*addr_p = hit_watchpoint_addr;
|
||||
rc = 1;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
m32r_stopped_by_watchpoint (void)
|
||||
{
|
||||
return (hit_watchpoint_addr != 0x00000000);
|
||||
CORE_ADDR addr;
|
||||
return m32r_stopped_data_address (¤t_target, &addr);
|
||||
}
|
||||
|
||||
|
||||
|
|
13
gdb/remote.c
13
gdb/remote.c
|
@ -4624,13 +4624,18 @@ remote_stopped_by_watchpoint (void)
|
|||
|
||||
extern int stepped_after_stopped_by_watchpoint;
|
||||
|
||||
static CORE_ADDR
|
||||
remote_stopped_data_address (void)
|
||||
static int
|
||||
remote_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
|
||||
{
|
||||
int rc = 0;
|
||||
if (remote_stopped_by_watchpoint ()
|
||||
|| stepped_after_stopped_by_watchpoint)
|
||||
return remote_watch_data_address;
|
||||
return (CORE_ADDR)0;
|
||||
{
|
||||
*addr_p = remote_watch_data_address;
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
|
30
gdb/target.c
30
gdb/target.c
|
@ -127,7 +127,7 @@ static int debug_to_remove_watchpoint (CORE_ADDR, int, int);
|
|||
|
||||
static int debug_to_stopped_by_watchpoint (void);
|
||||
|
||||
static CORE_ADDR debug_to_stopped_data_address (void);
|
||||
static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *);
|
||||
|
||||
static int debug_to_region_size_ok_for_hw_watchpoint (int);
|
||||
|
||||
|
@ -524,7 +524,7 @@ update_current_target (void)
|
|||
(int (*) (void))
|
||||
return_zero);
|
||||
de_fault (to_stopped_data_address,
|
||||
(CORE_ADDR (*) (void))
|
||||
(int (*) (struct target_ops *, CORE_ADDR *))
|
||||
return_zero);
|
||||
de_fault (to_region_size_ok_for_hw_watchpoint,
|
||||
default_region_size_ok_for_hw_watchpoint);
|
||||
|
@ -1011,6 +1011,19 @@ target_write_memory (CORE_ADDR memaddr, char *myaddr, int len)
|
|||
return target_xfer_memory (memaddr, myaddr, len, 1);
|
||||
}
|
||||
|
||||
#ifndef target_stopped_data_address_p
|
||||
int
|
||||
target_stopped_data_address_p (struct target_ops *target)
|
||||
{
|
||||
if (target->to_stopped_data_address == return_zero
|
||||
|| (target->to_stopped_data_address == debug_to_stopped_data_address
|
||||
&& debug_target.to_stopped_data_address == return_zero))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int trust_readonly = 0;
|
||||
|
||||
/* Move memory to or from the targets. The top target gets priority;
|
||||
|
@ -2069,16 +2082,17 @@ debug_to_stopped_by_watchpoint (void)
|
|||
return retval;
|
||||
}
|
||||
|
||||
static CORE_ADDR
|
||||
debug_to_stopped_data_address (void)
|
||||
static int
|
||||
debug_to_stopped_data_address (struct target_ops *target, CORE_ADDR *addr)
|
||||
{
|
||||
CORE_ADDR retval;
|
||||
int retval;
|
||||
|
||||
retval = debug_target.to_stopped_data_address ();
|
||||
retval = debug_target.to_stopped_data_address (target, addr);
|
||||
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"target_stopped_data_address () = 0x%lx\n",
|
||||
(unsigned long) retval);
|
||||
"target_stopped_data_address ([0x%lx]) = %ld\n",
|
||||
(unsigned long)*addr,
|
||||
(unsigned long)retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
11
gdb/target.h
11
gdb/target.h
|
@ -341,7 +341,7 @@ struct target_ops
|
|||
int (*to_insert_watchpoint) (CORE_ADDR, int, int);
|
||||
int (*to_stopped_by_watchpoint) (void);
|
||||
int to_have_continuable_watchpoint;
|
||||
CORE_ADDR (*to_stopped_data_address) (void);
|
||||
int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *);
|
||||
int (*to_region_size_ok_for_hw_watchpoint) (int);
|
||||
void (*to_terminal_init) (void);
|
||||
void (*to_terminal_inferior) (void);
|
||||
|
@ -1067,9 +1067,14 @@ extern void (*deprecated_target_new_objfile_hook) (struct objfile *);
|
|||
(*current_target.to_remove_hw_breakpoint) (addr, save)
|
||||
#endif
|
||||
|
||||
extern int target_stopped_data_address_p (struct target_ops *);
|
||||
|
||||
#ifndef target_stopped_data_address
|
||||
#define target_stopped_data_address() \
|
||||
(*current_target.to_stopped_data_address) ()
|
||||
#define target_stopped_data_address(target, x) \
|
||||
(*target.to_stopped_data_address) (target, x)
|
||||
#else
|
||||
/* Horrible hack to get around existing macros :-(. */
|
||||
#define target_stopped_data_address_p(CURRENT_TARGET) (1)
|
||||
#endif
|
||||
|
||||
/* This will only be defined by a target that supports catching vfork events,
|
||||
|
|
Loading…
Reference in a new issue