[LLVMdev] Verifying unwind info/debugging a crash in _Unwind_Backtrace() on OSX

Alexander Potapenko glider at google.com
Thu Aug 28 07:12:15 PDT 2014


Turns out OSX uses a different format of unwind info, the so-called
compact unwind encoding.
Some of its contents can be obtained from a thin (non-universal)
binary by `llvm-objdump -unwind-info`
Right now I'm trying to make Clang use the _Unwind_Backtrace
implementation from libc++abi instead of the system one so that it's
possible to debug it.

On Wed, Aug 27, 2014 at 6:48 PM, Yury Gribov <y.gribov at samsung.com> wrote:
>> Is there a way to check whether the unwind info is correct? Could this
>> be a bug in the system implementation of _Unwind_Backtrace, which
>> probably should not crash in the middle of a valid stack trace?
>
> I'm not experienced with OSX but AFAIK unwinders generally trust unwind
> bytecode so if the latter is broken and causes SP miscalculation, unwinder
> will happily read invalid memory and segfault.
>
> You may want to examine unwind tables for Asan runtime (via readelf -u) and
> compare those to e.g. assembler code of __asan_report_error.
>
> -Y



-- 
Alexander Potapenko
Software Engineer
Google Moscow



More information about the llvm-dev mailing list