i386 int3 handling, running vs stepping

Doug Evans dje@google.com
Mon Feb 2 00:52:00 GMT 2009

On Sun, Feb 1, 2009 at 3:32 PM, Daniel Jacobowitz <drow@false.org> wrote:
> On Sun, Feb 01, 2009 at 03:18:19PM -0800, Doug Evans wrote:
>> Program received signal SIGTRAP, Trace/breakpoint trap.
>> main () at int3.S:6
>> 6             nop
>> Note that $pc is the insn AFTER the int3.
>> Question: Is this a bug?  Should $pc point to the int3 instead?
>> [whether that's achieved with decr_pc_after_break or whatever
>> is a separate question]
>> I can argue either case, I don't have a preference per se.
> I think it's right the way it is, and I know people take advantage of
> this for hardwired breakpoints.

btw, i386-tdep.c:i386_displaced_step_fixup has this:

          /* If we have stepped over a breakpoint, set the %eip to
             point at the breakpoint instruction itself.

             (gdbarch_decr_pc_after_break was never something the core
             of GDB should have been concerned with; arch-specific
             code should be making PC values consistent before
             presenting them to GDB.)  */
          if (i386_breakpoint_p (insn))
              if (debug_displaced)
                fprintf_unfiltered (gdb_stdlog,
                                    "displaced: stepped breakpoint\n");

Given that the pc should be left AFTER the int3 when stepping over it,
do we want to delete this code?

More information about the Gdb mailing list