[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
diff --git a/lib/asan/asan_stack.cc b/lib/asan/asan_stack.cc
index 24d0081..8c6320b 100644
--- a/lib/asan/asan_stack.cc
+++ b/lib/asan/asan_stack.cc
@@ -133,21 +133,12 @@
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);
}
}