diff options
author | Kostya Serebryany <kcc@google.com> | 2012-08-28 13:25:55 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2012-08-28 13:25:55 +0000 |
commit | 2b939c3abc8b7713ef28000bd768ca6d77445f45 (patch) | |
tree | 52290ded4e51a97e788ec2b2ecbddda1bdc0a685 /lib/asan/asan_linux.cc | |
parent | 8757a68c78f76fca32d3f2256fa70a7b550aa9e1 (diff) |
[asan] more refactoring to move StackTrace to sanitizer_common
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@162752 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_linux.cc')
-rw-r--r-- | lib/asan/asan_linux.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc index bbc7dad13..5c52ddc96 100644 --- a/lib/asan/asan_linux.cc +++ b/lib/asan/asan_linux.cc @@ -17,6 +17,7 @@ #include "asan_internal.h" #include "asan_lock.h" #include "asan_thread.h" +#include "asan_thread_registry.h" #include "sanitizer_common/sanitizer_libc.h" #include "sanitizer_common/sanitizer_procmaps.h" @@ -131,15 +132,17 @@ _Unwind_Reason_Code Unwind_Trace(struct _Unwind_Context *ctx, return UNWIND_CONTINUE; } -void StackTrace::GetStackTrace(uptr max_s, uptr pc, uptr bp) { - size = 0; - trace[0] = pc; +void GetStackTrace(StackTrace *stack, uptr max_s, uptr pc, uptr bp) { + stack->size = 0; + stack->trace[0] = pc; if ((max_s) > 1) { - max_size = max_s; + stack->max_size = max_s; #ifdef __arm__ - _Unwind_Backtrace(Unwind_Trace, this); + _Unwind_Backtrace(Unwind_Trace, stack); #else - FastUnwindStack(pc, bp); + if (!asan_inited) return; + if (AsanThread *t = asanThreadRegistry().GetCurrent()) + stack->FastUnwindStack(pc, bp, t->stack_top(), t->stack_bottom()); #endif } } |