diff options
author | Timur Iskhodzhanov <timurrrr@google.com> | 2013-11-29 12:53:30 +0000 |
---|---|---|
committer | Timur Iskhodzhanov <timurrrr@google.com> | 2013-11-29 12:53:30 +0000 |
commit | a10c46f2ae5408326c844d19f26dbb1c1a601a6b (patch) | |
tree | 49367828d2b5c618f0ecc47f42e836b3cecc0a1f | |
parent | bbf2ff8193d0e0441840df3682ace25101124438 (diff) | |
download | bcm5719-llvm-a10c46f2ae5408326c844d19f26dbb1c1a601a6b.tar.gz bcm5719-llvm-a10c46f2ae5408326c844d19f26dbb1c1a601a6b.zip |
Fix current stack unwinding when using DRASan
llvm-svn: 195956
-rw-r--r-- | compiler-rt/lib/asan/asan_stack.h | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/compiler-rt/lib/asan/asan_stack.h b/compiler-rt/lib/asan/asan_stack.h index 7f5fd661eec..dedc5930219 100644 --- a/compiler-rt/lib/asan/asan_stack.h +++ b/compiler-rt/lib/asan/asan_stack.h @@ -34,17 +34,22 @@ void PrintStack(const uptr *trace, uptr size); StackTrace stack; \ 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); \ - stack.Unwind(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 |