This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: SIGTRAP signal generated by gdb
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: logitech <supriya dot rao17 at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Fri, 3 Jun 2011 09:54:47 +0200
- Subject: Re: SIGTRAP signal generated by gdb
- References: <31758159.post@talk.nabble.com>
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