summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Fix typos (#397)Adeel Mujahid2022-08-042-3/+3
| | | | | | | * Fix typos * Cleanup trailing whitespaces in committed files * Update include/tdep-ia64/libunwind_i.h
* Make `sigaltstack()` optionalStephen Webb2022-07-262-6/+23
| | | | | | Some (older) OSes do not support this POSIX function. Make it optional. Fixes #379.
* Stop assuming .text and .eh_frame segmentStephen Webb2022-07-261-11/+0
| | | | | | | | | | | | | | | | | | | | | | | The coredump remote was architected on the assumption that the .text and .eh_frame sections were mapped onto the same segment, and that that segment was always the first PT_LOAD segment in an ELF file. Well, that was never a valid assumption, and moderns releases of various toolchains have started splitting the PT_LOAD segments for security reasons. This change implements an M:N mapping of PT_LOAD segments in a coredump file to backing ELF files and calculates and adjusts offsets appropriately. Because the backing files get mapped in a lot of file I/O operations have been replaced with simple memory reads. Once a backing file is memory mapped is stays mapped until the address space is destroyed. The ucd_*.[ch] files contain only functions that should not be exposed through the public API so they;re not mangled using the UB naming schedule because I just bring myself to write code with undefined behaviour. Reformatted some of the changed files using `astyle --style=gnu` for internal consistency withing the file. Fixes #363
* Expose get_proc_info_in_range APIAdeel2022-07-081-0/+2
|
* Remove bashisms from tests/check-namespace.shStephen Webb2022-06-231-1/+1
| | | | | | Stray errors were being reported on travis.ci because /bin/sh was not bash. Fixes #374.
* Allow an alternate LOG_DRIVER to be specifiedStephen Webb2022-06-231-0/+2
| | | | | | | Specifying --with-testdriver=TESTDRIVER at configure time allows the substitution of a alternative LOG_DRIVER to be specified to enable remote testing of a cross-built target. See the automake docuemntation on Custom Test Drivers for more information.
* Add port for Linux on LoongArchYouling Tang2021-11-302-1/+22
| | | | | | | | | | | | | | This commit adds support for Linux on LoongArch. Only 64-bit is supported at the moment. The changes were tested on a LoongArch architecture Loongson-3A5000 processor (LoongArch is a new RISC ISA, which is a bit like MIPS or RISC-V.). Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Qing Zhang <zhangqing@loongson.cn> Signed-off-by: Jinyang He <hejinyang@loongson.cn> Signed-off-by: Youling Tang <tangyouling@loongson.cn>
* Expose function-pointer-to-name APIBjörn Svensson2021-11-261-0/+2
| | | | | | The unw_get_proc_name_by_ip() function returns the name of a procedure just like unw_get_proc_name(), except that it's looked up by an instruction-pointer instead of a cursor.
* Work around lack of execvpe on FreeBSDAlex Arslan2021-09-011-0/+4
| | | | | | | Commit 06468efcb52fb1ecbffed99818c1f567c60b1b90 switched `test-ptrace.c` to use `execvpe` instead of `execve`. However, the former doesn't exist on FreeBSD. This now adds a guard such that `execve` is used on FreeBSD and `execvpe` is retained on other systems.
* test-setjmp: Zero out all sigsetsJim Wilson2021-07-111-0/+4
| | | | | | Since glibc 2.32 [1], sigemptyset() no longer clears the entire sigset_t. [1] "signal: Use <sigsetops.h> for sigemptyset, sigfillset" (9f6bd1f6057e57cce9b07844c28f15859ab15d49)
* test-ptrace: Fix for NixOSZhaofeng Li2021-07-111-2/+2
| | | | In NixOS, coreutils aren't in their FHS-mandated locations.
* Ltest-mem-validate: Disable inlining for consume_and_runZhaofeng Li2021-07-111-4/+18
| | | | See #222 and #227. The tests are so fragile :(
* Add port for Linux on RISC-V (riscv)Zhaofeng Li2021-07-062-0/+19
| | | | | This commit adds support for Linux on RISC-V. Only 64-bit is supported at the moment.
* disallow tail-call optimization in testsJameson Nash2021-02-171-0/+1
| | | | This disallows frame reuse for tail and other sibling calls.
* Gtest-exc depends on frames not being inlinedJameson Nash2020-12-171-2/+20
| | | | | | The test is unwinding a precise number of frames, which assumes the compiler will not inline these functions. Mark this explicitly to be more reliable, and add some more verbose debugging aids.
* Use __linux__ define everywhere instead of __linuxMilian Wolff2020-09-081-2/+2
| | | | | | | | | | | | | | | The libunwind code base uses __linux__ already in many locations, but some others relied on __linux instead. Apparently on some older toolchain configurations, such as Ubuntu Trusty that's still used for AppImage generation sometimes, __linux is never defined - only __linux__ is. Fixes compiler warning on such platforms: ``` coredump/_UPT_get_dyn_info_list_addr.c: In function 'get_list_addr': coredump/_UPT_get_dyn_info_list_addr.c:86:3: warning: #warning Implement get_list_addr(), please. [-Wcpp] # warning Implement get_list_addr(), please. ^ ```
* Link Ltest-cxx-exceptions with libunwindAdrian Bunk2020-07-151-0/+1
| | | | | | | Bernhard Übelacker noticed that Ltest-cxx-exceptions was actually testing the gcc implementation due to not linking with libunwind. Fixes: #129
* Use NT_FILE to get backing file names if availableStephen Webb2020-07-021-4/+9
| | | | | A Linux core dump passes backing file names for LOAD segments. The coredump library should take advantage of them if they are present.
* Consistently use POSIX <ucontext.h>Stephen Webb2020-06-181-1/+1
| | | | | Use the (former) POSIX-standard <ucontext.h> everywhere instead of sometimes using the Linux-specxific <sys/ucontext.h>.
* Fix Gtest-trace output for illumos/SolarisJason King2020-04-281-1/+1
|
* Add additional symbols to ignore on illumos and SolarisJason King2020-04-281-0/+5
|
* Update Gtest-bt for illumos and SolarisJason King2020-04-281-3/+3
|
* tests: fix test-coredump-unwind without HAVE_EXECINFO_H (#165)TBK2020-03-261-2/+6
|
* Fix SmartOS/Solaris build (#158)Adeel Mujahid2020-03-091-0/+3
|
* change asm to __asm__ to support -std=c11 or similar (#149)Billy Donahue2020-03-091-1/+1
|
* Allow to build without weak `backtrace` symbol. (#142)Bert Wesarg2019-12-041-1/+1
| | | Signed-off-by: Bert Wesarg <bert.wesarg@tu-dresden.de>
* Little FreeBSD build fix (#135)David CARLIER2019-10-311-1/+0
|
* x86_64: Add fixup code if previous RIP was invalid (#120)Brock York2019-06-122-1/+124
| | | | | | | | | | | | * x86_64: Add fixup code if previous RIP was invalid Previous RIP could become invalid if a bad function pointer was followed. Calling unwind from a signal frame in this case skips the frame that called the bad pointer. Check if the value at RSP looks to be valid in this case. It should be the value of RIP pushed to the stack by the CALL instruction. If it looks valid use this value as the next frames RIP else fallback to the previous method.
* Add initial support for Solaris x86-64Adeel2019-06-121-0/+1
|
* dwarf: Push correct CFA onto stack for dwarf expression evaluation. (#93)Stephen Roberts2018-11-134-1/+167
| | | | | | | | 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.
* tests: Include wait-related headers for Ltest-mem-validate (#74)Alex Arslan2018-04-121-0/+2
| | | | Without these, I was getting errors from this test set claiming that wait, WIFCONTINUED, et al. were undefined on FreeBSD 11.1.
* Fix crasher test for gcc >= 8 when using -O2 or -O3. (#67)Romain Geissler @ Amadeus2018-03-061-0/+5
|
* Add port to Linux on IBM Z (s390x)Michael Munday2018-01-091-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove unw_handle_signal_frame from public API.Dave Watson2017-12-281-2/+0
|
* Fix intermittent test failure in test-resume-sig (#51)Yichao Yu2017-10-311-0/+8
| | | | | | | | | | | | | | | | | (At least on x86(_32),) `unw_resume` will call `setcontext` which will modify the signal masks based on the value in the context. Since the signal mask is not being initialized by `unw_getcontext`, this cause the signal mask to be set to a random (uninitialized) value after `unw_resume` which cause the test to fail since it relies on the signal mask for SIGUSR2 being cleared. The proper fix is likely to either make `unw_resume` not touch the signal mask if the context wasn't initialized with a signal ucontext, or to make `unw_getcontext` record the signal mask too. It's unclear to me which approach should be taken... In the mean time, the intermittent failure can be fixed simply by zero initialing the context first which would clear all the signal masks. When siginfo is available, a more reliable way is to use the `ucontext` passed in to the signal handler directly and rely on `sigreturn` to reset it. Unfortunately, this is currently not implemented on all archs either.
* Fix init-local-signal test (#50)Yichao Yu2017-10-312-2/+3
| | | | | | | | | * Add `SA_SIGINFO` flag This is needed to guarantee the availability of the `ucontext` argument * Mark the `NULL` pointer load as `volatile` Further prevent any compiler optimization on the load.
* check: Fix run-coredump-unwind-mdi when in a out-of-tree build.Bert Wesarg2017-09-211-1/+1
|
* arm: FreeBSD/ARMv6 portKonstantin Belousov2017-08-243-1/+11
| | | | Sponsored by: The FreeBSD Foundation
* multilib: XFAIL some testsDave Watson2017-08-241-0/+7
| | | | Ptrace interface doesn't understand multilib registers, so tests all fail.
* x86_64: fix mincore_validate and msync_validateJohannes Ziegenbalg2017-08-242-0/+146
| | | | | | | | The calls to mincore() or msync() are not checking for actual accessibility this could lead to SIGSEGV if the address from a mapped page with the PROT_NONE property occurs on the stack. Hence an attempt to write one byte from the checked address to a pipe will fail if the address is not readable.
* Change unw_init_local_signal to unw_init_local2(..., UNW_INIT_SIGNAL_FRAME)Dave Watson2017-08-161-2/+2
| | | | Add unw_init_local2 with a flag for better extensibility in the future
* half finished unw_local_init2Dave Watson2017-08-161-2/+2
|
* Bring back support for UNW_CACHE_PER_THREAD.Bert Wesarg2017-08-152-0/+4
| | | | | Needs to be build with --enable-per-thread-cache. Default caching policy is also UNW_CACHE_PER_THREAD than.
* tests: Fix heap overflow in coredump-unwind testPaul Pluzhnikov2017-08-071-1/+1
| | | | | | We've tried to run slightly modified test-coredump-unwind.c built with tcmalloc, and it promptly crashed. Attached patch fixes the heap buffer overflow bug which caused it.
* test: Add a test like test-mem, but using reg_states_iterate to find the ↵Doug Moore2017-06-072-2/+136
| | | | | | state and apply_reg_state to use it to complete the unw_step.
* Leave ret_addr_column out of the data that gets copied when pushing/poppingDoug Moore2017-05-201-0/+2
| | | | data on/off the register state stack.
* Add new names to check-namespace.Doug Moore2017-05-121-0/+4
|
* travis: run unittests for x86_64Dave Watson2017-04-041-1/+1
| | | | some tests are failing with clang currently.
* tests: unw_init_local_signal testDave Watson2017-04-033-0/+67
|
* unw_init_local_signalDoug Moore2017-04-031-1/+3
| | | | | init_local, but *not* setting use_prev_instr. This is necessary to correctly unwind using ucontext argument to signal handlers.