diff options
author | Alexey Samsonov <samsonov@google.com> | 2012-07-03 08:24:14 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2012-07-03 08:24:14 +0000 |
commit | 961276af2603ada8f9da4e93adc8490230fbbc51 (patch) | |
tree | 68c4de273d016ef87597152053f2f519567b2c9f /compiler-rt/lib/asan/asan_stack.cc | |
parent | 822b254507f892290bad851b5c3303972b822f3c (diff) | |
download | bcm5719-llvm-961276af2603ada8f9da4e93adc8490230fbbc51.tar.gz bcm5719-llvm-961276af2603ada8f9da4e93adc8490230fbbc51.zip |
[Sanitizer] Extend a symbolizer code. Implemented for Linux only. Use dl_iterate_phdr to get virtual addresses of mapped module sections. To symbolize an address from a module, map this module to memory and obtain pointers to debug info sections. Later these pointers can be passed to constructor of DWARF context-in-memory from LLVM DebugInfo lib.
llvm-svn: 159652
Diffstat (limited to 'compiler-rt/lib/asan/asan_stack.cc')
-rw-r--r-- | compiler-rt/lib/asan/asan_stack.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler-rt/lib/asan/asan_stack.cc b/compiler-rt/lib/asan/asan_stack.cc index 1c60565e85a..38677d9ba9d 100644 --- a/compiler-rt/lib/asan/asan_stack.cc +++ b/compiler-rt/lib/asan/asan_stack.cc @@ -46,14 +46,20 @@ void AsanStackTrace::PrintStack(uptr *addr, uptr size) { AddressInfo addr_frames[64]; uptr addr_frames_num = 0; if (FLAG_symbolize) { - addr_frames_num = SymbolizeCode(pc, addr_frames, + bool last_frame = (i == size - 1) || !addr[i + 1]; + addr_frames_num = SymbolizeCode(pc - !last_frame, addr_frames, ASAN_ARRAY_SIZE(addr_frames)); } if (addr_frames_num > 0) { for (uptr j = 0; j < addr_frames_num; j++) { AddressInfo &info = addr_frames[j]; AsanPrintf(" #%zu 0x%zx", frame_num, pc); - if (info.module) { + if (info.function) { + AsanPrintf(" %s", info.function); + } + if (info.file) { + AsanPrintf(" %s:%d:%d", info.file, info.line, info.column); + } else if (info.module) { AsanPrintf(" (%s+0x%zx)", info.module, info.module_offset); } AsanPrintf("\n"); |