summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* aarch64: Fix __sigset build issue on muslCDave Watson2020-05-271-1/+1
| | | | | | Described in issue #176. Taken from Alpine Linux project. Change __sigset_t to sigset_t
* Fix signal stacks on illumos/SolarisJason King2020-04-291-2/+3
|
* Add initial support for Solaris x86-64Adeel2019-06-124-6/+18
|
* solaris portAlexander Esilevich2019-06-122-1/+3
|
* Delete hardcode of address size to support MIPS64. (#114)archerypp2019-04-241-3/+0
| | | | | Use the define for dwarf_addr_size in include/dwarf_i.h instead of hardcode(4) to support various MIPS architectures. Signed-off-by: Archer Yan <ayan@wavecomp.com>
* x86_64: Fix tdep_init_done when built with libatomic_opsDave Watson2019-04-111-0/+4
| | | | Use correct size variable.
* Tsan (#109)Dave Watson2019-04-031-0/+5
| | | x86_64: tsan clean
* Fixed a missing dependency in dwarf-eh.h Stephen Roberts2019-02-211-0/+1
| | | | | The dwarf-eh.h header is not self-contained, which causes problems depending on which order headers are included. In particular, it references the Elf_W macro but does not include its definition. If dwarf-eh.h is included after dwarf_i.h everything works, but if you reverse this order you get compile errors. This patch removes the implicit header ordering dependency by making sure the definition of Elf_W is visible in dwarf-eh.h. I include libunwind_i.h rather than the elfxx.h files directly because libunwind_i.h contains macro logic to choose which elf header to include, and I didn't want to duplicate that.
* dwarf: Push correct CFA onto stack for dwarf expression evaluation. (#93)Stephen Roberts2018-11-131-1/+1
| | | | | | | | dwarf: Push correct CFA onto stack for dwarf expression evaluation. This change fixes a bug where stale CFAs were pushed onto the dwarf expression stack before expression evaluation. Some optimising compilers emit CFI which relies on this being correct.
* aarch64: Use __asm__ instead of asm (#89)Guido Günther2018-10-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise this fails to compile with -stc=c99 like: $ cat <<EOF > bla.c #include <libunwind.h> int main() { unw_tdep_context_t *uc = NULL; unw_tdep_getcontext(uc); } EOF # This works $ gcc bla.c # This does not $ gcc -std=c99 bla.c In file included from /usr/include/aarch64-linux-gnu/libunwind.h:7, from bla.c:1: bla.c: In function ‘main’: bla.c:6:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asm’ unw_tdep_getcontext(uc); ^~~~~~~~~~~~~~~~~~~ bla.c:6:5: error: ‘mcontext_t’ {aka ‘struct <anonymous>’} has no member named ‘regs’; did you mean ‘__regs’? unw_tdep_getcontext(uc); ^~~~~~~~~~~~~~~~~~~ bla.c:6:5: error: ‘unw_base’ undeclared (first use in this function); did you mean ‘unw_ctx’? unw_tdep_getcontext(uc); ^~~~~~~~~~~~~~~~~~~ bla.c:6:5: note: each undeclared identifier is reported only once for each function it appears in bla.c:6:5: error: invalid lvalue in asm output 0 unw_tdep_getcontext(uc); ^~~~~~~~~~~~~~~~~~~ See https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html: The asm keyword is a GNU extension. When writing code that can be compiled with -ansi and the various -std options, use __asm__ instead of asm (see Alternate Keywords).
* aarch64: fix freebsd supportmyfreeweb2018-08-071-0/+11
| | | implement _UPT_access_fpreg, _UCD_access_reg_freebsd for aarch64, and add a unw_fpsimd_context_t instead of using the one from the linux headers.
* s390x: fix build when long double is more than 64 bitsMichael Munday2018-06-202-5/+5
| | | | | | | | The floating point registers on s390x are 64-bits wide so type them as double precision rather than long double. Also, GCC on Ubuntu 18.04 complains about the sizeof calls so fix those too.
* mipsN32: A modification suggestion to support mips N32Deng, Yimin (NSB - CN/Shanghai)2018-04-242-1/+9
|
* aarch64: tune down size of unw_context_t and unw_cursor_t (#71)Dave Watson2018-04-101-4/+28
| | | | | | aarch64 defines a huge __reserved field in sigcontext. Cut it down to only the used FP fields. unw_cursor_t can also be cut down a bit, while still maintaining some reserved space.
* Remove unw_handle_signal_frame from header. (#70)Bert Wesarg2018-04-021-2/+0
|
* Add port to Linux on IBM Z (s390x)Michael Munday2018-01-096-0/+497
| | | | | | | | | | | | | | | | | | | | | | | | This adds a port to Linux on the IBM Z platform (a.k.a s390x). It only supports the 64-bit ABI. Most functionality is working and all the tests pass with the exception of the coredump tests*. Unwinding is only supported if DWARF unwind information is present. libunwind can't currently make use of the backchain (if present). The getcontext/setcontext functions only preserve/restore a subset of registers. Currently this only consists of callee-saved registers and some parameter registers. Vector registers and access registers are not saved (and aren't callee- saved) by getcontext and cannot currently be modified. They will however be restored unmodified after resuming a context from a signal handler. There is no special libunwind support for setjmp, the functionality is emulated using glibc (I think all the ports do this for modern Linux kernels). * Unwinding on s390x requires floating point register access which the coredump library doesn't currently support.
* ALIAS unwind_get_accessorsDave Watson2017-12-281-0/+2
|
* ALIAS dwarf symbolsDave Watson2017-12-282-1/+3
|
* Remove PROTECTED visibilityDave Watson2017-12-282-4/+1
| | | | This only works on bfd ld, not lld or gold.
* dwarf: Fix size of state to avoid corrupting rs_stackMichael Munday2017-11-281-1/+1
| | | | | | | | | | DW_CFA_remember_state used memcpy to overwrite state with the value of rs_current. Unfortunately rs_current was slightly larger than state, possibly resulting in rs_stack->next being overwritten. Fix this by making the type of state match the type of rs_current and using an assigment to perform the copy rather than memcpy. This should ensure that the types match in future.
* dwarf: Allow DWARF version both 3 and 4 (#56)Yichao Yu2017-10-311-1/+2
|
* arm: FreeBSD/ARMv6 portKonstantin Belousov2017-08-242-2/+14
| | | | Sponsored by: The FreeBSD Foundation
* half finished unw_local_init2Dave Watson2017-08-161-2/+8
|
* Bring back support for UNW_CACHE_PER_THREAD.Bert Wesarg2017-08-153-16/+4
| | | | | Needs to be build with --enable-per-thread-cache. Default caching policy is also UNW_CACHE_PER_THREAD than.
* arm: getcontext switches back to thumb modeBernhard Rosenkraenzer2017-08-151-1/+2
| | | | | | | | | | | The ARM Thumb implementation of unw_tdep_getcontext switches to ARM mode (".code 32"), but doesn't switch back to Thumb mode. In gcc, this is fine (it automatically switches back to Thumb mode at the end of an asm block), but in clang, this causes bad assembly output (thumb instructions generated by C/C++ code later on are interpreted as ARM mode assembly, which can't work). Switching back to Thumb mode manually fixes clang, and is a no-op for gcc.
* Fix ARM jmpbuf header include bug.credmon2017-08-151-1/+1
| | | | tdep/jmpbuf.h was not including arm-tdep/jmpbuf.h.
* dwarf: fix synthetic eh_frame_hdrDoug Moore2017-07-061-2/+2
| | | | | | | | | | | Ben Avison (bavison@riscopen.org) has observed that when a synthetic eh_frame_hdr is generated, there is no space in it for the eh_frame, so the eh_frame value is written to, and later read from, memory that is not assigned to this purpose, with unpredictable results. This change adds a new field to the dwarf_eh_frame_hdr type, to make room for that value, and adds the (packed) attribute to the struct defintion to avoid a problem with unused space in the struct.
* libunwind-arm: fix build failure due to asm()Romain Naour2017-07-051-2/+2
| | | | | | | | | | | | | | mesa3d on ARM build with libunwind support enabled fail to build due to asm() function used when building with -std=c99. The gcc documentation [1] suggest to use __asm__ instead of asm. Fixes: https://urldefense.proofpoint.com/v2/url?u=http-3A__autobuild.buildroot.net_results_3ef_3efe156b6494e4392b6c31de447ee2c72acc1a53&d=DwICAg&c=5VD0RTtNlTh3ycd41b3MUw&r=vou6lT5jmE_fWQWZZgNrsMWu4RT87QAB9V07tPHlP5U&m=BlAszRQ0vewy5vW7raCh9FmNOACKez_juz55zoiNfUs&s=4sXL6_rFriQz7qi5ygKXBIVHMc7YSdCBnkkHoi347CU&e= [1] https://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html#Alternate-Keywords Signed-off-by: Romain Naour <romain.naour@smile.fr> Cc: Bernd Kuhls <bernd.kuhls@t-online.de>
* aarch64: reduce UNW_TDEP_CURSOR_LEN to 512 on aarch64.Stephen Chen2017-06-201-1/+1
| | | | This allows libunwind to work in situations with limited stack size (ie. fibers). 512 is still more than enough for storing the cursor with some slack. (#25)
* arm: Use dwarf_find_proc_info for arm dwarf processingDoug Moore2017-06-201-12/+0
| | | | | | | | | | | Rather than using a copy of dwarf_find_proc_info that differs from it slightly. By using dwarf_find_proc_info, a potential search of the di table is allowed, where it is omitted now. Also, for ARM, avoid runtime checks about which kind of unwind table search to use after dl_iterate_phdr. A couple of Debug() warnings about ip lookup failure are lost here. The dwarf callback struct defintion is moved to Gfind_proc_info-lsb.c, which becomes the only source file that needs it.
* Dwarf cache nodes are allocated in a round-robin fashion, despite theDoug Moore2017-06-161-3/+1
| | | | | 'lru' prefix used in several data fields. Drop the unnecessary fields, and just use a simple counter to track the next cache entry to be recycled.
* Leave ret_addr_column out of the data that gets copied when pushing/poppingDoug Moore2017-05-201-3/+9
| | | | data on/off the register state stack.
* Drop reference to dwarf.ret_addr_column.Doug Moore2017-05-191-1/+0
|
* Move the ret_addr_column field from dwarf_reg_cache_entry to dwarf_reg_state,Doug Moore2017-05-161-1/+1
| | | | | | | | | | | | | | | | | so that it will get saved and restored with the register state. Initialize the rs_state version of ret_addr_column at the some time the dwarf_cursor version is initialized, and don't bother copying ret_addr_column explicitly from cursor to cache since it's copied implicitly as part of reg_state. Use the reg_state version in apply_reg_state, instead of the cursor version. Which brings up the question: why do we have ret_addr_column in the dwarf_cursor? We call find_reg_state before calling apply_reg_state, so the value of ret_addr_column in the cursor when dwarf_step gets called gets overwritten before it is used. So it's initial value doesn't matter. But some architectures do funky things with cursor->ret_addr_column, even though I don't see how they matter. So I'm not deleting dwarf_cursor->ret_addr_column, even though I suspect this patch makes it useless.
* Change dwarf_reg_state from an array of pairs of differently-sized objectsDoug Moore2017-05-161-8/+2
| | | | | to a pair of arrays, to reduce internal fragmentation. Reduces storage use by 37.5% on x86_64.
* Bury the last_ip field until it can reappear in version 2.0.Doug Moore2017-05-121-0/+2
|
* Move ret_addr_column and signal_frame from dwarf_reg_state toDoug Moore2017-05-1212-27/+26
| | | | | dwarf_reg_cache_entry, leaving in dwarf_reg_state only what apply_reg_state needs.
* Remove next field from dwarf_reg_state. Create new structDoug Moore2017-05-121-1/+7
| | | | | that includes next field and dwarf_reg_state, and use that strictly for stack push/pop in run_cfi_program.
* In dwarf_apply_reg_state change from dewarf_reg_state_t back to struct ↵Doug Moore2017-05-121-1/+1
| | | | dwarf_reg_state.
* Add a function to capture the dwarf_reg_states that occur in processingDoug Moore2017-05-122-0/+13
| | | | | the dwarf code for a procedure, and a function to apply a captured dwarf_reg_state later.
* Capture the address of the first byte after the instructionless gapDoug Moore2017-05-121-0/+1
| | | | that follows the procedure.
* Pull cache-related fields out of reg_state, and put them into reg_cache struct.Doug Moore2017-05-121-3/+10
|
* dwarf:Drop dwarf_create_state_record.Doug Moore2017-04-281-3/+0
| | | | In dwarf_make_proc_info, fix a leak in the case that create_state_record fails.
* ppc: fix inverted checkPaul Pluzhnikov2017-04-051-2/+2
|
* ppc: return UNW_INVALID instead of assert on unaligned addressesPaul Pluzhnikov2017-04-051-2/+4
| | | | | | | | | | | In src/ppc64/Gstep.c, we use fetch32 to fetch instruction from the inferior process. In UNW_REMOTE case, fetch32 asserts that the address we are fetching from is aligned. But if the inferior is corrupt, we can get unaligned IP, and hit the assert. Attached patch removes the assert, and makes fetch32 (and fetch16) return -UNW_EINVAL instead.
* unw_init_local_signalDoug Moore2017-04-031-0/+2
| | | | | init_local, but *not* setting use_prev_instr. This is necessary to correctly unwind using ucontext argument to signal handlers.
* mips: support MIPS64 n32 modeVicente Olivert Riera2017-03-021-4/+7
| | | | | | | | | | | | The attached patch fixes a problem with Xorg on MIPS64 n32 which is explained here: https://bugs.freedesktop.org/show_bug.cgi?id=79939 Basically, libunwind is using a word size of 64-bit for all MIPS variants. Then, Xorg does a casting to (void *) of a 64-bit variable provided by libunwind. Given that the size of the pointers in MIPS64 n32 is 32-bit wide, that casting causes an error like this one: backtrace.c:90:20: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
* mips: remote unwind supportRene Nielsen2017-03-021-2/+2
| | | | | | | | | | | | | | | | libunwind already had support for local unwind on a MIPS. This patch makes support for remote unwinding on a MIPS. I should add a few words to the changes to _UPT_access_mem.c: On MIPS, an unw_word_t is defined as a 64-bit integer whether it's compiled for a 32- or a 64-bit MIPS. When doing remote unwinding using the default _UPT_accessors, dwarf_readu8() therefore expects _UPT_access_mem() to return a 64-bit integer. However, if compiled on a 32-bit MIPS, only 32 bits are valid upon return from _UPT_access_mem(). The patch detects this and will in this case perform two calls to ptrace(PTRACE_POKE/PEEK_DATA) and organize the return value according to endianness.
* mips: fix compiler warningsRene Nielsen2017-02-141-3/+3
| | | | | This fixes a number of compiler warnings I got when compiling for mips32el with gcc 5.3.0.
* Add aarch64 getcontext functionality.Christopher Ferris2017-01-241-2/+25
| | | | Change-Id: I32912a85c0fd02bb5e45a9eb7deb2410ded352a9