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/breakpoint.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/breakpoint.c')
-rw-r--r-- | gdb/breakpoint.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 9afbdbd..3908dab 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -2603,12 +2603,26 @@ build_target_command_list (struct bp_location *bl) bl->target_info.persist = 1; } -/* Return the kind of breakpoint on address *ADDR. */ +/* Return the kind of breakpoint on address *ADDR. Get the kind + of breakpoint according to ADDR except single-step breakpoint. + Get the kind of single-step breakpoint according to the current + registers state. */ static int breakpoint_kind (struct bp_location *bl, CORE_ADDR *addr) { - return gdbarch_breakpoint_kind_from_pc (bl->gdbarch, addr); + if (bl->owner->type == bp_single_step) + { + struct thread_info *thr = find_thread_global_id (bl->owner->thread); + struct regcache *regcache; + + regcache = get_thread_regcache (thr->ptid); + + return gdbarch_breakpoint_kind_from_current_state (bl->gdbarch, + regcache, addr); + } + else + return gdbarch_breakpoint_kind_from_pc (bl->gdbarch, addr); } /* Insert a low-level "breakpoint" of some type. BL is the breakpoint |