summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPierre Muller <muller@ics.u-strasbg.fr>2009-05-11 11:13:06 +0000
committerPierre Muller <muller@ics.u-strasbg.fr>2009-05-11 11:13:06 +0000
commit9af34d70a7c9477cf829ded4d47d1b85aa53f527 (patch)
tree371e7ae59ce212ba6d9b364f0b458c6910b941b1 /gdb
parent8d788c4955ae08f78f24d006373373ee38175d90 (diff)
downloadgdb-9af34d70a7c9477cf829ded4d47d1b85aa53f527.tar.gz
Unify target macros.
* target.h (STOPPED_BY_WATCHPOINT): Delete, replaced by ... (target_stoppped_by_watchpoint): New macro. (HAVE_STEPPABLE_WATCHPOINT): Delete, replaced by ... (target_have_steppable_watchpoint): New macro. (HAVE_CONTINUABLE_WATCHPOINT): Delete, replace by ... (target_have_continuable_watchpoint): New macro. (TARGET_CAN_USE_HARDWARE_WATCHPOINT):Delete, replaced by ... (target_can_use_hardware_watchpoint): New macro. (TARGET_REGION_OK_FOR_HW_WATCHPOINT):Delete, replaced by ... (target_region_ok_for_hw_watchpoint): New macro. * breakpoint.c (update_watchpoint): Use new macros. (bpstat_alloc): Likewise. (create_breakpoint): Likewise. (watch_command_1): Likewise. (can_use_hardware_watchpoint): Likewise. (do_enable_breakpoint): Likewise. * infrun.c (handle_inferior_event): Adapt to new macros. * mips-tdep.c (mips_gdbarch_init): Update comments. * procfs.c (procfs_set_watchpoint): Update comment. (procfs_insert_watchpoint): Adapt to new macros. * remote-m32r-sdi.c (m32r_stop): * remote-mips.c (mips_remove_breakpoint): * target.c (debug_to_region_ok_for_hw_watchpoint): Update to new macros. (debug_to_stopped_by_watchpoint): Likewise.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog31
-rw-r--r--gdb/breakpoint.c12
-rw-r--r--gdb/infrun.c8
-rw-r--r--gdb/mips-tdep.c8
-rw-r--r--gdb/procfs.c4
-rw-r--r--gdb/remote-m32r-sdi.c2
-rw-r--r--gdb/remote-mips.c2
-rw-r--r--gdb/target.c4
-rw-r--r--gdb/target.h12
9 files changed, 57 insertions, 26 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ebb3fa6d56b..47506de4200 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,34 @@
+2009-05-11 Pierre Muller <muller.u-strasbg.fr>
+
+ Unify target macros.
+
+ * target.h (STOPPED_BY_WATCHPOINT): Delete, replaced by ...
+ (target_stoppped_by_watchpoint): New macro.
+ (HAVE_STEPPABLE_WATCHPOINT): Delete, replaced by ...
+ (target_have_steppable_watchpoint): New macro.
+ (HAVE_CONTINUABLE_WATCHPOINT): Delete, replace by ...
+ (target_have_continuable_watchpoint): New macro.
+ (TARGET_CAN_USE_HARDWARE_WATCHPOINT):Delete, replaced by ...
+ (target_can_use_hardware_watchpoint): New macro.
+ (TARGET_REGION_OK_FOR_HW_WATCHPOINT):Delete, replaced by ...
+ (target_region_ok_for_hw_watchpoint): New macro.
+
+ * breakpoint.c (update_watchpoint): Use new macros.
+ (bpstat_alloc): Likewise.
+ (create_breakpoint): Likewise.
+ (watch_command_1): Likewise.
+ (can_use_hardware_watchpoint): Likewise.
+ (do_enable_breakpoint): Likewise.
+ * infrun.c (handle_inferior_event): Adapt to new macros.
+ * mips-tdep.c (mips_gdbarch_init): Update comments.
+ * procfs.c (procfs_set_watchpoint): Update comment.
+ (procfs_insert_watchpoint): Adapt to new macros.
+ * remote-m32r-sdi.c (m32r_stop):
+ * remote-mips.c (mips_remove_breakpoint):
+ * target.c (debug_to_region_ok_for_hw_watchpoint): Update to new macros.
+ (debug_to_stopped_by_watchpoint): Likewise.
+
+
2009-05-10 Pierre Muller <muller.u-strasbg.fr>
* src/gdb/target.h: Remove all tests for already defined
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 35db0f375d1..e832596f10b 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -961,7 +961,7 @@ update_watchpoint (struct breakpoint *b, int reparse)
b->type = bp_watchpoint;
else
{
- int target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT
+ int target_resources_ok = target_can_use_hardware_watchpoint
(bp_hardware_watchpoint, i + mem_cnt, other_type_used);
if (target_resources_ok <= 0)
b->type = bp_watchpoint;
@@ -2602,7 +2602,7 @@ bpstat_alloc (const struct bp_location *bl, bpstat cbs /* Current "bs" value */
int
watchpoints_triggered (struct target_waitstatus *ws)
{
- int stopped_by_watchpoint = STOPPED_BY_WATCHPOINT (*ws);
+ int stopped_by_watchpoint = target_stopped_by_watchpoint ();
CORE_ADDR addr;
struct breakpoint *b;
@@ -5249,7 +5249,7 @@ create_breakpoint (struct symtabs_and_lines sals, char *addr_string,
{
int i = hw_breakpoint_used_count ();
int target_resources_ok =
- TARGET_CAN_USE_HARDWARE_WATCHPOINT (bp_hardware_breakpoint,
+ target_can_use_hardware_watchpoint (bp_hardware_breakpoint,
i + 1, 0);
if (target_resources_ok == 0)
error (_("No hardware breakpoint support in the target."));
@@ -6170,7 +6170,7 @@ watch_command_1 (char *arg, int accessflag, int from_tty)
{
i = hw_watchpoint_used_count (bp_type, &other_type_used);
target_resources_ok =
- TARGET_CAN_USE_HARDWARE_WATCHPOINT (bp_type, i + mem_cnt,
+ target_can_use_hardware_watchpoint (bp_type, i + mem_cnt,
other_type_used);
if (target_resources_ok == 0 && bp_type != bp_hardware_watchpoint)
error (_("Target does not support this type of hardware watchpoint."));
@@ -6308,7 +6308,7 @@ can_use_hardware_watchpoint (struct value *v)
CORE_ADDR vaddr = VALUE_ADDRESS (v) + value_offset (v);
int len = TYPE_LENGTH (value_type (v));
- if (!TARGET_REGION_OK_FOR_HW_WATCHPOINT (vaddr, len))
+ if (!target_region_ok_for_hw_watchpoint (vaddr, len))
return 0;
else
found_memory_cnt++;
@@ -7977,7 +7977,7 @@ do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition)
int i;
i = hw_breakpoint_used_count ();
target_resources_ok =
- TARGET_CAN_USE_HARDWARE_WATCHPOINT (bp_hardware_breakpoint,
+ target_can_use_hardware_watchpoint (bp_hardware_breakpoint,
i + 1, 0);
if (target_resources_ok == 0)
error (_("No hardware breakpoint support in the target."));
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 1876a01bfef..903f31c6a25 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2568,7 +2568,7 @@ targets should add new threads to the thread list themselves in non-stop mode.")
{
fprintf_unfiltered (gdb_stdlog, "infrun: stop_pc = 0x%s\n",
paddr_nz (stop_pc));
- if (STOPPED_BY_WATCHPOINT (&ecs->ws))
+ if (target_stopped_by_watchpoint ())
{
CORE_ADDR addr;
fprintf_unfiltered (gdb_stdlog, "infrun: stopped by watchpoint\n");
@@ -2824,7 +2824,7 @@ targets should add new threads to the thread list themselves in non-stop mode.")
/* If necessary, step over this watchpoint. We'll be back to display
it in a moment. */
if (stopped_by_watchpoint
- && (HAVE_STEPPABLE_WATCHPOINT
+ && (target_have_steppable_watchpoint
|| gdbarch_have_nonsteppable_watchpoint (current_gdbarch)))
{
/* At this point, we are stopped at an instruction which has
@@ -2849,14 +2849,14 @@ targets should add new threads to the thread list themselves in non-stop mode.")
disable all watchpoints and breakpoints. */
int hw_step = 1;
- if (!HAVE_STEPPABLE_WATCHPOINT)
+ if (!target_have_steppable_watchpoint)
remove_breakpoints ();
/* Single step */
hw_step = maybe_software_singlestep (current_gdbarch, stop_pc);
target_resume (ecs->ptid, hw_step, TARGET_SIGNAL_0);
registers_changed ();
waiton_ptid = ecs->ptid;
- if (HAVE_STEPPABLE_WATCHPOINT)
+ if (target_have_steppable_watchpoint)
infwait_state = infwait_step_watch_state;
else
infwait_state = infwait_nonstep_watch_state;
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index fa1c7636606..66793fd7fa0 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -6005,11 +6005,11 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
set_gdbarch_print_insn (gdbarch, gdb_print_insn_mips);
- /* FIXME: cagney/2003-08-29: The macros HAVE_STEPPABLE_WATCHPOINT,
- HAVE_NONSTEPPABLE_WATCHPOINT, and HAVE_CONTINUABLE_WATCHPOINT
+ /* FIXME: cagney/2003-08-29: The macros target_have_steppable_watchpoint,
+ HAVE_NONSTEPPABLE_WATCHPOINT, and target_have_continuable_watchpoint
need to all be folded into the target vector. Since they are
- being used as guards for STOPPED_BY_WATCHPOINT, why not have
- STOPPED_BY_WATCHPOINT return the type of watchpoint that the code
+ being used as guards for target_stopped_by_watchpoint, why not have
+ target_stopped_by_watchpoint return the type of watchpoint that the code
is sitting on? */
set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
diff --git a/gdb/procfs.c b/gdb/procfs.c
index e6f20d1154b..8bda43560dd 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -5289,7 +5289,7 @@ procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag,
Note: procfs_can_use_hw_breakpoint() is not yet used by all
procfs.c targets due to the fact that some of them still define
- TARGET_CAN_USE_HARDWARE_WATCHPOINT. */
+ target_can_use_hardware_watchpoint. */
static int
procfs_can_use_hw_breakpoint (int type, int cnt, int othertype)
@@ -5352,7 +5352,7 @@ procfs_stopped_by_watchpoint (void)
static int
procfs_insert_watchpoint (CORE_ADDR addr, int len, int type)
{
- if (!HAVE_STEPPABLE_WATCHPOINT
+ if (!target_have_steppable_watchpoint
&& !gdbarch_have_nonsteppable_watchpoint (current_gdbarch))
{
/* When a hardware watchpoint fires off the PC will be left at
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index 029cc089d72..7aedd3d8da6 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -1398,7 +1398,7 @@ m32r_stop (ptid_t ptid)
/* Tell whether this target can support a hardware breakpoint. CNT
is the number of hardware breakpoints already installed. This
- implements the TARGET_CAN_USE_HARDWARE_WATCHPOINT macro. */
+ implements the target_can_use_hardware_watchpoint macro. */
static int
m32r_can_use_hw_watchpoint (int type, int cnt, int othertype)
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 152fb379ac4..23e845fd704 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -2249,7 +2249,7 @@ mips_remove_breakpoint (struct bp_target_info *bp_tgt)
/* Tell whether this target can support a hardware breakpoint. CNT
is the number of hardware breakpoints already installed. This
- implements the TARGET_CAN_USE_HARDWARE_WATCHPOINT macro. */
+ implements the target_can_use_hardware_watchpoint macro. */
int
mips_can_use_watchpoint (int type, int cnt, int othertype)
diff --git a/gdb/target.c b/gdb/target.c
index f7366f82d0f..d0df43083b7 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -2889,7 +2889,7 @@ debug_to_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
retval = debug_target.to_region_ok_for_hw_watchpoint (addr, len);
fprintf_unfiltered (gdb_stdlog,
- "TARGET_REGION_OK_FOR_HW_WATCHPOINT (%ld, %ld) = 0x%lx\n",
+ "target_region_ok_for_hw_watchpoint (%ld, %ld) = 0x%lx\n",
(unsigned long) addr,
(unsigned long) len,
(unsigned long) retval);
@@ -2904,7 +2904,7 @@ debug_to_stopped_by_watchpoint (void)
retval = debug_target.to_stopped_by_watchpoint ();
fprintf_unfiltered (gdb_stdlog,
- "STOPPED_BY_WATCHPOINT () = %ld\n",
+ "target_stopped_by_watchpoint () = %ld\n",
(unsigned long) retval);
return retval;
}
diff --git a/gdb/target.h b/gdb/target.h
index 5866b42fc60..b94149ab99f 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1053,17 +1053,17 @@ extern char *normal_pid_to_str (ptid_t ptid);
/* Returns non-zero if we were stopped by a hardware watchpoint (memory read or
write). */
-#define STOPPED_BY_WATCHPOINT(w) \
- (*current_target.to_stopped_by_watchpoint) ()
+#define target_stopped_by_watchpoint \
+ (*current_target.to_stopped_by_watchpoint)
/* Non-zero if we have steppable watchpoints */
-#define HAVE_STEPPABLE_WATCHPOINT \
+#define target_have_steppable_watchpoint \
(current_target.to_have_steppable_watchpoint)
/* Non-zero if we have continuable watchpoints */
-#define HAVE_CONTINUABLE_WATCHPOINT \
+#define target_have_continuable_watchpoint \
(current_target.to_have_continuable_watchpoint)
/* Provide defaults for hardware watchpoint functions. */
@@ -1076,10 +1076,10 @@ extern char *normal_pid_to_str (ptid_t ptid);
bp_hardware_breakpoint. CNT is the number of such watchpoints used so far
(including this one?). OTHERTYPE is who knows what... */
-#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(TYPE,CNT,OTHERTYPE) \
+#define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
(*current_target.to_can_use_hw_breakpoint) (TYPE, CNT, OTHERTYPE);
-#define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr, len) \
+#define target_region_ok_for_hw_watchpoint(addr, len) \
(*current_target.to_region_ok_for_hw_watchpoint) (addr, len)