diff options
author | Yao Qi <yao.qi@linaro.org> | 2016-11-03 14:35:14 +0000 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2016-11-03 14:35:14 +0000 |
commit | 833b7ab5008b769dca6db6d5ee1d21d33e730132 (patch) | |
tree | fc32095c2c5c42d58de5ef58eeec05fb0af80da2 /gdb/gdbarch.c | |
parent | 22f13eb869197fc45a0da2a8a96b03d39809862e (diff) | |
download | gdb-833b7ab5008b769dca6db6d5ee1d21d33e730132.zip gdb-833b7ab5008b769dca6db6d5ee1d21d33e730132.tar.gz gdb-833b7ab5008b769dca6db6d5ee1d21d33e730132.tar.bz2 |
Determine the kind of single step breakpoint
This patch adds a new gdbarch method breakpoint_kind_from_current_state
for single step breakpoint, and uses it in breakpoint_kind.
gdb:
2016-11-03 Yao Qi <yao.qi@linaro.org>
* arch-utils.c (default_breakpoint_kind_from_current_state):
New function.
* arch-utils.h (default_breakpoint_kind_from_current_state):
Declare.
* arm-tdep.c (arm_breakpoint_kind_from_current_state): New
function.
(arm_gdbarch_init): Call
set_gdbarch_breakpoint_kind_from_current_state.
* breakpoint.c (breakpoint_kind): Call
gdbarch_breakpoint_kind_from_current_state for single step
breakpoint. Update comments.
* gdbarch.sh (breakpoint_kind_from_current_state): New.
* gdbarch.c, gdbarch.h: Regenerate.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r-- | gdb/gdbarch.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 1a3acab..463f6e0 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -232,6 +232,7 @@ struct gdbarch gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc; gdbarch_breakpoint_kind_from_pc_ftype *breakpoint_kind_from_pc; gdbarch_sw_breakpoint_from_kind_ftype *sw_breakpoint_from_kind; + gdbarch_breakpoint_kind_from_current_state_ftype *breakpoint_kind_from_current_state; gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address; gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint; gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint; @@ -406,6 +407,7 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->return_in_first_hidden_param_p = default_return_in_first_hidden_param_p; gdbarch->breakpoint_from_pc = default_breakpoint_from_pc; gdbarch->sw_breakpoint_from_kind = NULL; + gdbarch->breakpoint_kind_from_current_state = default_breakpoint_kind_from_current_state; gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint; gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint; gdbarch->remote_register_number = default_remote_register_number; @@ -587,6 +589,7 @@ verify_gdbarch (struct gdbarch *gdbarch) if (gdbarch->breakpoint_kind_from_pc == 0) fprintf_unfiltered (log, "\n\tbreakpoint_kind_from_pc"); /* Skip verify of sw_breakpoint_from_kind, invalid_p == 0 */ + /* Skip verify of breakpoint_kind_from_current_state, invalid_p == 0 */ /* Skip verify of adjust_breakpoint_address, has predicate. */ /* Skip verify of memory_insert_breakpoint, invalid_p == 0 */ /* Skip verify of memory_remove_breakpoint, invalid_p == 0 */ @@ -796,6 +799,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: breakpoint_from_pc = <%s>\n", host_address_to_string (gdbarch->breakpoint_from_pc)); fprintf_unfiltered (file, + "gdbarch_dump: breakpoint_kind_from_current_state = <%s>\n", + host_address_to_string (gdbarch->breakpoint_kind_from_current_state)); + fprintf_unfiltered (file, "gdbarch_dump: breakpoint_kind_from_pc = <%s>\n", host_address_to_string (gdbarch->breakpoint_kind_from_pc)); fprintf_unfiltered (file, @@ -2823,6 +2829,23 @@ set_gdbarch_sw_breakpoint_from_kind (struct gdbarch *gdbarch, } int +gdbarch_breakpoint_kind_from_current_state (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR *pcptr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->breakpoint_kind_from_current_state != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_breakpoint_kind_from_current_state called\n"); + return gdbarch->breakpoint_kind_from_current_state (gdbarch, regcache, pcptr); +} + +void +set_gdbarch_breakpoint_kind_from_current_state (struct gdbarch *gdbarch, + gdbarch_breakpoint_kind_from_current_state_ftype breakpoint_kind_from_current_state) +{ + gdbarch->breakpoint_kind_from_current_state = breakpoint_kind_from_current_state; +} + +int gdbarch_adjust_breakpoint_address_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); |