--- .pc/displaced-step-always/gdb/infrun.c 2009-01-20 13:23:02.000000000 -0800 +++ gdb/infrun.c 2009-01-20 13:23:34.000000000 -0800 @@ -825,6 +825,9 @@ displaced_step_fixup (ptid_t event_ptid, one now. */ while (displaced_step_request_queue) { + struct regcache *regcache; + struct gdbarch *gdbarch; + struct displaced_step_request *head; ptid_t ptid; CORE_ADDR actual_pc; @@ -847,8 +850,12 @@ displaced_step_fixup (ptid_t event_ptid, displaced_step_prepare (ptid); + regcache = get_thread_regcache (ptid); + gdbarch = get_regcache_arch (regcache); + if (debug_displaced) { + CORE_ADDR actual_pc = regcache_read_pc (regcache); gdb_byte buf[4]; fprintf_unfiltered (gdb_stdlog, "displaced: run 0x%s: ", @@ -857,7 +864,10 @@ displaced_step_fixup (ptid_t event_ptid, displaced_step_dump_bytes (gdb_stdlog, buf, sizeof (buf)); } - target_resume (ptid, 1, TARGET_SIGNAL_0); + if (gdbarch_software_single_step_p (gdbarch)) + target_resume (ptid, 0, TARGET_SIGNAL_0); + else + target_resume (ptid, 1, TARGET_SIGNAL_0); /* Done, we're stepping a thread. */ break; @@ -970,6 +980,7 @@ resume (int step, enum target_signal sig struct gdbarch *gdbarch = get_regcache_arch (regcache); struct thread_info *tp = inferior_thread (); CORE_ADDR pc = regcache_read_pc (regcache); + int hw_step = step; QUIT; @@ -1014,7 +1025,8 @@ a command like `return' or `jump' to con comments in the handle_inferior event for dealing with 'random signals' explain what we do instead. */ if (use_displaced_stepping (gdbarch) - && tp->trap_expected + && (tp->trap_expected + || (step && gdbarch_software_single_step_p (gdbarch))) && sig == TARGET_SIGNAL_0) { if (!displaced_step_prepare (inferior_ptid)) @@ -1033,11 +1045,13 @@ a command like `return' or `jump' to con if (step && gdbarch_software_single_step_p (gdbarch)) { + if (use_displaced_stepping (gdbarch)) + hw_step = 0; /* Do it the hard way, w/temp breakpoints */ - if (gdbarch_software_single_step (gdbarch, get_current_frame ())) + else if (gdbarch_software_single_step (gdbarch, get_current_frame ())) { /* ...and don't ask hardware to do it. */ - step = 0; + hw_step = 0; /* and do not pull these breakpoints until after a `wait' in `wait_for_inferior' */ singlestep_breakpoints_inserted_p = 1; @@ -1085,7 +1099,7 @@ a command like `return' or `jump' to con /* If STEP is set, it's a request to use hardware stepping facilities. But in that case, we should never use singlestep breakpoint. */ - gdb_assert (!(singlestep_breakpoints_inserted_p && step)); + gdb_assert (!(singlestep_breakpoints_inserted_p && hw_step)); if (singlestep_breakpoints_inserted_p && stepping_past_singlestep_breakpoint) @@ -1139,13 +1153,14 @@ a command like `return' or `jump' to con /* Most targets can step a breakpoint instruction, thus executing it normally. But if this one cannot, just continue and we will hit it anyway. */ - if (step && breakpoint_inserted_here_p (pc)) - step = 0; + if (hw_step && breakpoint_inserted_here_p (pc)) + hw_step = 0; } if (debug_displaced && use_displaced_stepping (gdbarch) - && tp->trap_expected) + && (tp->trap_expected + || (step && gdbarch_software_single_step_p (gdbarch)))) { struct regcache *resume_regcache = get_thread_regcache (resume_ptid); CORE_ADDR actual_pc = regcache_read_pc (resume_regcache); @@ -1161,7 +1176,7 @@ a command like `return' or `jump' to con happens to apply to another thread. */ tp->stop_signal = TARGET_SIGNAL_0; - target_resume (resume_ptid, step, sig); + target_resume (resume_ptid, hw_step, sig); } discard_cleanups (old_cleanups);