diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2014-12-16 01:23:03 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2014-12-16 01:23:03 +0000 |
commit | 5f21f50ac45c09c9aebbb0ceaf207d38f2b85873 (patch) | |
tree | 7bba973ccd3f2420edc28f571687298c0b6cb38d /lib/asan/asan_stack.h | |
parent | 37215cf706ab74ad5f59cd53e0eff26aaab047cb (diff) | |
download | compiler-rt-5f21f50ac45c09c9aebbb0ceaf207d38f2b85873.tar.gz |
[ASan] Allow to atomically modify malloc_context_size at runtime.
Summary:
Introduce __asan::malloc_context_size atomic that is used to determine
required malloc/free stack trace size. It is initialized with
common_flags()->malloc_context_size flag, but can later be overwritten
at runtime (e.g. when ASan is activated / deactivated).
Test Plan: regression test suite
Reviewers: kcc, eugenis
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D6645
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224305 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_stack.h')
-rw-r--r-- | lib/asan/asan_stack.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/asan/asan_stack.h b/lib/asan/asan_stack.h index a99525621..122967a15 100644 --- a/lib/asan/asan_stack.h +++ b/lib/asan/asan_stack.h @@ -21,6 +21,11 @@ namespace __asan { +static const u32 kDefaultMallocContextSize = 30; + +void SetMallocContextSize(u32 size); +u32 GetMallocContextSize(); + // Get the stack trace with the given pc and bp. // The pc will be in the position 0 of the resulting stack trace. // The bp may refer to the current frame or to the caller's frame. @@ -93,9 +98,8 @@ void GetStackTraceWithPcBpAndContext(BufferedStackTrace *stack, uptr max_depth, #define GET_STACK_TRACE_THREAD \ GET_STACK_TRACE(kStackTraceMax, true) -#define GET_STACK_TRACE_MALLOC \ - GET_STACK_TRACE(common_flags()->malloc_context_size, \ - common_flags()->fast_unwind_on_malloc) +#define GET_STACK_TRACE_MALLOC \ + GET_STACK_TRACE(GetMallocContextSize(), common_flags()->fast_unwind_on_malloc) #define GET_STACK_TRACE_FREE GET_STACK_TRACE_MALLOC |