Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* i386 int3 handling, running vs stepping
@ 2009-02-01 23:18 Doug Evans
  2009-02-01 23:33 ` Daniel Jacobowitz
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Doug Evans @ 2009-02-01 23:18 UTC (permalink / raw)
  To: gdb

gdb is inconsistent in its handling of int3 instructions on x86.

bash$ cat int3.S
	.text
	.global main
main:
	nop
	int3
	nop
	hlt

bash$ gcc -g -Wa,-g int3.S -o int3
bash$ gdb int3
(gdb) run
-->
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.

Trying things again, this time stepi'ing over the insn:

bash$ gdb int3
(gdb) start
[...]
Temporary breakpoint 1, main () at int3.S:4
4		nop
Current language:  auto; currently asm
(gdb) si
5		int3
(gdb) si
6		nop
(gdb) 

Note that int3 was stepping over without a SIGTRAP being generated.

[I haven't tried setting a breakpoint at the int3 insn, but
GDB can know whether it's stepping over one of its own breakpoints
or an int3 that's part of the program, so I think(!) gdb can be consistent
here regardless.]

The only question I have is what should the value of $pc be after
hitting an int3 instruction during normal execution? (ie. no stepping,
no breakpoints).


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-02-03  9:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-01 23:18 i386 int3 handling, running vs stepping Doug Evans
2009-02-01 23:33 ` Daniel Jacobowitz
2009-02-01 23:38   ` Doug Evans
2009-02-02  4:25     ` Daniel Jacobowitz
2009-02-02 20:03       ` Doug Evans
2009-02-02 21:49         ` Daniel Jacobowitz
2009-02-03  1:26           ` Doug Evans
2009-02-03  4:08             ` Daniel Jacobowitz
2009-02-03  9:22           ` Mark Kettenis
2009-02-02  0:52   ` Doug Evans
2009-02-02  6:08   ` Robert Dewar
2009-02-02  6:19 ` teawater
2009-02-03  9:21 ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox