summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/asan_debugging.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2014-10-26 03:35:14 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2014-10-26 03:35:14 +0000
commit9c859270123679f6d4f708dbabf57dc052cbbf59 (patch)
tree97654b810e077a643a19c636ed7fb1ba3de459f3 /compiler-rt/lib/asan/asan_debugging.cc
parent106c8e0898688fbdff96b017828da9762f1d6b20 (diff)
downloadbcm5719-llvm-9c859270123679f6d4f708dbabf57dc052cbbf59.tar.gz
bcm5719-llvm-9c859270123679f6d4f708dbabf57dc052cbbf59.zip
[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 llvm-svn: 220635
Diffstat (limited to 'compiler-rt/lib/asan/asan_debugging.cc')
-rw-r--r--compiler-rt/lib/asan/asan_debugging.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler-rt/lib/asan/asan_debugging.cc b/compiler-rt/lib/asan/asan_debugging.cc
index ca5fa1f759f..2b66dd5265f 100644
--- a/compiler-rt/lib/asan/asan_debugging.cc
+++ b/compiler-rt/lib/asan/asan_debugging.cc
@@ -86,22 +86,19 @@ uptr AsanGetStack(uptr addr, uptr *trace, uptr size, u32 *thread_id,
AsanChunkView chunk = FindHeapChunkByAddress(addr);
if (!chunk.IsValid()) return 0;
- StackTrace stack;
+ StackTrace stack(nullptr, 0);
if (alloc_stack) {
if (chunk.AllocTid() == kInvalidTid) return 0;
- chunk.GetAllocStack(&stack);
+ stack = chunk.GetAllocStack();
if (thread_id) *thread_id = chunk.AllocTid();
} else {
if (chunk.FreeTid() == kInvalidTid) return 0;
- chunk.GetFreeStack(&stack);
+ stack = chunk.GetFreeStack();
if (thread_id) *thread_id = chunk.FreeTid();
}
if (trace && size) {
- if (size > kStackTraceMax)
- size = kStackTraceMax;
- if (size > stack.size)
- size = stack.size;
+ size = Min(size, Min(stack.size, kStackTraceMax));
for (uptr i = 0; i < size; i++)
trace[i] = StackTrace::GetPreviousInstructionPc(stack.trace[i]);
OpenPOWER on IntegriCloud