Hi all,
We have done a quick evaluation of current libunwind status on ARM
using the internal testsuite. Libunwind from development git tree [1]
(last change 5 Feb 2008). The following tests have failed or received
SIGSEGV on ARM. Detailed descriptions about errors can be found below:
* Gtest-bt and Ltest-bt
Issue: The stack size passed to sigaltstack() is too small for ARM
thus causing segmentation fault due to stack overflow.
Feature affected: None (testcase bug)
* Gtest-exc and Ltest-exc
Issue: unw_resume() is not implemented
Feature affected: Resume execution at a different stack frame
(useful for e.g. exception handling)
* Gtest-resume-sig and Ltest-resume-sig
Issue: Currently it PASS but their results depend on unw_resume()
which is not implemented on ARM, so they should FAIL
Feature affected: Resume execution from a signal handler
* Gtest-dyn1 and Ltest-dyn1:
Issue: Size code definition of dynamic function (template()) on
testcase is too big for ARM architecture so memcpy() reads invalid
memory. After match the sizes, the test will still fail because
unw_is_signal_frame() is not implemented on ARM
Feature affected: Stack unwinding of dynamic (at run-time) generated code
* run-check-namespace:
Issue: Some "bashisms" in check-namespace.sh.in causes the script
to fail to run on N8XX's busybox shell. After fixing those, the test
still fails because the ARM version of libunwind have _Unwind_*
interfaces disabled
Feature affected: break exceptions completely for ARM [2]
* test-ptrace:
Issue: Some register maps are missing for ARM in
_UPT_reg_offset.c. After add them, we have the current implementation
is not able to retrieve the function name of the attached program,
probably because the offset of the dynamic linked list where these
informations are found is different from others archs. The function
get_list_addr() is returning -UNW_ENOINFO (just implemented for IA64)
Feature affected: Remote backtraces on ARM
* run-ptrace-mapper and run-ptrace-misc:
Issue: Needs test-ptrace working. Result invalid
Feature affected: Not tested
* test-setjmp
Issue: The test is in infinite loop. There are some issues there:
definition of JB_SP is incorrect for ARM on file
include/tdep-arm/jmpbuf.h. Implementation of longjmp() in libunwind
API is not recovering the SP register value
Feature affected: Internal support for non-local gotos
Please, see attached the following patches:
- libunwind_arm_fixes.patch: add some missing bits on ARM platform.
- libunwind_testsuite_fixes.patch: fix some testsuite issues on ARM
(Gtest-bt, Gtest-dyn1 and check-name-space.in).
Any comments/suggestions are welcome!
BR,
Bruna.
References:
[1] The official libunwind git repository. URL:
http://git.kernel.org/gitweb.cgi?p=libs/libunwind/libunwind.git;a=commit;h=3842dac7333e42aa44531eda34ba55200b99ccf8
[2] libunwind ARM port. URL:
http://thread.gmane.org/gmane.comp.lib.unwind.devel/270/focus=276
--
Bruna Moreira
Instituto Nokia de Tecnologia
Manaus - Brazil
This patch add some missing bits on ARM platform.
Signed-off-by: Anderson Lizardo <[EMAIL PROTECTED]>
Signed-off-by: Bruna Moreira <[EMAIL PROTECTED]>
diff --git a/src/arm/unwind_i.h b/src/arm/unwind_i.h
index f0949fa..315aeb2 100644
--- a/src/arm/unwind_i.h
+++ b/src/arm/unwind_i.h
@@ -32,6 +32,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "libunwind_i.h"
+#define arm_lock UNW_OBJ(lock)
+#define arm_local_resume UNW_OBJ(local_resume)
#define arm_local_addr_space_init UNW_OBJ(local_addr_space_init)
extern void arm_local_addr_space_init (void);
diff --git a/src/ptrace/_UPT_find_proc_info.c b/src/ptrace/_UPT_find_proc_info.c
index 9f4ed38..1fd76b0 100644
--- a/src/ptrace/_UPT_find_proc_info.c
+++ b/src/ptrace/_UPT_find_proc_info.c
@@ -145,7 +145,8 @@ _UPTi_find_unwind_table (struct UPT_info *ui, unw_addr_space_t as,
return &ui->di_cache;
}
-#elif UNW_TARGET_X86 || UNW_TARGET_X86_64 || UNW_TARGET_HPPA || UNW_TARGET_PPC64
+#elif UNW_TARGET_X86 || UNW_TARGET_X86_64 || UNW_TARGET_HPPA \
+|| UNW_TARGET_PPC64 || UNW_TARGET_ARM
#include "dwarf-eh.h"
#include "dwarf_i.h"
diff --git a/tests/flush-cache.S b/tests/flush-cache.S
index d996492..2a17165 100644
--- a/tests/flush-cache.S
+++ b/tests/flush-cache.S
@@ -66,11 +66,17 @@ flush_cache:
lwz 31, -4(11) ;
mr 1, 11 ;
blr
+#elif defined(__arm__)
+ .text
+ .globl flush_cache
+flush_cache:
+ bx lr
+
#else
# error Need flush_cache code for this architecture.
#endif
-#ifdef __linux__
+#if defined ( __linux__) && !defined (__arm__)
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif
This patch fix some testsuite issues on ARM:
- 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 <[EMAIL PROTECTED]>
Signed-off-by: Bruna Moreira <[EMAIL PROTECTED]>
diff --git a/tests/Gtest-bt.c b/tests/Gtest-bt.c
index 1256512..44db430 100644
--- a/tests/Gtest-bt.c
+++ b/tests/Gtest-bt.c
@@ -38,8 +38,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <unistd.h>
#include <libunwind.h>
-#if UNW_TARGET_X86 || UNW_TARGET_X86_64
-# define STACK_SIZE (128*1024) /* On x86/-64, SIGSTKSZ is too small */
+#if UNW_TARGET_X86 || UNW_TARGET_X86_64 || UNW_TARGET_ARM
+# define STACK_SIZE (128*1024) /* On x86/-64 and ARM, SIGSTKSZ is too small */
#else
# define STACK_SIZE SIGSTKSZ
#endif
diff --git a/tests/Gtest-dyn1.c b/tests/Gtest-dyn1.c
index 2faa1f7..c4c389c 100644
--- a/tests/Gtest-dyn1.c
+++ b/tests/Gtest-dyn1.c
@@ -34,7 +34,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <sys/mman.h>
+#if UNW_TARGET_ARM
+#define MAX_FUNC_SIZE 96 /* FIXME: arch/compiler dependent */
+#else
#define MAX_FUNC_SIZE 2048 /* max. size of cloned function */
+#endif
#define panic(args...) \
{ fprintf (stderr, args); exit (-1); }
diff --git a/tests/check-namespace.sh.in b/tests/check-namespace.sh.in
index 253f709..4acfc74 100644
--- a/tests/check-namespace.sh.in
+++ b/tests/check-namespace.sh.in
@@ -13,7 +13,7 @@ num_errors=0
LIBUNWIND=../src/.libs/libunwind.so
LIBUNWIND_GENERIC=../src/.libs/libunwind-${plat}.so
-function fetch_symtab {
+fetch_symtab () {
filename=$1
if [ ! -r $filename ]; then
@@ -38,12 +38,12 @@ function fetch_symtab {
IFS="$saved_IFS"
}
-function ignore {
+ignore () {
sym=$1
symtab=`echo "$symtab" | grep -v " ${sym}\$"`
}
-function match {
+match () {
sym=$1
if `echo "$symtab" | grep -q " ${sym}\$"`; then
symtab=`echo "$symtab" | grep -v " ${sym}\$"`
@@ -57,7 +57,7 @@ function match {
# Filter out miscellaneous symbols that get defined by the
# linker for each shared object.
#
-function filter_misc {
+filter_misc () {
ignore _DYNAMIC
ignore _GLOBAL_OFFSET_TABLE_
ignore __bss_start
@@ -71,7 +71,7 @@ function filter_misc {
ignore ICRT.INTERNAL # ICC 8.x defines this
}
-function check_local_unw_abi {
+check_local_unw_abi () {
match _UL${plat}_create_addr_space
match _UL${plat}_destroy_addr_space
match _UL${plat}_get_fpreg
@@ -129,7 +129,7 @@ function check_local_unw_abi {
esac
}
-function check_generic_unw_abi {
+check_generic_unw_abi () {
match _U${plat}_create_addr_space
match _U${plat}_destroy_addr_space
match _U${plat}_flush_cache
@@ -186,7 +186,7 @@ function check_generic_unw_abi {
esac
}
-function check_cxx_abi {
+check_cxx_abi () {
match _Unwind_Backtrace
match _Unwind_DeleteException
match _Unwind_FindEnclosingFunction
@@ -230,7 +230,7 @@ function check_cxx_abi {
esac
}
-function check_empty {
+check_empty () {
if [ -n "$symtab" ]; then
echo -e " ERROR: Extraneous symbols:\n$symtab"
num_errors=`expr $num_errors + 1`
@@ -252,7 +252,7 @@ check_empty
if [ $num_errors -gt 0 ]; then
echo "FAILURE: Detected $num_errors errors"
- exit -1
+ exit 1
fi
if $verbose; then
_______________________________________________
Libunwind-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/libunwind-devel