| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Mostly just relevant for fp registers, which are frequently mostly just
ignored otherwise.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RSP and CFA are different concepts. RSP refers to the physical
register, CFA is a virtual register that serves as the base
address for various other saved registers. It is true that
in many frames these are set to alias, however this is not
a requirement. For example, a function that performs a stack
switch would likely change the rsp in the middle of the function,
but would keep the CFA at the original RSP such that saved registers
may be appropriately recovered.
We are seeing incorrect unwinds in the Julia runtime when running
julia under rr. This is because injects code (with correct CFI)
that performs just such a stack switch [1]. GDB manages to unwind
this correctly, but libunwind incorrectly sets the rsp to the CFA
address, causing a misunwind.
Tested on x86_64, patches for other architectures are ported, but
not tested.
[1] https://github.com/rr-debugger/rr/blob/469c22059a4a1798d33a8a224457faf22b2c178c/src/preload/syscall_hook.S#L454
|
|
|
|
|
|
|
| |
Based on:
- dl_iterate_phdr() patch by Jeff Muizelaar.
- maps_next() improvement from AOSP: 7d46a21.
- unwi_unwind_method and x86_local_resume() from AOSP: 1c82a52.
|
| |
|
|
|
|
|
|
|
| |
Making all other archs consistent with IA64 which should not have this problem.
Also move the FIXME to the correct place.
Also add some minimum comments about this...
|
| |
|
| |
|
|
|
|
| |
This only works on bfd ld, not lld or gold.
|
|
|
|
| |
Ref https://github.com/libunwind/libunwind/pull/40.
I didn't caught it last time since I don't have a 32bits buildbot.
|
|
|
| |
We should include <sys/syscall.h> for SYS_rt_sigreturn in x86/Gos-linux.c
|
|
|
|
|
|
|
| |
glibc no longer defines sigreturn, but we want to use it
when unwinding through signal stacks to resture the signal mask,
without forcing all uses of getcontext/setcontext to save and
restore the signal mask
|
|
|
|
| |
Add unw_init_local2 with a flag for better extensibility in the future
|
|
|
|
|
| |
Needs to be build with --enable-per-thread-cache. Default caching policy
is also UNW_CACHE_PER_THREAD than.
|
| |
|
|
|
|
|
| |
the dwarf code for a procedure, and a function to apply a captured
dwarf_reg_state later.
|
|
|
|
|
| |
init_local, but *not* setting use_prev_instr.
This is necessary to correctly unwind using ucontext argument to signal handlers.
|
|
|
|
|
|
|
|
| |
When adjusting the stack for a DW_CFA_arg_size adjustment, ensure that
we use the target dependent register name as the generic name does not
necessarily map to the same register. For example, on x86, ESP maps to
the eip register, which results in the wrong stack adjustment being
applied.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When resuming execution, DW_CFA_GNU_args_size from the current frame
must be added back to the stack pointer. Clang now generates these frequently
at -O3. A simple repro for x86_64, that will crash with clang ~3.9 or newer:
void f(int, int,int,int,int,int,int,int,int);
int main() {
try {
f(0,1,2,3,4,5,6,7,8);
} catch (int) {
return 0;
}
return 1;
}
Where f is something that throws an int, but in a different translation unit to
prevent optimization.
This results in cfi instructions before the call:
.cfi_escape 0x2e, 0x20
Grabbing the args_size means fully parsing the cfi in the current frame, which
is unfortunate because it means nearly twice the work at each step. The logic
to grab args_size can be in unw_step or get_proc_info (since this is always
called before resuming in stack unwinding). Putting it in get_proc_info allows
the more common unw_step code to remain fast.
It would potentially fit in nicely with a proc info cache (as mentioned in the
if0 comment block)
|
|
|
|
|
|
| |
unw_is_signal_frame() returns <= 0 if not a signal frame. Several places in
code were only checking for a "if (unw_is_signal_frame())", or
"if (!unw_is_signal_frame())".
|
|
|
|
|
|
| |
for f in $(find src include -name '*.[ch]'); do
expand -t 8 $f > $tmp; mv $tmp $f;
done
|
|
|
|
|
|
| |
Mark frames which are unwound with the frame-chain walker or
syscall frame code, as non-interrupted. The return PC in the frame
points to the instruction after the call.
|
|
|
|
|
|
| |
FreeBSD/x86_64.
The syscall trampolines in FreeBSD libc do not have unwind annotations.
|
|
|
|
|
|
|
| |
access_mem() could fail and return a non-zero value, which callers
interpret as boolean true.
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
|
|
|
|
| |
We have a nice macro for defining pthread mutexes, use it.
|
| |
|
|
|
|
|
|
| |
I am unable to find any reference to `memory.h' in the C99 and C11
committee drafts, so include `string.h' instead when we need memset() or
similar.
|
|
|
|
|
| |
Invert the flag that signals that tdep_init() was called, to move the
symbol from data to BSS.
|
|
|
|
|
|
|
|
|
|
| |
Check the endianness earlier in unw_create_addr_space() on all
architectures to avoid leaking the dynamically allocated address space
struct.
This was already fixed for ARM in commit cf6a99879604 ("Fix memory leak
in ARM unw_create_addr_space()"). Move the endianness check also on ARM
to avoid malloc() & free() in the error case.
|
|
|
|
|
|
| |
On FreeBSD, _NSIG is at least 128, so just pass a pointer to the
signal mask in the register.
Add my copyright.
|
| |
|
|
|
|
|
|
| |
Found when compiling libunwind with clang.
Signed-off-by: Paul Pluzhnikov <ppluzhnikov@google.com>
|
|
|
|
|
|
| |
Adds new function to perform a pure stack walk without unwinding,
functionally similar to backtrace() but accelerated by an address
attribute cache the caller maintains across calls.
|
|
|
|
| |
Signed-off-by: Jason Evans <jasone@canonware.com>
|
|
|
|
|
|
| |
Rearrange the code to put the slow branch out of main body,
and pinch the fixed amount of stack space to be able to annotate
the code.
|
|\ |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
the instruction after the call for a normal frame. libunwind uses
IP-1 to lookup unwind information. However, this is not necessary for
interrupted frames such as signal frames (or interrupt frames) in
the kernel context.
This patch handles both cases correctly.
Based on work by Mark Wielaard <mwielaard@redhat.com>
|
| | |
|
| | |
|
| | |
|
|/ |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\ |
|