diff options
author | David Daney <ddaney@avtrex.com> | 2009-04-14 00:59:47 +0000 |
---|---|---|
committer | David Daney <ddaney@avtrex.com> | 2009-04-14 00:59:47 +0000 |
commit | 2facfe5cc4eeb8beccbf013adf4b01403c44ce2b (patch) | |
tree | a848fc2b0c02262215c2c2db27a7eed4d9f5e0e5 /gdb/infrun.c | |
parent | bf21c8117e589023a86755fec81413e1e24602bc (diff) | |
download | gdb-2facfe5cc4eeb8beccbf013adf4b01403c44ce2b.zip gdb-2facfe5cc4eeb8beccbf013adf4b01403c44ce2b.tar.gz gdb-2facfe5cc4eeb8beccbf013adf4b01403c44ce2b.tar.bz2 |
2009-04-13 David Daney <ddaney@caviumnetworks.com>
* infrun.c (maybe_software_singlestep): New function.
(resume): Call maybe_software_singlestep.
(handle_inferior_event): Same.
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r-- | gdb/infrun.c | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c index 7a9f4e9..f139ea8 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -950,6 +950,29 @@ set_schedlock_func (char *args, int from_tty, struct cmd_list_element *c) } } +/* Try to setup for software single stepping over the specified location. + Return 1 if target_resume() should use hardware single step. + + GDBARCH the current gdbarch. + PC the location to step over. */ + +static int +maybe_software_singlestep (struct gdbarch *gdbarch, CORE_ADDR pc) +{ + int hw_step = 1; + + if (gdbarch_software_single_step_p (gdbarch) + && gdbarch_software_single_step (gdbarch, get_current_frame ())) + { + hw_step = 0; + /* Do not pull these breakpoints until after a `wait' in + `wait_for_inferior' */ + singlestep_breakpoints_inserted_p = 1; + singlestep_ptid = inferior_ptid; + singlestep_pc = pc; + } + return hw_step; +} /* Resume the inferior, but allow a QUIT. This is useful if the user wants to interrupt some lengthy single-stepping operation @@ -1031,20 +1054,9 @@ a command like `return' or `jump' to continue execution.")); } } - if (step && gdbarch_software_single_step_p (gdbarch)) - { - /* Do it the hard way, w/temp breakpoints */ - if (gdbarch_software_single_step (gdbarch, get_current_frame ())) - { - /* ...and don't ask hardware to do it. */ - step = 0; - /* and do not pull these breakpoints until after a `wait' in - `wait_for_inferior' */ - singlestep_breakpoints_inserted_p = 1; - singlestep_ptid = inferior_ptid; - singlestep_pc = pc; - } - } + /* Do we need to do it the hard way, w/temp breakpoints? */ + if (step) + step = maybe_software_singlestep (gdbarch, pc); /* If there were any forks/vforks/execs that were caught and are now to be followed, then do so. */ @@ -2826,11 +2838,14 @@ targets should add new threads to the thread list themselves in non-stop mode.") the inferior over it. If we have non-steppable watchpoints, we must disable the current watchpoint; it's simplest to disable all watchpoints and breakpoints. */ - + int hw_step = 1; + if (!HAVE_STEPPABLE_WATCHPOINT) remove_breakpoints (); registers_changed (); - target_resume (ecs->ptid, 1, TARGET_SIGNAL_0); /* Single step */ + /* Single step */ + hw_step = maybe_software_singlestep (current_gdbarch, read_pc ()); + target_resume (ecs->ptid, hw_step, TARGET_SIGNAL_0); waiton_ptid = ecs->ptid; if (HAVE_STEPPABLE_WATCHPOINT) infwait_state = infwait_step_watch_state; |