Status: Accepted
Owner: [email protected]
Labels: Type-Defect Priority-Medium
New issue 375 by [email protected]: On OS X, stacktraces are broken
after a report is printed
https://code.google.com/p/address-sanitizer/issues/detail?id=375
When the stacktraces are captured and printed by ASan itself, they are
fine, but when the program has already printed the report (or is just
printing it), capturing a stacktrace via other means is broken. "Other
means" include OS X CrashReporter, debuggers or calling backtrace() within
the program. For example calling backtrace() from a
sanitizer_set_death_callback function prints a very truncated stacktrace:
0 crashlog-stacktraces.c.tmp 0x000000010fb1c397
death_function + 471
1 libclang_rt.asan_osx_dynamic.dylib 0x000000010fb72c1f
_ZN11__sanitizer3DieEv + 15
The same can happen even within lldb (I'm seeing this for 32-bit x86):
(lldb) bt
* thread #1: tid = 0x9ec2d, 0x0000209a
crashlog-stacktraces.c.tmp`death_function + 42 at
crashlog-stacktraces.c:10, queue = 'com.apple.main-thread', stop reason =
breakpoint 1.1
* frame #0: 0x0000209a crashlog-stacktraces.c.tmp`death_function + 42 at
crashlog-stacktraces.c:10
frame #1: 0x0005eaf6
libclang_rt.asan_osx_dynamic.dylib`__sanitizer::Die() + 22
frame #2: 0x00058136
libclang_rt.asan_osx_dynamic.dylib`__asan::ScopedInErrorReport::~ScopedInErrorReport()
+ 102
frame #3: 0x00057fcf
libclang_rt.asan_osx_dynamic.dylib`__asan::ScopedInErrorReport::~ScopedInErrorReport()
+ 15
frame #4: 0x00057acc
libclang_rt.asan_osx_dynamic.dylib`__asan_report_error + 4204
(lldb)
It's probably a combination of "noreturn" and -fomit-frame-pointer, that
confuses the unwinders too much. This can be "fixed" if we don't use the
-fomit-frame-pointer flag (now we use it for all sources in compiler-rt),
but I'm curious if there is a less dramatic solution. If I remember
correctly, -fomit-frame-pointer was important for performance reasons.
Maybe forcing the frame pointer to be used in all noreturn functions could
be enough?
Attaching a testcase that reproduces this (Darwin-specific).
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.