[LLVMbugs] [Bug 20779] New: The _Unwind_Backtrace code for arm based systems is non-functional.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 27 13:49:41 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20779

            Bug ID: 20779
           Summary: The _Unwind_Backtrace code for arm based systems is
                    non-functional.
           Product: libc++abi
           Version: unspecified
          Hardware: Other
                OS: other
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: cferris at google.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

Created attachment 12943
  --> http://llvm.org/bugs/attachment.cgi?id=12943&action=edit
Example of failing test.

src/Unwind/UnwindLevel1-gcc-ext.c implements the _Unwind_Backtrace function.
Arm has it's own unwind format that is special, and on this platform, the IP is
never modified. Calling this function results in an infinite loop calling the
trace function without ever terminating.

Attached is a simple example that will run infinitely.

I implemented a hack to allow this to work. Adding this to the end of
_Unwind_Backtrace

#if LIBCXXABI_ARM_EHABI
    // Get the information for this frame.
    unw_proc_info_t frameInfo;
    if (unw_get_proc_info(&cursor, &frameInfo) != UNW_ESUCCESS) {
      return _URC_END_OF_STACK;
    }

    uint32_t* unwindInfo = (uint32_t *) frameInfo.unwind_info;
    uint32_t format = ((*unwindInfo & 0x0f000000) >> 24);
    size_t len, startOffset;
    switch (format) {
      case 0:  // Short descriptor, 16-bit entries
        len = 4;
        startOffset = 1;
        break;
      case 1:  // Long descriptor, 16-bit entries
      case 3:  // Long descriptor, 32-bit entries
        len = 4 + 4 * ((*unwindInfo & 0x00ff0000) >> 16);
        startOffset = 2;
        break;
      default:
        startOffset = 0;
        break;
    }
    // Update the IP address.
    result = _Unwind_VRS_Interpret((struct _Unwind_Context *)(&cursor),
        unwindInfo, startOffset, len);
    if (result != _URC_CONTINUE_UNWIND) {
      return _URC_END_OF_STACK;
    }
#endif  // LIBCXXABI_ARM_EHABI

This is just a kludge to allow this code to work to mostly work. It also has a
problem since the backtrace will stop at the first catch it finds even with
this code.

This can be tested on an Android aosp tree if necessary.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140827/d6d73f0e/attachment.html>


More information about the llvm-bugs mailing list