forked from OSchip/llvm-project
[asan] Add fast_unwind_on_check flag.
Allows to specify the unwinder to use for CHECK failures. Previous behaviour was to use the "fatal" unwinder. As compiler-rt is built without frame pointers, only the slow unwinder really makes sense here, and it is the default. llvm-svn: 219677
This commit is contained in:
parent
54ca964ef2
commit
f518a4e774
|
@ -67,7 +67,7 @@ static void AsanCheckFailed(const char *file, int line, const char *cond,
|
|||
Report("AddressSanitizer CHECK failed: %s:%d \"%s\" (0x%zx, 0x%zx)\n", file,
|
||||
line, cond, (uptr)v1, (uptr)v2);
|
||||
// FIXME: check for infinite recursion without a thread-local counter here.
|
||||
PRINT_CURRENT_STACK();
|
||||
PRINT_CURRENT_STACK_CHECK();
|
||||
Die();
|
||||
}
|
||||
|
||||
|
|
|
@ -81,6 +81,9 @@ void GetStackTraceWithPcBpAndContext(StackTrace *stack, uptr max_depth, uptr pc,
|
|||
#define GET_STACK_TRACE_FATAL_HERE \
|
||||
GET_STACK_TRACE(kStackTraceMax, common_flags()->fast_unwind_on_fatal)
|
||||
|
||||
#define GET_STACK_TRACE_CHECK_HERE \
|
||||
GET_STACK_TRACE(kStackTraceMax, common_flags()->fast_unwind_on_check)
|
||||
|
||||
#define GET_STACK_TRACE_THREAD \
|
||||
GET_STACK_TRACE(kStackTraceMax, true)
|
||||
|
||||
|
@ -96,4 +99,10 @@ void GetStackTraceWithPcBpAndContext(StackTrace *stack, uptr max_depth, uptr pc,
|
|||
stack.Print(); \
|
||||
}
|
||||
|
||||
#define PRINT_CURRENT_STACK_CHECK() \
|
||||
{ \
|
||||
GET_STACK_TRACE_CHECK_HERE; \
|
||||
stack.Print(); \
|
||||
}
|
||||
|
||||
#endif // ASAN_STACK_H
|
||||
|
|
|
@ -39,6 +39,7 @@ void SetCommonFlagsDefaults(CommonFlags *f) {
|
|||
f->external_symbolizer_path = 0;
|
||||
f->allow_addr2line = false;
|
||||
f->strip_path_prefix = "";
|
||||
f->fast_unwind_on_check = false;
|
||||
f->fast_unwind_on_fatal = false;
|
||||
f->fast_unwind_on_malloc = true;
|
||||
f->handle_ioctl = false;
|
||||
|
@ -81,6 +82,9 @@ void ParseCommonFlagsFromString(CommonFlags *f, const char *str) {
|
|||
"unavailable.");
|
||||
ParseFlag(str, &f->strip_path_prefix, "strip_path_prefix",
|
||||
"Strips this prefix from file paths in error reports.");
|
||||
ParseFlag(str, &f->fast_unwind_on_check, "fast_unwind_on_check",
|
||||
"If available, use the fast frame-pointer-based unwinder on "
|
||||
"internal CHECK failures.");
|
||||
ParseFlag(str, &f->fast_unwind_on_fatal, "fast_unwind_on_fatal",
|
||||
"If available, use the fast frame-pointer-based unwinder on fatal "
|
||||
"errors.");
|
||||
|
|
|
@ -32,6 +32,7 @@ struct CommonFlags {
|
|||
const char *external_symbolizer_path;
|
||||
bool allow_addr2line;
|
||||
const char *strip_path_prefix;
|
||||
bool fast_unwind_on_check;
|
||||
bool fast_unwind_on_fatal;
|
||||
bool fast_unwind_on_malloc;
|
||||
bool handle_ioctl;
|
||||
|
|
Loading…
Reference in New Issue