Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Jul 2017 15:58:04 -0700
From:      Conrad Meyer <cem@freebsd.org>
To:        Marc Branchaud <marcnarc@xiplink.com>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: libexecinfo backtrace() in a signal handler
Message-ID:  <CAG6CVpXMMWYniDUOGXakO=qiU%2BBBWCcTEknBjS%2BuQcAsPYB1VQ@mail.gmail.com>
In-Reply-To: <4d662753-98bc-1275-9394-0cda95eedc65@xiplink.com>
References:  <4d662753-98bc-1275-9394-0cda95eedc65@xiplink.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jul 6, 2017 at 2:02 PM, Marc Branchaud <marcnarc@xiplink.com> wrote:
> Howdy,
>
> (Please CC replies to me, as I am not subscribed.  Apologies if I'm in the
> wrong forum!)
>
> I'm trying to use libexecinfo's backtrace() in a SIGSEGV handler.  It only
> finds one single frame in the stack, for the signal handler function.
> (Outside of the signal handler backtrace() does return the full stack from
> the call point.)
>
> Is there any way to get the stack from where the SIGSEGV arose?  A few hours
> of Googling has proved fruitless.
>
> My overall goal is to intercept core-dumping signals to try to save a
> textual backtrace instead of a full dump (as they can be quite large in my
> application).  So I'd also like to catch SIGBUS, and maybe SIGFPE too.

Hi Marc,

Signal handlers use a special stack frame that libexecinfo is too
simple to understand.  To get a stack from a signal handler, you might
want to use libunwind instead.

Best,
Conrad



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpXMMWYniDUOGXakO=qiU%2BBBWCcTEknBjS%2BuQcAsPYB1VQ>