--- .pc/displaced-stepping-always/gdb/infrun.c 2009-07-15 00:36:51.000000000 -0700 +++ gdb/infrun.c 2009-07-15 11:16:42.000000000 -0700 @@ -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; @@ -961,15 +971,19 @@ maybe_software_singlestep (struct gdbarc { int hw_step = 1; - if (gdbarch_software_single_step_p (gdbarch) - && gdbarch_software_single_step (gdbarch, get_current_frame ())) + if (gdbarch_software_single_step_p (gdbarch)) { - 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; + if (use_displaced_stepping (gdbarch)) + hw_step = 0; + else if (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; } @@ -1037,7 +1051,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))