1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-12-22 19:43:42 +01:00
Commit graph

3058 commits

Author SHA1 Message Date
333a6bb711 Performance: inline keystone functions 2019-06-10 11:06:41 +02:00
7b2e5e7548 Preprocess out debug code from release builds 2019-06-10 11:06:31 +02:00
11cce868c6 Cache _fde_func 2019-06-09 23:36:22 +02:00
a73203b9bb Add root README 2019-06-09 19:04:09 +02:00
f6cca76ee3 Enhance debug messages 2019-06-09 19:02:24 +02:00
453253dd0e Check for end of call-chain at end of step 2019-06-09 13:41:36 +02:00
6da6a389f9 Keep non-overridden registers' state after step 2019-06-09 13:41:36 +02:00
3b01d66203 eh_elf: allow %rip to be NULL before end-of-chain check 2019-06-09 03:45:55 +02:00
bba251cf13 eh_elf: tolerate slightly out-of-bound mem access
Recover from slightly out-of-bounds wrt. %rsp memory accesses.

When we're unwinding the first frame of a chain, and we start from, eg.
a `pop %rbx` at the end of the function, the DWARF can be out of sync
and still state that eg. `%rbx` is saved at something that simplifies to
`%rsp-8`. Which might not be accessibe through the `access_mem`
abstraction, eg. if we're running perf and it didn't capture the stack
below `%rsp`
2019-06-09 03:42:28 +02:00
cc2d07f550 unw_step dbg: fix unique id 2019-06-08 16:17:06 +02:00
c0f4449920 UnwDebug: also print init_id 2019-06-08 15:54:43 +02:00
82cfdcd3f3 unw_step: use UnwDebug instead of Debug 2019-06-08 15:38:34 +02:00
4979ec08bb unw_step: add unique id debugging features 2019-06-08 15:38:11 +02:00
f02a57cdfc Add project-specific README 2018-08-17 21:15:34 +02:00
b5e2c60ec7 Keep .eh_elf.so files opened 2018-06-27 12:08:49 +02:00
e8941a4c73 Use flags from eh_elfs 2018-06-27 11:38:44 +02:00
b47bfdd204 benching: actually bench 2018-06-15 01:15:48 +02:00
b702cead60 benching: add benching facilities 2018-06-15 01:15:16 +02:00
bfd5b164fa eh_elf: fix a few more errors 2018-06-15 00:01:53 +02:00
7494efbb16 eh_elf: detect eh_elf errors
(No data, unimplemented data type, …)
2018-06-13 19:09:10 +02:00
7d9352d990 eh_elf: fix as_arg not set 2018-06-13 19:08:42 +02:00
96ed4c4d82 eh_elf: handle properly reinit 2018-06-13 19:07:52 +02:00
1493c0ca4b Add memory_map direct providing method
Allow to give the memory map directly through the accessors, in case
this is more handy than providing a PID for some reason (cf. perf
integration)
2018-06-11 19:53:29 +02:00
07e6a1a96f Eh_elf: make local unwinding work
Remote unwinding yet to be tested
2018-06-05 18:22:23 +02:00
1068aa2368 eh_elf: fix memory map 2018-06-05 18:22:15 +02:00
3691f0c18d eh_elf: fix memory map parsing problem
Now correctly parsed, but all unwinding tentatives end up returning -1
(ie mmap_entry not found)
2018-06-04 18:26:23 +02:00
7a3518d325 eh_elf: actually use eh_elf in unw_step 2018-06-04 17:03:51 +02:00
e0efd00acd eh_elf: Implement step_cursor 2018-06-04 16:01:12 +02:00
7f70295713 eh_elf: adopt Makefile.am 2018-06-01 11:19:44 +02:00
4fb0baaa89 Init eh_elf structures upon unw_init_* 2018-05-31 16:43:25 +02:00
da7446a21a Add get_pid in ptrace support 2018-05-31 15:45:07 +02:00
7a747a28b1 Add a get_pid field to struct unw_accessors 2018-05-31 15:42:52 +02:00
a02324d9af eh_elf: implement mmap_get_entry 2018-05-31 13:02:35 +02:00
8b7b8659ec eh_elf: parse and store memory map 2018-05-31 12:30:07 +02:00
Dave Watson
a77b0cd7bd Bump version to v1.2.1 2017-06-15 14:32:10 -07:00
Dave Watson
5f354cb7b9 mips/tilegx: Add missing unwind_i.h header file
reported-by: John Knight <John.Knight@belkin.com>
2017-01-25 16:28:38 -08:00
Christopher Ferris
620d1c3b0b Add aarch64 getcontext functionality.
Change-Id: I32912a85c0fd02bb5e45a9eb7deb2410ded352a9
2017-01-25 16:28:29 -08:00
Dave Watson
cc247fc0a2 Bump version to 1.2 2017-01-13 08:02:53 -08:00
Ulrich Weigand
c56fb8f99e ppc64: Fix serious regression (many crashes in test suite)
A recent commit added code to override the unwind location for the
TOC pointer register r2:

    unsigned int *inst = (unw_word_t*)c->dwarf.ip;
    if (*inst == (0xE8410000 + 24)) {
      // @plt call, restoring R2 from CFA+24
      c->dwarf.loc[UNW_PPC64_R2] = DWARF_LOC(c->dwarf.cfa + 24, 0);
    }

It is correct that such code is needed, since DWARF CFI does not
describe the unwind location for r2 on PowerPC.  However, this
particular bit of code has a number of issues, which are fixed
in this patch.

First of all, the location CFA+24 is correct only for the ELFv2
ABI.  In the ELFv1 ABI, the TOC location is actually CFA+40.

More problematically, attempting to read the current instruction
by just dereferencing the address in c->dwarf.ip is wrong, and
may often lead to crashes.  In particular:

- During remote unwinding, this is always wrong since we're in
  the wrong address space.  I've used the fetch32 helper from
  remote.h to use the proper access_mem under the covers.

- c->dwarf.ip may be NULL if we've reached the end-of-stack.
  I've fixed this by moving the c->dwarf.ip == 0 check down
  to after unwinding (instead of before), just like all other
  platforms do.

- Even so, c->dwarf.ip may point to some random location if
  we've gotten confused during unwinding earlier.  One likely
  cause for such confusion is that we did not find DWARF CFI
  for some earlier frame and attempted to use the stack
  backchain.  The problem is that this code currently claims
  all registers remain unchanges in such a frame, which is
  generally wrong.  In particular if the function actually
  saves and modifies r31, and this is used as frame pointer
  by a later frame, things will likely go quite wrong.  While
  it is not really possibly to completely fix this, I've at
  least marked all registers as unavailable after unwinding
  a frame via stack backchain.

Tested on powerpc64-linux and powerpc64le-linux.  The patch fixes
about a dozen test cases that were crashing before.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2015-12-06 11:10:10 -08:00
Keno Fischer
8afc33ce9f Add an option to have start_ip_offset be relative to start_ip
By default, the start_ip_offset in libunwind's table_entry struct is
relative to the unw_dyn_info_t's segbase. This presents a problem
for us in conjunction with using LLVM's MCJIT because it likes to
spread text sections and the corresponding eh_frame sections quite
far apart. This represents my attempt to support this use case in the
simplest manner that is backwards compatible, by adding a new format
kind (UNW_INFO_FORMAT_REMOTE_TABLE2) that indicates that the
`start_ip_offset` should be interpreted as relative to `start_ip`
rather than segbase.
2015-09-15 12:18:30 -07:00
Alexander Esilevich
d1a8ca6d84 powerpc64 implementation 2015-09-07 18:08:26 -07:00
Arun Sharma
923fa78e79 Revert parts of 68a2910
The check breaks a few tests when used with gold.
2015-09-07 17:59:27 -07:00
Arun Sharma
396b6c7ab7 Invalid dwarf opcodes can cause references beyond the end of the array. 2015-06-19 19:47:22 -07:00
Milian Wolff
b2db825e8a Update README to use autogen.sh 2015-06-07 12:23:42 -07:00
Vyacheslav Barinov
7701522688 arm: Validate memory before access
Prevent SIGSEGV due to accessing addresses now mapped to current process

Signed-off-by: Vyacheslav Barinov <v.barinov@samsung.com>
2015-06-07 12:17:40 -07:00
Faraz Shahbazker
16bf4e5e49 Stack-unwinding through signal frames on mips
Detect if current frame is a signal frame by checking for preceeding
syscall instruction. For signal frames, update the cursor correctly
from user context before calling dwarf_step.
2015-04-02 11:20:33 -07:00
Andreas Schwab
544cdb3b43 tests/Gtest-trace.c: show differing addresses 2015-03-22 00:05:14 -07:00
Gregory Fong
0bed10aa21 Mark run-ptrace-mapper and run-ptrace-misc as XFAIL on ARM
This is similar to commit c90a2e02b3
"Mark run-ptrace-mapper and run-ptrace-misc as XFAIL on MIPS".
Starting with 2.6.39, ARM Linux returns -EIO for PTRACE_SINGLESTEP, so
we need to mark this as XFAIL for ARM too.

The Linux commit that changed this is

   commit 425fc47adb5bb69f76285be77a09a3341a30799e
   Author: Will Deacon <will.deacon@arm.com>
   Date:   Mon Feb 14 14:31:09 2011 +0100

       ARM: 6668/1: ptrace: remove single-step emulation code

see: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=425fc47adb5bb69f76285be77a09a3341a30799e

Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com>
2015-02-21 13:00:34 -08:00
Peter Wu
68a2910bae Check that the CIE is within the segment
Due to a bug in the gold linker[1], the .eh_frame and .eh_frame_hdr
sections contains garbage. When dwarf_extract_proc_info_from_fde tried
to look up the begin of the CIE subsection, it would underflow the
.eh_frame segment, resulting in a crash[2].

This patch avoids that crash by checking whether the CIE pointer is
located after the begin of the .eh_frame section. The variable "base"
was misused in various places as a boolean (decode as .debug_frame or
decode as .eh_frame). These instances have been renamed to
is_debug_frame where applicable.

Tested on Linux x86_64.

 [1]: https://sourceware.org/bugzilla/show_bug.cgi?id=17639
 [2]: http://lists.nongnu.org/archive/html/libunwind-devel/2014-11/msg00009.html

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-12-05 23:39:48 -08:00
Olivier Fourdan
6e3254ea6e [PATCH] Fix build from scratch
- Add autogen.sh to bootstrap autotools generation
- Make generation of man pages optional, and check for
  availibity of latex2man if documentation is requested.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Arun Sharma <asharma@fb.com>
2014-12-04 00:12:00 -08:00