From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 12 07:47:53 2005 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 86BDA16A41C for ; Tue, 12 Jul 2005 07:47:53 +0000 (GMT) (envelope-from simon@comsys.ntu-kpi.kiev.ua) Received: from comsys.ntu-kpi.kiev.ua (comsys.ntu-kpi.kiev.ua [195.245.194.142]) by mx1.FreeBSD.org (Postfix) with ESMTP id B707643D46 for ; Tue, 12 Jul 2005 07:47:28 +0000 (GMT) (envelope-from simon@comsys.ntu-kpi.kiev.ua) Received: from pm514-9.comsys.ntu-kpi.kiev.ua (pm514-9.comsys.ntu-kpi.kiev.ua [10.18.54.109]) (authenticated bits=0) by comsys.ntu-kpi.kiev.ua (8.12.10/8.12.10) with ESMTP id j6C7qt61095950 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 Jul 2005 10:52:56 +0300 (EEST) Received: by pm514-9.comsys.ntu-kpi.kiev.ua (Postfix, from userid 1000) id 8B90B384; Tue, 12 Jul 2005 10:44:44 +0300 (EEST) Date: Tue, 12 Jul 2005 10:44:44 +0300 From: Andrey Simonenko To: mats.lindberg@se.transport.bombardier.com Message-ID: <20050712074444.GA648@pm514-9.comsys.ntu-kpi.kiev.ua> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: ClamAV 0.82/969/Wed Jul 6 11:53:40 2005 on comsys.ntu-kpi.kiev.ua X-Virus-Status: Clean Cc: hackers@freebsd.org Subject: Re: corefiles X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2005 07:47:53 -0000 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.