diff options
author | Pedro Alves <palves@redhat.com> | 2009-05-06 17:18:57 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2009-05-06 17:18:57 +0000 |
commit | 25513619dbf1a7c4daaa32e841d8f560d0d18bf5 (patch) | |
tree | f43dc1321eb698b1548d7b061b7bc8cf2d45b51e /gdb/procfs.c | |
parent | 51f4db8353c6f706435093679977623e5882958c (diff) | |
download | gdb-25513619dbf1a7c4daaa32e841d8f560d0d18bf5.zip gdb-25513619dbf1a7c4daaa32e841d8f560d0d18bf5.tar.gz gdb-25513619dbf1a7c4daaa32e841d8f560d0d18bf5.tar.bz2 |
* procfs.c (procfs_insert_watchpoint, procfs_remove_watchpoint)
(procfs_region_ok_for_hw_watchpoint, procfs_use_watchpoints): New
functions.
(procfs_stopped_by_watchpoint): Made static, ptid argument
removed.
(_initialize_procfs): Register new watchpoint related target
functions.
* config/i386/nm-i386sol2.h (TARGET_CAN_USE_HARDWARE_WATCHPOINT)
(TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT, STOPPED_BY_WATCHPOINT)
(HAVE_CONTINUABLE_WATCHPOINT): Delete.
(target_insert_watchpoint, target_remove_watchpoint): Delete.
(procfs_stopped_by_watchpoint, procfs_set_watchpoint): Delete
declarations.
* config/mips/nm-irix5.h (STOPPED_BY_WATCHPOINT)
(TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT): Delete.
(target_insert_watchpoint, target_remove_watchpoint): Delete.
(procfs_stopped_by_watchpoint, procfs_set_watchpoint): Delete
declarations.
* config/sparc/nm-sol2.h (TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT)
(HAVE_CONTINUABLE_WATCHPOINT, STOPPED_BY_WATCHPOINT): Delete.
(target_insert_watchpoint, target_remove_watchpoint): Delete.
(procfs_stopped_by_watchpoint, procfs_set_watchpoint): Delete
declarations.
Diffstat (limited to 'gdb/procfs.c')
-rw-r--r-- | gdb/procfs.c | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/gdb/procfs.c b/gdb/procfs.c index f62f075..e6f20d1 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -5322,13 +5322,12 @@ procfs_can_use_hw_breakpoint (int type, int cnt, int othertype) * else returns zero. */ -int -procfs_stopped_by_watchpoint (ptid_t ptid) +static int +procfs_stopped_by_watchpoint (void) { procinfo *pi; - pi = find_procinfo_or_die (PIDGET (ptid) == -1 ? - PIDGET (inferior_ptid) : PIDGET (ptid), 0); + pi = find_procinfo_or_die (PIDGET (inferior_ptid), 0); if (!pi) /* If no process, then not stopped by watchpoint! */ return 0; @@ -5350,6 +5349,53 @@ procfs_stopped_by_watchpoint (ptid_t ptid) return 0; } +static int +procfs_insert_watchpoint (CORE_ADDR addr, int len, int type) +{ + if (!HAVE_STEPPABLE_WATCHPOINT + && !gdbarch_have_nonsteppable_watchpoint (current_gdbarch)) + { + /* When a hardware watchpoint fires off the PC will be left at + the instruction following the one which caused the + watchpoint. It will *NOT* be necessary for GDB to step over + the watchpoint. */ + return procfs_set_watchpoint (inferior_ptid, addr, len, type, 1); + } + else + { + /* When a hardware watchpoint fires off the PC will be left at + the instruction which caused the watchpoint. It will be + necessary for GDB to step over the watchpoint. */ + return procfs_set_watchpoint (inferior_ptid, addr, len, type, 0); + } +} + +static int +procfs_remove_watchpoint (CORE_ADDR addr, int len, int type) +{ + return procfs_set_watchpoint (inferior_ptid, addr, 0, 0, 0); +} + +static int +procfs_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) +{ + /* The man page for proc(4) on Solaris 2.6 and up says that the + system can support "thousands" of hardware watchpoints, but gives + no method for finding out how many; It doesn't say anything about + the allowed size for the watched area either. So we just tell + GDB 'yes'. */ + return 1; +} + +void +procfs_use_watchpoints (struct target_ops *t) +{ + t->to_stopped_by_watchpoint = procfs_stopped_by_watchpoint; + t->to_insert_watchpoint = procfs_insert_watchpoint; + t->to_remove_watchpoint = procfs_remove_watchpoint; + t->to_region_ok_for_hw_watchpoint = procfs_region_ok_for_hw_watchpoint; +} + /* * Memory Mappings Functions: */ @@ -5971,6 +6017,10 @@ _initialize_procfs (void) t = procfs_target (); +#ifdef TARGET_HAS_HARDWARE_WATCHPOINTS + procfs_use_watchpoints (t); +#endif + add_target (t); add_info ("proc", info_proc_cmd, _("\ |