|
From: | Aliaksey Kandratsenka |
Subject: | Re: [Libunwind-devel] unw_init_local() with a signal frame context. |
Date: | Sat, 20 Dec 2014 08:24:49 -0800 |
Hi all,
While looking into a report about problems with libunwind unwinding
from __lll_unlock_wake(), I noticed that I was getting some traces
that didn't unwind at all, from one particular address in
__lll_unlock_wake().
On closer inspection, the one IP that fails is the first instruction
in the function, and the failure is that c->use_pre_instr is set,
causing the unwinder to look up the byte just before the function.
I'm getting these traces from libprofiler/gperftools, which gets hold
of the interrupted context in its signal handler (as a ucontext_t *)
and passes it to unw_init_local() as its second argument.
unw_init_local() unconditionally sets use_pre_instr, which is correct
if the context came from unw_getcontext(), but not in this case.
Disabling this path in libprofiler (and switching to a slower one that
calls unw_getcontext() and then discards the first few frames) fixes
the problem.
Arguably this bug is in libprofiler, which ought not to be just
passing a ucontext_t * to unw_init_local (though I see that the man
page suggests this is OK for IA-64 at least). But even so it would be
good if libprofiler could use the signal context it already has,
without setting use_prev_instr.
[Prev in Thread] | Current Thread | [Next in Thread] |