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>
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
* 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>