Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jul 2005 10:44:44 +0300
From:      Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
To:        mats.lindberg@se.transport.bombardier.com
Cc:        hackers@freebsd.org
Subject:   Re: corefiles
Message-ID:  <20050712074444.GA648@pm514-9.comsys.ntu-kpi.kiev.ua>
In-Reply-To: <OF0D06AB5E.BF765095-ONC125702E.0021A6D5-C125703C.001C24C3@UK.BOMBARDIER.TRANSPORT.COM>
References:  <OF0D06AB5E.BF765095-ONC125702E.0021A6D5-C125703C.001C24C3@UK.BOMBARDIER.TRANSPORT.COM>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jul 12, 2005 at 07:07:24AM +0200, mats.lindberg@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050712074444.GA648>