diff options
Diffstat (limited to 'gdb/gdbserver/linux-arm-low.c')
-rw-r--r-- | gdb/gdbserver/linux-arm-low.c | 73 |
1 files changed, 44 insertions, 29 deletions
diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c index d7813ab..c4cfbd4 100644 --- a/gdb/gdbserver/linux-arm-low.c +++ b/gdb/gdbserver/linux-arm-low.c @@ -439,43 +439,39 @@ arm_linux_hw_breakpoint_equal (const struct arm_linux_hw_breakpoint *p1, return p1->address == p2->address && p1->control == p2->control; } +/* Convert a raw breakpoint type to an enum arm_hwbp_type. */ + +static int +raw_bkpt_type_to_arm_hwbp_type (enum raw_bkpt_type raw_type) +{ + switch (raw_type) + { + case raw_bkpt_type_hw: + return arm_hwbp_break; + case raw_bkpt_type_write_wp: + return arm_hwbp_store; + case raw_bkpt_type_read_wp: + return arm_hwbp_load; + case raw_bkpt_type_access_wp: + return arm_hwbp_access; + default: + gdb_assert_not_reached ("unhandled raw type"); + } +} + /* Initialize the hardware breakpoint structure P for a breakpoint or watchpoint at ADDR to LEN. The type of watchpoint is given in TYPE. Returns -1 if TYPE is unsupported, or -2 if the particular combination of ADDR and LEN cannot be implemented. Otherwise, returns 0 if TYPE represents a breakpoint and 1 if type represents a watchpoint. */ static int -arm_linux_hw_point_initialize (char type, CORE_ADDR addr, int len, - struct arm_linux_hw_breakpoint *p) +arm_linux_hw_point_initialize (enum raw_bkpt_type raw_type, CORE_ADDR addr, + int len, struct arm_linux_hw_breakpoint *p) { arm_hwbp_type hwbp_type; unsigned mask; - /* Breakpoint/watchpoint types (GDB terminology): - 0 = memory breakpoint for instructions - (not supported; done via memory write instead) - 1 = hardware breakpoint for instructions (supported) - 2 = write watchpoint (supported) - 3 = read watchpoint (supported) - 4 = access watchpoint (supported). */ - switch (type) - { - case '1': - hwbp_type = arm_hwbp_break; - break; - case '2': - hwbp_type = arm_hwbp_store; - break; - case '3': - hwbp_type = arm_hwbp_load; - break; - case '4': - hwbp_type = arm_hwbp_access; - break; - default: - /* Unsupported. */ - return -1; - } + hwbp_type = raw_bkpt_type_to_arm_hwbp_type (raw_type); if (hwbp_type == arm_hwbp_break) { @@ -559,9 +555,26 @@ update_registers_callback (struct inferior_list_entry *entry, void *arg) return 0; } +static int +arm_supports_z_point_type (char z_type) +{ + switch (z_type) + { + case Z_PACKET_HW_BP: + case Z_PACKET_WRITE_WP: + case Z_PACKET_READ_WP: + case Z_PACKET_ACCESS_WP: + return 1; + default: + /* Leave the handling of sw breakpoints with the gdb client. */ + return 0; + } +} + /* Insert hardware break-/watchpoint. */ static int -arm_insert_point (char type, CORE_ADDR addr, int len) +arm_insert_point (enum raw_bkpt_type type, CORE_ADDR addr, + int len, struct raw_breakpoint *bp) { struct process_info *proc = current_process (); struct arm_linux_hw_breakpoint p, *pts; @@ -600,7 +613,8 @@ arm_insert_point (char type, CORE_ADDR addr, int len) /* Remove hardware break-/watchpoint. */ static int -arm_remove_point (char type, CORE_ADDR addr, int len) +arm_remove_point (enum raw_bkpt_type type, CORE_ADDR addr, + int len, struct raw_breakpoint *bp) { struct process_info *proc = current_process (); struct arm_linux_hw_breakpoint p, *pts; @@ -896,6 +910,7 @@ struct linux_target_ops the_low_target = { arm_reinsert_addr, 0, arm_breakpoint_at, + arm_supports_z_point_type, arm_insert_point, arm_remove_point, arm_stopped_by_watchpoint, |