1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-06-30 21:21:45 +02:00
Commit graph

206 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
Yichao Yu b9fe811de9 Use ucontext_t instead of struct ucontext (#49)
Ref https://github.com/libunwind/libunwind/pull/40.
I didn't caught it last time since I don't have a 32bits buildbot.
2017-10-31 08:41:31 -07:00
Konstantin Baladurin 38fe3bbb97 x86: Fix build (#45)
We should include <sys/syscall.h> for SYS_rt_sigreturn in x86/Gos-linux.c
2017-10-17 11:27:14 -07:00
Dave Watson 7f1aebadbf x86: Add sigreturn asm stub
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
2017-08-24 08:51:27 -07: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 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
Saleem Abdulrasool 11a053f5ca use target dependent names for stack registers
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.
2017-01-18 10:17:15 -08:00
Dave Watson 4b63a536ee dwarf: Correct handling of DW_CFA_GNU_args_size
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)
2017-01-13 08:28:21 -08:00
Chris Redmon cf2bc87561 Fixup invalid return code checks of unw_is_signal_frame()
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())".
2017-01-13 08:27:40 -08: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
Konstantin Belousov 3723511003 Adjust use_prev_instr for syscall and frame-chain frames.
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.
2014-08-15 13:01:36 -07:00
Konstantin Belousov 85946d9766 Use helper to walk past the syscall frames on FreeBSD/x86, similar to FreeBSD/x86_64.
The syscall trampolines in FreeBSD libc do not have unwind annotations.
2014-08-15 13:01:33 -07:00
dave lerner 8028a537dd unw_is_signal_frame should return false/0 for bad addresses
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>
2013-03-10 14:59:44 -07: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 ee8df26288 Constify `dwarf_to_unw_regnum_map' 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
Konstantin Belousov 59328832f7 Provide the FreeBSD implementation for _UI_siglongjmp_cont on x86.
On FreeBSD, _NSIG is at least 128, so just pass a pointer to the
signal mask in the register.
Add my copyright.
2012-02-05 11:47:47 +02:00
Konstantin Belousov 1774384098 FreeBSD also supports PT_GNU_STACK. 2012-02-05 11:42:02 +02: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
Arun Sharma 99e60be5a4 Fix the page boundary crossing bug.
Signed-off-by: Jason Evans <jasone@canonware.com>
2010-06-08 14:44:07 -07:00
Konstantin Belousov c84005e9c8 Add unwind annotations for freebsd/x86 getcontext.S.
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.
2010-05-02 17:06:24 +03:00
Konstantin Belousov b73c618a31 Merge branch 'master' into freebsd 2010-05-02 16:29:02 +03:00
Arun Sharma 215afa30b7 Add unwind descriptors to getcontext.S 2010-04-28 16:32:30 -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
Konstantin Belousov 2709abc883 msync() also may be called on unaligned address. 2010-04-21 15:33:37 +03:00
Konstantin Belousov 4454413242 Account for possible unaligned access. 2010-04-21 15:18:02 +03:00
Konstantin Belousov ee99dbec87 Use mincore instead of msync when available 2010-04-20 17:45:18 +03:00
Konstantin Belousov 75b76d1f45 Save FPU context for i386. 2010-04-17 00:18:33 +03:00
Arun Sharma 5a70fab451 Fix compiler warnings on x86 Linux 2010-04-14 18:54:20 -07:00
Konstantin Belousov 127acf8e97 Use correct offset name and value for ucontext offset in struct sigframe 2010-04-14 12:15:05 +03:00
Konstantin Belousov 0d311ea161 Add abort() after sigreturn calls 2010-04-14 12:10:34 +03:00
Konstantin Belousov 34b064bf22 Fix typo. 2010-04-14 12:10:14 +03:00
Konstantin Belousov 02d0cb6f71 Do not save FPU context on x86 for now; XMM save area must be 16-bytes aligned 2010-04-13 14:20:22 +03:00
Konstantin Belousov ae7eebb839 Separate getcontext implementation for x86 2010-04-13 14:11:39 +03:00
Konstantin Belousov 66e49bdd41 Save %eax for i386 2010-04-13 13:55:23 +03:00
Konstantin Belousov 5a7407dd94 Merge branch 'master' into freebsd 2010-04-12 22:34:24 +03:00
Giuseppe Scrivano eb8857a324 Silence a compiler warning 2010-04-12 10:45:31 -07:00
Konstantin Belousov 21f0e90ce8 Rework 69001646fa, store sigframe address into sigcontext_addr. 2010-04-11 22:01:08 +03:00
Konstantin Belousov f10f851916 Add slightly more debug output 2010-04-11 14:59:36 +03:00
Konstantin Belousov 69001646fa Store the ucontext_t pointer to properly handle resume across signal frames. 2010-04-11 13:48:14 +03:00
Konstantin Belousov dd1c7b6c1a Declare mxcsr as XMM 2010-04-10 18:48:35 +03:00
Konstantin Belousov 53f7e650e0 For FreeBSD/i386, add real offset values for FPU context fields. 2010-04-10 18:48:16 +03:00