Cleanup dynamically allocated memory before exit in tests in a few
places where missing. While such cleanups right before exit do not
usually make much sense (as the operating system would cleanup anyway,
so manual cleanups only burn CPU cycles), we will want to catch any
potential problems in libunwind related to the cleanups. This also stops
valgrind complaining about unreleased memory.
Compiling the tests with -Wextra results to lots of warnings for unused
parameters. Annotate these cases with the `unused' attribute to avoid
the warnings.
At least on ARM unw_context_t and ucontext_t are not the same types, so
use unw_context_t.
See also commit 24112f6d9b ("Fix some test
failures on x86_64 on distros with small default stacks.")
Gtest-trace.c: In function 'do_backtrace':
Gtest-trace.c:66:3: warning: initialization from incompatible pointer type [enabled by default]
Gtest-trace.c:67:3: warning: passing argument 2 of '_Uarm_init_local' from incompatible pointer type [enabled by default]
../include/libunwind-common.h:239:1: note: expected 'struct unw_context_t *' but argument is of type 'struct ucontext_t *'
Gtest-bt.c: In function 'do_backtrace':
Gtest-bt.c:65:3: warning: initialization from incompatible pointer type [enabled by default]
Gtest-bt.c:66:3: warning: passing argument 2 of '_Uarm_init_local' from incompatible pointer type [enabled by default]
../include/libunwind-common.h:239:1: note: expected 'struct unw_context_t *' but argument is of type 'struct ucontext_t *'
Creating an alternate signal stack with a size of SIGSTKSZ (usually 8k) is
not enough on some targets because unw_cursor_t is bigger than that already.
Since the size of unw_cursor_t is part of the ABI the UNW_TDEP_CURSOR_LEN
can't be changed without breaking existent code. Therefore size of the
alternate signal stack has been increased to 1 MiB.
Signed-off-by: Ken Werner <ken.werner@linaro.org>
Currently, libunwind allocates several PATH_MAX entries on stack, while
trying to find a binary via /proc/.../maps.
However stack space may be at premium (especially when sigaltstack is used),
and PATH_MAX on Linux is 4096, while SIGSTKSZ is only 8192 on x86.
Attached patch eliminates multiple PATH_MAX stack allocations, and simplifies
code in maps_next, at the cost of being unable to do anything if we can't
mmap one page. It appears to me that under such low-memory conditions,
libunwind will fail shortly elsewhere anyway.
This patch also disables more of debug_frame-handling code when
CONFIG_DEBUG_FRAME is undefined.
Tested on Linux/x86_64 with and without CONFIG_DEBUG_FRAME, no regressions.
- Gtest-bt: like on x86/-64, the stack size passed to sigaltstack() is
too small for ARM thus causing segmentation fault due to stack
overflow.
- Gtest-dyn1: code size definition of dynamic function (template()) on
testcase is too big for ARM architecture so memcpy() reads invalid
memory causing random crashes (segmentation fault). A better
solution would be to compile the function in a separate binary,
mmap() it and memcpy() from it instead, so maximum size is known for
sure.
- check-name-space.in: fix some "bashisms", it causes the script to
fail to run on N8XX's busybox shell.
Signed-off-by: Anderson Lizardo <anderson.lizardo@indt.org.br>
Signed-off-by: Bruna Moreira <bruna.moreira@indt.org.br>
for SuSE LES 9) so use 128KB instead.
(do_backtrace): Also print backtrace obtained via backtrace().
(foo): Remove backtrace() call---now done in do_backtrace().
(Logical change 1.290)
(num_errors): Likewise.
(do_backtrace): Only print info if verbose is set.
(foo): Likewise.
(sighandler): Likewise.
(main): Likewise.
(bar): New function which is attempting to trigger a bug reported by
Anthony Brewer which is caused by GAS apparently generating bad
offsets for the psprel directive.
(f): New function.
2004/09/15 04:24:29-07:00 hp.com!davidm
Rename: tests/bt.c -> tests/Gtest-bt.c
(Logical change 1.270)