corefiles
Andrey Simonenko
simon at comsys.ntu-kpi.kiev.ua
Tue Jul 12 07:47:53 GMT 2005
On Tue, Jul 12, 2005 at 07:07:24AM +0200, mats.lindberg at se.transport.bombardier.com wrote:
>
> When I try to catch SIGTERM and generate a core file the call
> stack is corrupted on FreeBSD.
A process stack is not corrupted. Since a process was terminated
while it was is a signal handler, it is wrong to interpreter the content
of the stack as for ordinary functions calls chain. I assume that you
use i386 arch and ELF executable. What you see is the content of struct
sigframe{} which was pushed to the stack by machdep.c:sendsig().
>
> #1 0x280b7422 in raise () from /lib/libc.so.5
> #2 0x28129c1b in abort () from /lib/libc.so.5
> #3 0x080486a8 in monitorSignalHandlerTERM (signo=15) at test1.c:15
Since registers are 32-bit long, let's interpreter this (it is better
to get &signo and see other fields, for example "x &signo + 1", etc).
#4 0xbfbfff94 in ?? ()
#5 0x0000000f in ?? () <-- sf_signum (15 -- SIGTERM)
#6 0x00000000 in ?? () <-- sf_siginfo (NULL, since simple signal() was used)
#7 0xbfbfe9d0 in ?? () <-- ptr to ucontext
#8 0x00000002 in ?? ()
#9 0x0804867c in <-- pointer to the handler of SIGTERM signal
Also, signal handler is called by special sigcode() function, which
is "installed" to the user process memory and is "called" by a process
for calling a signal handler and for restoring process context after
signal handler.
More information about the freebsd-hackers
mailing list