diff options
Diffstat (limited to 'libsanitizer/asan/asan_stack.h')
-rw-r--r-- | libsanitizer/asan/asan_stack.h | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/libsanitizer/asan/asan_stack.h b/libsanitizer/asan/asan_stack.h index 3c0ac31f6c6..c929c887d06 100644 --- a/libsanitizer/asan/asan_stack.h +++ b/libsanitizer/asan/asan_stack.h @@ -20,6 +20,7 @@ namespace __asan { void PrintStack(StackTrace *stack); +void PrintStack(const uptr *trace, uptr size); } // namespace __asan @@ -29,19 +30,24 @@ void PrintStack(StackTrace *stack); #if SANITIZER_WINDOWS #define GET_STACK_TRACE_WITH_PC_AND_BP(max_s, pc, bp, fast) \ StackTrace stack; \ - GetStackTrace(&stack, max_s, pc, bp, 0, 0, fast) + stack.Unwind(max_s, pc, bp, 0, 0, fast) #else -#define GET_STACK_TRACE_WITH_PC_AND_BP(max_s, pc, bp, fast) \ - StackTrace stack; \ - { \ - AsanThread *t; \ - stack.size = 0; \ - if (asan_inited && (t = GetCurrentThread()) && !t->isUnwinding()) { \ - uptr stack_top = t->stack_top(); \ - uptr stack_bottom = t->stack_bottom(); \ - ScopedUnwinding unwind_scope(t); \ - GetStackTrace(&stack, max_s, pc, bp, stack_top, stack_bottom, fast); \ - } \ +#define GET_STACK_TRACE_WITH_PC_AND_BP(max_s, pc, bp, fast) \ + StackTrace stack; \ + { \ + AsanThread *t; \ + stack.size = 0; \ + if (asan_inited) { \ + if ((t = GetCurrentThread()) && !t->isUnwinding()) { \ + uptr stack_top = t->stack_top(); \ + uptr stack_bottom = t->stack_bottom(); \ + ScopedUnwinding unwind_scope(t); \ + stack.Unwind(max_s, pc, bp, stack_top, stack_bottom, fast); \ + } else if (t == 0 && !fast) { \ + /* If GetCurrentThread() has failed, try to do slow unwind anyways. */ \ + stack.Unwind(max_s, pc, bp, 0, 0, false); \ + } \ + } \ } #endif // SANITIZER_WINDOWS |