1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-05 01:09:27 +01:00
Commit graph

28 commits

Author SHA1 Message Date
Ken Werner
912db91b05 ARM: Exit unw_step in case DWARF based unwinding was successful
Prevents unw_step from trying to unwind the stack using the ARM specific
unwind tables in case the DWARF based unwinding was successful.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-08-29 17:58:52 +02:00
Ken Werner
112c927371 ARM: Ensure unw_step returns whatever find_proc_info() returns
This allows the test-proc-info test case to pass on ARM.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-08-17 14:32:32 +00:00
Ken Werner
93e64550ac ARM: Fix return value of arm_find_proc_info
Initialize the return value with -1 in order prevent arm_find_proc_info from
returning zero. This could happen in case the environemtn variable
UNW_ARM_UNWIND_METHOD doesn't allow exidx and/or dwarf unwinding.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-08-17 14:14:48 +00:00
Ken Werner
d83846f120 ARM: Initial support for remote unwinding using libunwind-ptrace
Change _UPTi_find_unwind_table to also look for the ARM specific unwind
information. Adjust the ARM unwind code to read memory using the accessor
routines.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-08-15 20:12:54 +02:00
Ken Werner
545023c207 Rework the lookup of the ARM specific unwind info
Implement routines for finding the proc_info and searching the unwind table
for the ARM backend.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-08-15 20:12:54 +02:00
Ken Werner
25f6b8295d Change address type from void* to unw_word_t.
Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-07-28 11:10:02 +00:00
Ken Werner
b28335b5a5 Fix inline assembly.
Remove the third colon if the clobber list is not present.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-06-30 12:36:44 +02:00
Ken Werner
36511d3d1f Add support for handling signal frames on ARM Linux.
This patch add support for resuming at a certain stack frame even if signal
frames are involved. For restoring the registers the trampoline (sigreturn)
is used. RT and non-RT signal frames are handled for both >=2.6.18 and
<2.6.18 kernels.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-05-03 20:18:40 +02:00
Ken Werner
9533ea1a6a Add support for RT signal frame detection on ARM.
This patch adds a few more patterns to the check that detects if the IP
points to a sigreturn sequence.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-05-03 20:18:33 +02:00
Ken Werner
1e10c2931d Add initial support for local unw_resume on ARM Linux.
Provides basic support for resuming execution at a certain stack frame.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-04-21 17:25:42 +02:00
Ken Werner
fd21d07fe4 Create a generic and local variant of the extbl parser.
In order to have the DWARF_* macros working properly a generic and a local
variant of the ex_tables.c have been created.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-04-05 20:59:10 -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
Ken Werner
0f9937485e ARM: Return the dwarf.cfa in case the user requests SP/R13.
Usually we don't have a valid location for the SP but we keep calculating
the value of the CFA. The ARM backend should return this value instead.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-03-24 20:44:33 -07:00
Ken Werner
f053677198 Remove the ARM_EXIDX_TABLE_MALLOC code path.
Using malloc is not an option since unw_init_local and unw_step are supposed
to be async signal safe. Therefore this code path can be removed.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-03-24 20:44:33 -07:00
Ken Werner
6296ff1fb2 Remove the appname string of the ARM extbl parser.
There is no need for libunwind to set/fake a name of the elf file from which
the program header came from.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-03-24 20:44:33 -07:00
Ken Werner
dcb8d0d90f Prefer to unwind using DWARF info on ARM.
DWARF expressions are more powerful than the ARM specific unwind tables.
Therefore DWARF should be the preferred unwind method.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-03-24 20:44:33 -07:00
Ken Werner
fb325c895e ARM extbl cleanup.
Move code that does not necessarily need to reside in the ex_tables.h header
file into ex_tables.c. Add comments and remove unused code.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-03-24 20:44:25 -07:00
Ken Werner
cf8d5e41af Have the ARM extbtl-parser operate on the DWARF model directly.
This eliminates the arm_stackframe and therefore the need to synchronize the
two models. It also clears the way for unwinding call stacks with mixed
DWARF- and extbl-frames.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-03-24 20:42:00 -07:00
Arun Sharma
0613d4c680 Fixup trailing whitespace
Signed-off-by: Arun Sharma <asharma@fb.com>
2011-03-22 08:40:49 -07:00
Zachary T Welch
6a67154674 Use ARM-specific unwinding tables in unw_step
Uses ex_tables routines to provide a new means of unwinding the stack.
Set UNW_ARM_UNWIND_METHOD=4 to use ARM-specific unwinding tables.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-03-22 08:14:58 -07:00
Zachary T Welch
ffc474b8c8 Add module for parsing ARM-specific unwind tables
Handles lookup, extracting unwind entries, and decoding the entry
using a callback mechanism.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-03-22 08:14:51 -07:00
Zachary T Welch
049e2ba1b9 Add ARM signal frame detection
Implements a check for call to sigreturn that the kernel will have
setup before jumping to the signal handler.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-03-22 08:14:45 -07:00
Zachary T Welch
cf6a998796 Fix memory leak in ARM unw_create_addr_space()
Frees newly created address space memory in the event of a failure
caused by an endian mismatch.

Signed-off-by: Zachary T Welch <zwelch@codesourcery.com>
2010-11-08 09:03:34 -08:00
Arun Sharma
00aed9631b Add an experimental and optional frame chain unwinding for ARM
The environment variable UNW_ARM_UNWIND_METHOD controls the unwind method.

1 - debug_frame unwinding
2 - frame chain unwinding,
3 - 1 & 2 (default))

Signed-off-by: Andris Zeila <andris.zeila@accenture.com>
2010-05-26 19:28:44 -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
Bruna Moreira
1eddefc371 [ARM] This patch add some missing bits on ARM platform.
* src/arm/unwind_i (arm_lock, arm_local_resume): Define.
 * src/ptrace/_UPT_find_proc_info.c: Handle ARM like X86 etc.
 * tests/flush-cache.S (flush_cache): Add (dummy) ARM-version.
	ARM does need executable stack, even on Linux...

Signed-off-by: Anderson Lizardo <anderson.lizardo@indt.org.br>
Signed-off-by: Bruna Moreira <bruna.moreira@indt.org.br>
2008-04-21 13:43:18 -06: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