1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-09-29 18:09:29 +02:00
Commit graph

26 commits

Author SHA1 Message Date
Dave Watson
4c07b17037 ALIAS unwind_get_accessors 2017-12-28 09:42:16 -08:00
Dave Watson
e287b69068 Remove unw_handle_signal_frame from public API. 2017-12-28 09:07:08 -08:00
Dave Watson
a1437a3d27 Remove PROTECTED visibility
This only works on bfd ld, not lld or gold.
2017-12-28 08:26:42 -08:00
Dave Watson
bd3fb89e11 Change unw_init_local_signal to unw_init_local2(..., UNW_INIT_SIGNAL_FRAME)
Add unw_init_local2 with a flag for better extensibility in the future
2017-08-16 13:11:24 -07:00
Bert Wesarg
57257060c9 Bring back support for UNW_CACHE_PER_THREAD.
Needs to be build with --enable-per-thread-cache. Default caching policy
is also UNW_CACHE_PER_THREAD than.
2017-08-15 10:34:28 -07:00
Doug Moore
e360c3ddbd For architectures that initialize the dwarf ip cache, but do not
update when the ip register is set, add those updates.
2017-08-07 09:05:17 -07:00
Doug Moore
c66661f73c Drop reference to dwarf.ret_addr_column. 2017-05-19 19:19:12 -05:00
Doug Moore
502ba27753 Add a function to capture the dwarf_reg_states that occur in processing
the dwarf code for a procedure, and a function to apply a captured
dwarf_reg_state later.
2017-05-12 22:24:00 -05:00
Doug Moore
14c48b3d51 unw_init_local_signal
init_local, but *not* setting use_prev_instr.
This is necessary to correctly unwind using ucontext argument to signal handlers.
2017-04-03 14:44:40 -07:00
Королев Сергей
00cca00716 mips/Gstep.c: unw_handle_signal_frame: remove unused 'sp' variable
This fixes GCC 4.9.3 warnings (Linux/mipsel):

mips/Gstep.c: In function '_Umips_handle_signal_frame':
mips/Gstep.c:33:23: warning: unused variable 'sp' [-Wunused-variable]
   unw_word_t sc_addr, sp, sp_addr = c->dwarf.cfa;
                       ^
2017-02-14 08:22:00 -08:00
Королев Сергей
fd44f596b2 tdep_uc_addr: use +4 offset for UNW_MIPS_PC on MIPS (be)
According to mcontext_t definition its "pc" field
is also 64 bit wide and thus requires 4 byte offset
on MIPS32 (be).
2017-01-13 08:27:40 -08: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
Arun Sharma
781d5d5263 One time whitespace fixup.
for f in $(find src include -name '*.[ch]'); do
  expand -t 8 $f > $tmp; mv $tmp $f;
done
2014-09-27 09:47:23 -07:00
Tommi Rantala
890e23eb9d Prefer NULL over zero 2012-09-28 14:51:21 +03:00
Tommi Rantala
aebba1f8a7 Apply `define_lock()'
We have a nice macro for defining pthread mutexes, use it.
2012-09-28 14:51:21 +03:00
Tommi Rantala
79c2c254a7 MIPS coredump support
Add MIPS support to the coredump library. Explicit support for the MIPS
program counter register is added so that we can start backtracing from
the program counter value we read from a core dump. The PC register
support was not strictly required for local backtracing, and we will in
fact just plug the return address to the PC register in getcontext().

I have only tested the 32bit "OABI" paths.
2012-09-28 14:50:03 +03:00
Tommi Rantala
ded94b98ff Stop including `memory.h'
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.
2012-09-28 14:50:03 +03:00
Tommi Rantala
5d0f376b08 Invert tdep_init() flag logic
Invert the flag that signals that tdep_init() was called, to move the
symbol from data to BSS.
2012-09-28 14:06:07 +03:00
Tommi Rantala
5fef17c05d Fix memory leaks in unw_create_addr_space() wrong-endian error paths
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 cf6a998796 ("Fix memory leak
in ARM unw_create_addr_space()"). Move the endianness check also on ARM
to avoid malloc() & free() in the error case.
2012-08-21 22:33:29 +03:00
Tommi Rantala
7b81113721 MIPS: implement dwarf_to_unw_regnum() macro without table 2012-08-21 22:30:46 +03:00
Tommi Rantala
80fc285599 MIPS: fix symbol naming for mips_lock', mips_local_resume', and `mips_local_addr_space_init'
Properly export the symbol names also on MIPS. `make check' was
complaining:

src/.libs/libunwind.a(Linit.o): In function `mips_local_addr_space_init':
src/mips/Ginit.c:183: multiple definition of `mips_local_addr_space_init'
../src/.libs/libunwind-mips.a(Ginit.o):src/mips/Ginit.c:183: first defined here

src/.libs/libunwind.a(Lglobal.o): In function `_ULmips_init':
src/mips/Gglobal.c:42: multiple definition of `mips_lock'
../src/.libs/libunwind-mips.a(Gglobal.o):src/mips/Gglobal.c:42: first defined here

collect2: ld returned 1 exit status
2012-08-21 22:30:46 +03:00
Arun
f89fb17695 Fix incorrect calls to memset.
Found when compiling libunwind with clang.

Signed-off-by: Paul Pluzhnikov <ppluzhnikov@google.com>
2011-10-02 22:43:28 -07:00
Lassi Tuura
9e98f15e9a Fast back-trace for x86_64 for only collecting the call stack.
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.
2011-03-24 22:33:17 -07:00
Lassi Tuura
a9dce3c06e During the stack unwinding process, the return address points to
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>
2010-04-24 19:16:09 -07:00
Paul Pluzhnikov
84d4150668 Allow caller to block signals.
Greetings,

We use libunwind just for stack traces (I suspect many others do as well).

The use pattern is:

GetStackTrace(void** result, int max_depth)
{
...
  unw_getcontext(&uc);
  unw_init_local(&cursor, &uc);

  while (n < max_depth) {
    if (unw_get_reg(&cursor, UNW_REG_IP, (unw_word_t *) &ip) < 0) {
      break;
    }
    result[n++] = ip;
    if (unw_step(&cursor) <= 0) {
      break;
    }
  }

Given this usage, it is quite convenient for us to block signals (or
prevent signal handlers from re-entering libunwind by other means) at the
"top level", which makes most of the sigprocmask calls performed by
libunwind itself unneccessary.

The second patch in this series adds a configure option which removes most
of the sigprocmask calls.

Attached patch is a preliminary for it -- consolidating all of the
"sigprocmask; mutex_lock;" sequences into lock_acquire and "mutex_unlock;
sigprocmask;" sequences into lock_release.

Thanks,
--
Paul Pluzhnikov

commit 402d15b123d54a7669db7cf17a76dd315094e472
Author: Paul Pluzhnikov <ppluzhnikov@google.com>
Date:   Mon Sep 21 10:18:28 2009 -0700

    Replace "sigprocmask + mutext_lock" with a single lock_acquire.
    Likewise, replace "mutext_unlock + sigprocmask" with lock_release.
2009-09-25 09:35:31 -07:00
Daniel Jacobowitz
3842dac733 Add initial ARM and MIPS support. To support this, also enable the
reading of .debug_frame sections (used in lieu of .eh_frame sections
when they're not available).
2008-02-04 17:16:37 -07:00