aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorThiago Jung Bauermann <bauerman@br.ibm.com>2011-05-06 18:46:33 +0000
committerThiago Jung Bauermann <bauerman@br.ibm.com>2011-05-06 18:46:33 +0000
commit9c06b0b4285bf0abffaa37bda5b4bf686691d805 (patch)
tree8dbb1651e667706adfca09deab5149071b392496 /gdb/target.c
parentd472a4264b2208644fad65766532806e01c5fba7 (diff)
downloadgdb-9c06b0b4285bf0abffaa37bda5b4bf686691d805.zip
gdb-9c06b0b4285bf0abffaa37bda5b4bf686691d805.tar.gz
gdb-9c06b0b4285bf0abffaa37bda5b4bf686691d805.tar.bz2
2011-05-06 Sergio Durigan Junior <sergiodj@linux.vnet.ibm.com>
Thiago Jung Bauermann <bauerman@br.ibm.com> Implement support for PowerPC BookE masked watchpoints. gdb/ * NEWS: Mention masked watchpoint support. Create "Changed commands" section. * breakpoint.h (struct breakpoint_ops) <works_in_software_mode>: New method. Initialize to NULL in all existing breakpoint_ops instances. (struct breakpoint) <hw_wp_mask>: New field. * breakpoint.c (is_masked_watchpoint): Add prototype. (update_watchpoint): Don't set b->val for masked watchpoints. Call breakpoint's breakpoint_ops.works_in_software_mode if available. (watchpoints_triggered): Handle the case of a hardware masked watchpoint trigger. (watchpoint_check): Likewise. (works_in_software_mode_watchpoint): New function. (insert_masked_watchpoint, remove_masked_watchpoint) (resources_needed_masked_watchpoint) (works_in_software_mode_masked_watchpoint, print_it_masked_watchpoint) (print_one_detail_masked_watchpoint, print_mention_masked_watchpoint) (print_recreate_masked_watchpoint, is_masked_watchpoint): New functions. (masked_watchpoint_breakpoint_ops): New structure. (watch_command_1): Check for the existence of the `mask' parameter. Set b->ops according to the type of hardware watchpoint being created. * ppc-linux-nat.c (ppc_linux_insert_mask_watchpoint) (ppc_linux_remove_mask_watchpoint) (ppc_linux_masked_watch_num_registers): New functions. (_initialize_ppc_linux_nat): Initialize to_insert_mask_watchpoint, to_remove_mask_watchpoint and to_masked_watch_num_registers. * target.c (update_current_target): Mention to_insert_mask_watchpoint, to_remove_mask_watchpoint, and to_masked_watch_num_registers. (target_insert_mask_watchpoint, target_remove_mask_watchpoint) (target_masked_watch_num_registers): New functions. * target.h (struct target_ops) <to_insert_mask_watchpoint>, <to_remove_mask_watchpoint>, <to_masked_watch_num_registers>: New methods. (target_insert_mask_watchpoint, target_remove_mask_watchpoint) (target_masked_watch_num_registers): Add prototypes. gdb/doc/ * gdb.texinfo (Set Watchpoints): Document mask parameter. (PowerPC Embedded): Mention support of masked watchpoints.
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 1e1c38e..9c522cb 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -595,6 +595,8 @@ update_current_target (void)
/* Do not inherit to_ranged_break_num_registers. */
INHERIT (to_insert_watchpoint, t);
INHERIT (to_remove_watchpoint, t);
+ /* Do not inherit to_insert_mask_watchpoint. */
+ /* Do not inherit to_remove_mask_watchpoint. */
INHERIT (to_stopped_data_address, t);
INHERIT (to_have_steppable_watchpoint, t);
INHERIT (to_have_continuable_watchpoint, t);
@@ -602,6 +604,7 @@ update_current_target (void)
INHERIT (to_watchpoint_addr_within_range, t);
INHERIT (to_region_ok_for_hw_watchpoint, t);
INHERIT (to_can_accel_watchpoint_condition, t);
+ /* Do not inherit to_masked_watch_num_registers. */
INHERIT (to_terminal_init, t);
INHERIT (to_terminal_inferior, t);
INHERIT (to_terminal_ours_for_output, t);
@@ -3518,6 +3521,75 @@ target_verify_memory (const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size)
tcomplain ();
}
+/* The documentation for this function is in its prototype declaration in
+ target.h. */
+
+int
+target_insert_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask, int rw)
+{
+ struct target_ops *t;
+
+ for (t = current_target.beneath; t != NULL; t = t->beneath)
+ if (t->to_insert_mask_watchpoint != NULL)
+ {
+ int ret;
+
+ ret = t->to_insert_mask_watchpoint (t, addr, mask, rw);
+
+ if (targetdebug)
+ fprintf_unfiltered (gdb_stdlog, "\
+target_insert_mask_watchpoint (%s, %s, %d) = %d\n",
+ core_addr_to_string (addr),
+ core_addr_to_string (mask), rw, ret);
+
+ return ret;
+ }
+
+ return 1;
+}
+
+/* The documentation for this function is in its prototype declaration in
+ target.h. */
+
+int
+target_remove_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask, int rw)
+{
+ struct target_ops *t;
+
+ for (t = current_target.beneath; t != NULL; t = t->beneath)
+ if (t->to_remove_mask_watchpoint != NULL)
+ {
+ int ret;
+
+ ret = t->to_remove_mask_watchpoint (t, addr, mask, rw);
+
+ if (targetdebug)
+ fprintf_unfiltered (gdb_stdlog, "\
+target_remove_mask_watchpoint (%s, %s, %d) = %d\n",
+ core_addr_to_string (addr),
+ core_addr_to_string (mask), rw, ret);
+
+ return ret;
+ }
+
+ return 1;
+}
+
+/* The documentation for this function is in its prototype declaration
+ in target.h. */
+
+int
+target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask)
+{
+ struct target_ops *t;
+
+ for (t = current_target.beneath; t != NULL; t = t->beneath)
+ if (t->to_masked_watch_num_registers != NULL)
+ return t->to_masked_watch_num_registers (t, addr, mask);
+
+ return -1;
+}
+
/* The documentation for this function is in its prototype declaration
in target.h. */