[PATCH] [libcxxabi] Make _Unwind_Backtrace() work on ARM.

Jonathan Roelofs jonathan at codesourcery.com
Tue Sep 9 12:29:00 PDT 2014


s/sdfasdf//

That's embarrasing.


Jon

On 9/9/14 1:19 PM, Jonathan Roelofs wrote:
> Added comments. See attached.
>
> On 9/9/14 11:35 AM, Jonathan Roelofs wrote:
>>
>>
>> On 9/9/14 3:22 AM, Renato Golin wrote:
>>> On 8 September 2014 18:36, Jonathan Roelofs <jonathan at codesourcery.com> wrote:
>>>> Anddd, here's the patch.
>>>
>>> Hi Jon,
>>>
>>> Would be good to not need to duplicate the personality declaration
>>> inside the function. Maybe include the eh header? Not sure...
>> That function isn't exposed in any of the headers, and this is sort of a
>> layering violation (Unwinder looking for libcxxabi symbols). I'm not sure which
>> header it would belong in if I were to add it. Suggestions?
>>>
>>> Also, would be good to add a big comment on why we do that check and
>>> what needs to be done to support other personality routines (ex.
>>> __aeabi_unwind_cpp_pr0).
>> The compact ones are already supported... so good point! :)
>>
>> Cheers,
>> Jon
>>>
>>> cheers,
>>> --renato
>>>
>>
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>

-- 
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded
-------------- next part --------------
Index: src/Unwind/Unwind-EHABI.cpp
===================================================================
--- src/Unwind/Unwind-EHABI.cpp	(revision 217387)
+++ src/Unwind/Unwind-EHABI.cpp	(working copy)
@@ -218,11 +218,25 @@
 decode_eht_entry(const uint32_t* data, size_t* off, size_t* len) {
   if ((*data & 0x80000000) == 0) {
     // 6.2: Generic Model
-    *off = 1; // First byte is size data.
-    *len = (((data[1] >> 24) & 0xff) + 1) * 4;
+    // EHT entry is a prel31 pointing to the PR, followed by data understood only
+    // by the personality routine. Since EHABI doesn't guarantee the location or
+    // availability of the unwind opcodes in the generic model, we have to check
+    // for them on a case-by-case basis:
+    _Unwind_Reason_Code __gxx_personality_v0(int version, _Unwind_Action actions,
+                                             uint64_t exceptionClass,
+                                             _Unwind_Exception* unwind_exception,
+                                             _Unwind_Context* context);
+    void *PR = (void*)signExtendPrel31(*data);
+    if (PR == &__gxx_personality_v0) {
+      *off = 1; // First byte is size data.
+      *len = (((data[1] >> 24) & 0xff) + 1) * 4;
+    } else
+      return nullptr;
     data++; // Skip the first word, which is the prel31 offset.
   } else {
     // 6.3: ARM Compact Model
+    // EHT entries here correspond to the __aeabi_unwind_cpp_pr[012] PRs indeded
+    // by format:
     Descriptor::Format format =
         static_cast<Descriptor::Format>((*data & 0x0f000000) >> 24);
     switch (format) {


More information about the cfe-commits mailing list