This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: SIGTRAP signal generated by gdb


On Thu, 02 Jun 2011 16:34:46 +0200, logitech wrote:
> When printed, the status printed is stopped and the signal is SIGTRAP during
> prog execution.

Not sure what you refer to but to debug live process GDB uses ptrace which
generates SIGTRAP during various events such as a singlestep.

(gdb) set debug lin-lwp 1
(gdb) set debug infrun 1
(gdb) stepi
[...]
LLR: Preparing to step process 32363, 0, inferior_ptid Thread 0x7ffff7fe2720 (LWP 32363)
[...]
LLR: PTRACE_SINGLESTEP process 32363, 0 (resume event thread)
[...]
LLW: waitpid 32363 received Trace/breakpoint trap (stopped)
[...]
infrun:   status->kind = stopped, signal = SIGTRAP

> My doubt is, where exactly is this SIGTRAP sent to the inferior (also who
> sends it)

See `man ptrace'.  CPU invokes interrupt during various debugging events (such
as CPU flag TF (trace flag - for `stepi') - or hitting `int3' (software
breakpoint) which Linux kernel translates into the SIGTRAP userland event.


Regards,
Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]