summaryrefslogtreecommitdiff
path: root/lib/asan/asan_stack.cc
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2012-01-05 23:50:34 +0000
committerKostya Serebryany <kcc@google.com>2012-01-05 23:50:34 +0000
commitefb3fa36cf421c346e8e54054cdae4fd798edab7 (patch)
tree6bf9161146e2a69ac8aca42221e578576407f575 /lib/asan/asan_stack.cc
parentc549dd7b5fa5fb97270f57067797224cee0429f2 (diff)
[asan] use dl_iterate_phdr for pre-symbolization on linux instead of parsing /proc/self/maps
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@147628 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_stack.cc')
-rw-r--r--lib/asan/asan_stack.cc19
1 files changed, 5 insertions, 14 deletions
diff --git a/lib/asan/asan_stack.cc b/lib/asan/asan_stack.cc
index 24d008104..8c6320b24 100644
--- a/lib/asan/asan_stack.cc
+++ b/lib/asan/asan_stack.cc
@@ -133,21 +133,12 @@ void AsanStackTrace::PrintStack(uintptr_t *addr, size_t size) {
for (size_t i = 0; i < size && addr[i]; i++) {
proc_maps.Reset();
uintptr_t pc = addr[i];
- uint64_t start, end, offset;
+ uintptr_t offset;
char filename[4096];
- bool found = 0;
- int map_idx = 0;
- while (proc_maps.Next(&start, &end, &offset,
- filename, sizeof(filename))) {
- if (pc >= start && pc <= end) {
- found = true;
- uintptr_t relative_pc = (map_idx == 0) ? pc : (pc - start);
- Printf(" #%ld 0x%lx (%s+0x%lx)\n", i, pc, filename, relative_pc);
- break;
- }
- map_idx++;
- }
- if (!found) {
+ if (proc_maps.GetObjectNameAndOffset(pc, &offset,
+ filename, sizeof(filename))) {
+ Printf(" #%ld 0x%lx (%s+0x%lx)\n", i, pc, filename, offset);
+ } else {
Printf(" #%ld 0x%lx\n", i, pc);
}
}