2012-03-19 Luis Machado * infrun.c (resume): Change order of statements and update PC to the real PC in case of displaced stepping. Index: HEAD-git/gdb/infrun.c =================================================================== --- HEAD-git.orig/gdb/infrun.c 2012-03-19 20:40:57.589621232 -0300 +++ HEAD-git/gdb/infrun.c 2012-03-19 22:12:08.729898472 -0300 @@ -1884,15 +1884,6 @@ a command like `return' or `jump' to con resume_ptid = inferior_ptid; } - if (gdbarch_cannot_step_breakpoint (gdbarch)) - { - /* 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 (aspace, pc)) - step = 0; - } - if (debug_displaced && use_displaced_stepping (gdbarch) && tp->control.trap_expected) @@ -1902,12 +1893,25 @@ a command like `return' or `jump' to con CORE_ADDR actual_pc = regcache_read_pc (resume_regcache); gdb_byte buf[4]; + /* Update pc to reflect the new address from which we will execute + instructions due to displaced stepping. */ + pc = actual_pc; + fprintf_unfiltered (gdb_stdlog, "displaced: run %s: ", paddress (resume_gdbarch, actual_pc)); read_memory (actual_pc, buf, sizeof (buf)); displaced_step_dump_bytes (gdb_stdlog, buf, sizeof (buf)); } + if (gdbarch_cannot_step_breakpoint (gdbarch)) + { + /* 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 (aspace, pc)) + step = 0; + } + /* Install inferior's terminal modes. */ target_terminal_inferior ();