summaryrefslogtreecommitdiff
path: root/src/x86
Commit message (Collapse)AuthorAgeFilesLines
* avoid leaking registers across sigreturnJameson Nash2022-05-222-4/+7
| | | | | Mostly just relevant for fp registers, which are frequently mostly just ignored otherwise.
* Updated to determine PAGE_SIZE dynamically.Daniel Moody2022-03-101-11/+2
|
* x86_64: Stop aliasing RSP and CFAKeno Fischer2021-11-263-2/+5
| | | | | | | | | | | | | | | | | | | | | | 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
* Add support for older versions of AndroidOle André Vadla Ravnås2020-12-031-0/+4
| | | | | | | 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.
* Use C11 atomicsSteve MacLean2020-05-213-5/+5
|
* Fix compilation with -fno-common.Yichao Yu2020-03-311-8/+7
| | | | | | | 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...
* ALIAS unwind_get_accessorsDave Watson2017-12-282-2/+2
|
* Remove unw_handle_signal_frame from public API.Dave Watson2017-12-284-5/+7
|
* Remove PROTECTED visibilityDave Watson2017-12-2814-19/+19
| | | | This only works on bfd ld, not lld or gold.
* Use `ucontext_t` instead of `struct ucontext` (#49)Yichao Yu2017-10-311-1/+1
| | | | Ref https://github.com/libunwind/libunwind/pull/40. I didn't caught it last time since I don't have a 32bits buildbot.
* x86: Fix build (#45)Konstantin Baladurin2017-10-171-0/+2
| | | We should include <sys/syscall.h> for SYS_rt_sigreturn in x86/Gos-linux.c
* x86: Add sigreturn asm stubDave Watson2017-08-242-2/+26
| | | | | | | 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
* Change unw_init_local_signal to unw_init_local2(..., UNW_INIT_SIGNAL_FRAME)Dave Watson2017-08-161-2/+13
| | | | Add unw_init_local2 with a flag for better extensibility in the future
* Bring back support for UNW_CACHE_PER_THREAD.Bert Wesarg2017-08-151-1/+1
| | | | | Needs to be build with --enable-per-thread-cache. Default caching policy is also UNW_CACHE_PER_THREAD than.
* Drop reference to dwarf.ret_addr_column.Doug Moore2017-05-192-2/+0
|
* Add a function to capture the dwarf_reg_states that occur in processingDoug Moore2017-05-124-0/+84
| | | | | the dwarf code for a procedure, and a function to apply a captured dwarf_reg_state later.
* unw_init_local_signalDoug Moore2017-04-031-3/+15
| | | | | init_local, but *not* setting use_prev_instr. This is necessary to correctly unwind using ucontext argument to signal handlers.
* use target dependent names for stack registersSaleem Abdulrasool2017-01-181-2/+2
| | | | | | | | 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.
* dwarf: Correct handling of DW_CFA_GNU_args_sizeDave Watson2017-01-131-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Fixup invalid return code checks of unw_is_signal_frame()Chris Redmon2017-01-131-1/+1
| | | | | | 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())".
* One time whitespace fixup.Arun Sharma2014-09-2716-277/+277
| | | | | | for f in $(find src include -name '*.[ch]'); do expand -t 8 $f > $tmp; mv $tmp $f; done
* Adjust use_prev_instr for syscall and frame-chain frames.Konstantin Belousov2014-08-152-0/+2
| | | | | | 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.
* Use helper to walk past the syscall frames on FreeBSD/x86, similar to ↵Konstantin Belousov2014-08-151-0/+9
| | | | | | FreeBSD/x86_64. The syscall trampolines in FreeBSD libc do not have unwind annotations.
* unw_is_signal_frame should return false/0 for bad addressesdave lerner2013-03-101-4/+5
| | | | | | | 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>
* Apply `define_lock()'Tommi Rantala2012-09-281-1/+1
| | | | We have a nice macro for defining pthread mutexes, use it.
* Constify `dwarf_to_unw_regnum_map'Tommi Rantala2012-09-281-1/+1
|
* Stop including `memory.h'Tommi Rantala2012-09-281-1/+0
| | | | | | 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 tdep_init() flag logicTommi Rantala2012-09-283-5/+5
| | | | | Invert the flag that signals that tdep_init() was called, to move the symbol from data to BSS.
* Fix memory leaks in unw_create_addr_space() wrong-endian error pathsTommi Rantala2012-08-211-6/+8
| | | | | | | | | | 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.
* Provide the FreeBSD implementation for _UI_siglongjmp_cont on x86.Konstantin Belousov2012-02-051-0/+22
| | | | | | On FreeBSD, _NSIG is at least 128, so just pass a pointer to the signal mask in the register. Add my copyright.
* FreeBSD also supports PT_GNU_STACK.Konstantin Belousov2012-02-052-4/+0
|
* Fix incorrect calls to memset.Arun2011-10-021-1/+1
| | | | | | Found when compiling libunwind with clang. Signed-off-by: Paul Pluzhnikov <ppluzhnikov@google.com>
* Fast back-trace for x86_64 for only collecting the call stack.Lassi Tuura2011-03-241-0/+1
| | | | | | 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.
* Fix the page boundary crossing bug.Arun Sharma2010-06-081-3/+9
| | | | Signed-off-by: Jason Evans <jasone@canonware.com>
* Add unwind annotations for freebsd/x86 getcontext.S.Konstantin Belousov2010-05-021-15/+22
| | | | | | 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.
* Merge branch 'master' into freebsdKonstantin Belousov2010-05-025-3/+8
|\
| * Add unwind descriptors to getcontext.SArun Sharma2010-04-282-0/+4
| |
| * During the stack unwinding process, the return address points toLassi Tuura2010-04-243-3/+4
| | | | | | | | | | | | | | | | | | | | | | 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>
* | msync() also may be called on unaligned address.Konstantin Belousov2010-04-211-2/+2
| |
* | Account for possible unaligned access.Konstantin Belousov2010-04-211-1/+1
| |
* | Use mincore instead of msync when availableKonstantin Belousov2010-04-201-0/+11
| |
* | Save FPU context for i386.Konstantin Belousov2010-04-171-9/+25
|/
* Fix compiler warnings on x86 LinuxArun Sharma2010-04-141-0/+3
|
* Use correct offset name and value for ucontext offset in struct sigframeKonstantin Belousov2010-04-142-2/+2
|
* Add abort() after sigreturn callsKonstantin Belousov2010-04-141-0/+2
|
* Fix typo.Konstantin Belousov2010-04-141-1/+1
|
* Do not save FPU context on x86 for now; XMM save area must be 16-bytes alignedKonstantin Belousov2010-04-131-0/+7
|
* Separate getcontext implementation for x86Konstantin Belousov2010-04-132-41/+73
|
* Save %eax for i386Konstantin Belousov2010-04-131-4/+4
|
* Merge branch 'master' into freebsdKonstantin Belousov2010-04-121-3/+0
|\