diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2014-10-26 03:35:14 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2014-10-26 03:35:14 +0000 |
commit | 4c25703803a2bf100987e0905314eebd2af1c5c7 (patch) | |
tree | 13f177d45ee7a7a05958a818c149f41615d257fd /lib/msan/msan.h | |
parent | 259b4571c582b9c6852b2d18b5583f25bc6582f6 (diff) |
[Sanitizer] Make StackTrace a lightweight reference to array of PCs, and
introduce a BufferedStackTrace class, which owns this array.
Summary:
This change splits __sanitizer::StackTrace class into a lightweight
__sanitizer::StackTrace, which doesn't own array of PCs, and BufferedStackTrace,
which owns it. This would allow us to simplify the interface of StackDepot,
and eventually merge __sanitizer::StackTrace with __tsan::StackTrace.
Test Plan: regression test suite.
Reviewers: kcc, dvyukov
Reviewed By: dvyukov
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D5985
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@220635 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/msan/msan.h')
-rw-r--r-- | lib/msan/msan.h | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/lib/msan/msan.h b/lib/msan/msan.h index ad66016b9..892cf047a 100644 --- a/lib/msan/msan.h +++ b/lib/msan/msan.h @@ -72,7 +72,7 @@ void MsanDie(); void PrintWarning(uptr pc, uptr bp); void PrintWarningWithOrigin(uptr pc, uptr bp, u32 origin); -void GetStackTrace(StackTrace *stack, uptr max_s, uptr pc, uptr bp, +void GetStackTrace(BufferedStackTrace *stack, uptr max_s, uptr pc, uptr bp, bool request_fast_unwind); void ReportUMR(StackTrace *stack, u32 origin); @@ -97,27 +97,24 @@ void CopyPoison(void *dst, const void *src, uptr size, StackTrace *stack); // the previous origin id. u32 ChainOrigin(u32 id, StackTrace *stack); -#define GET_MALLOC_STACK_TRACE \ - StackTrace stack; \ - stack.size = 0; \ - if (__msan_get_track_origins() && msan_inited) \ - GetStackTrace(&stack, common_flags()->malloc_context_size, \ - StackTrace::GetCurrentPc(), GET_CURRENT_FRAME(), \ - common_flags()->fast_unwind_on_malloc) - -#define GET_STORE_STACK_TRACE_PC_BP(pc, bp) \ - StackTrace stack; \ - stack.size = 0; \ - if (__msan_get_track_origins() > 1 && msan_inited) \ - GetStackTrace(&stack, flags()->store_context_size, pc, bp, \ +#define GET_MALLOC_STACK_TRACE \ + BufferedStackTrace stack; \ + if (__msan_get_track_origins() && msan_inited) \ + GetStackTrace(&stack, common_flags()->malloc_context_size, \ + StackTrace::GetCurrentPc(), GET_CURRENT_FRAME(), \ common_flags()->fast_unwind_on_malloc) -#define GET_FATAL_STACK_TRACE_PC_BP(pc, bp) \ - StackTrace stack; \ - stack.size = 0; \ - if (msan_inited) \ - GetStackTrace(&stack, kStackTraceMax, pc, bp, \ - common_flags()->fast_unwind_on_fatal) +#define GET_STORE_STACK_TRACE_PC_BP(pc, bp) \ + BufferedStackTrace stack; \ + if (__msan_get_track_origins() > 1 && msan_inited) \ + GetStackTrace(&stack, flags()->store_context_size, pc, bp, \ + common_flags()->fast_unwind_on_malloc) + +#define GET_FATAL_STACK_TRACE_PC_BP(pc, bp) \ + BufferedStackTrace stack; \ + if (msan_inited) \ + GetStackTrace(&stack, kStackTraceMax, pc, bp, \ + common_flags()->fast_unwind_on_fatal) #define GET_STORE_STACK_TRACE \ GET_STORE_STACK_TRACE_PC_BP(StackTrace::GetCurrentPc(), GET_CURRENT_FRAME()) |