Patchwork eh_personality.cc: unwinding on ARM

login
register
mail settings
Submitter EXTERNAL Waechtler Peter (Fa. TCP, CM-AI/PJ-CF31)
Date March 16, 2012, 1:22 p.m.
Message ID <274124B9C6907D4B8CE985903EAA19E91B2D361D38@SI-MBX06.de.bosch.com>
Download mbox | patch
Permalink /patch/147203/
State New
Headers show

Comments

Hi,

I noticed a bug in the __ARM_EABI_UNWINDER__ case that shows up
as a loop in backtrace():

Patch

======= Backtrace: =========
/lib/libc.so.6[0x4c8c11cc]
/lib/libc.so.6[0x4c8c62a8]
/lib/libc.so.6(cfree+0x38)[0x4c8c63a8]
./bt(_Z6nqueenPiii+0xf0)[0xa8e0]
./bt(_Z6nqueenPiii+0xf0)[0xa8e0]
./bt(_Z6nqueenPiii+0xf0)[0xa8e0]
./bt(_Z6nqueenPiii+0xf0)[0xa8e0]
[.. and so on]

while a proper callstack (with demangled names and libunwind) looks like:

====== backtrace (libunwind):
./bt( libunwind_backtrace +0x30)[0xb4a4]
./bt( eh_stack_unwind +0xe0)[0xb3c0]
./bt[0xc704]
/lib/libc.so.6( __default_rt_sa_restorer_v2 +0x0)[0x4c883770]
/lib/libc.so.6( gsignal +0x40)[0x4c88241c]
/lib/libc.so.6( abort +0x1c0)[0x4c88680c]
/lib/libc.so.6[0x4c8b726c]
/lib/libc.so.6[0x4c8c11cc]
/lib/libc.so.6[0x4c8c62a8]
/lib/libc.so.6( cfree +0x38)[0x4c8c63a8]
./bt( nqueen(int*, int, int) +0xf0)[0xa8e0]
./bt( main +0x230)[0xac6c]
/lib/libc.so.6( __libc_start_main +0x120)[0x4c86d104]
./bt[0xa510]


The CodeSourcery toolchain contains a "fix" like the following,
please consider for adding it.

Best regards

        Peter W├Ąchtler


--- eh_personality.cc.orig      2012-02-28 16:35:20.000000000 +0100
+++ eh_personality.cc   2012-02-28 18:12:03.000000000 +0100
@@ -387,6 +386,9 @@ 
   switch (state & _US_ACTION_MASK)
     {
     case _US_VIRTUAL_UNWIND_FRAME:
+     if (state & _US_FORCE_UNWIND)
+       CONTINUE_UNWINDING;
+
       actions = _UA_SEARCH_PHASE;
       break;