[llvm-dev] Resolve line numbers with LLVM symbolizer

Nathan Schagen via llvm-dev llvm-dev at lists.llvm.org
Mon May 9 06:34:07 PDT 2016


Hi LLVM people,

I would like the llvm-symbolizer to resolve both function names and
line/column numbers for me. The latter does not seem to work.

 I'm using the Memory Sanitizer example with LLVM 3.3. This is what I did:

➜  msan_test cat test.c
#include <stdio.h>

int main(int argc, char** argv) {
  int a[10];
  a[5] = 0;
  if (a[argc])
    printf("xx\n");
  return 0;
}
➜  msan_test clang -fsanitize=memory -fno-omit-frame-pointer -g -O2 -o test
test.c
➜  msan_test ./test
==9547== WARNING: Use of uninitialized value
    #0 0x55ea59c9c476 (/home/nathan/test/c/msan_test/test+0x25476)
    #1 0x7fbdfc187a3f (/lib/x86_64-linux-gnu/libc.so.6+0x20a3f)
    #2 0x55ea59c9c2a8 (/home/nathan/test/c/msan_test/test+0x252a8)
Exiting

Copied file/offset pairs into report.txt. I am aware of
MSAN_SYMBOLIZER_PATH.

➜  msan_test cat report.txt
/home/nathan/test/c/msan_test/test 0x25476
/lib/x86_64-linux-gnu/libc.so.6 0x20a3f
/home/nathan/test/c/msan_test/test 0x252a8
➜  msan_test llvm-symbolizer < report.txt
main
??:0:0

??
??:0:0

_start
??:0:0

➜  msan_test

It's unclear to me why no line numbers show up. This is what readelf has to
say:

➜  msan_test readelf -WS test | egrep '\.(stab|debug)'
  [28] .debug_info       PROGBITS        0000000000000000 02ec10 040d9e 00
     0   0  1
  [29] .debug_abbrev     PROGBITS        0000000000000000 06f9ae 006943 00
     0   0  1
  [30] .debug_loc        PROGBITS        0000000000000000 0762f1 0637d3 00
     0   0  1
  [31] .debug_aranges    PROGBITS        0000000000000000 0d9ac4 000570 00
     0   0  1
  [32] .debug_ranges     PROGBITS        0000000000000000 0da034 014fe0 00
     0   0  1
  [33] .debug_line       PROGBITS        0000000000000000 0ef014 0091de 00
     0   0  1
  [34] .debug_str        PROGBITS        0000000000000000 0f81f2 010e90 01
 MS  0   0  1
  [36] .debug_macinfo    PROGBITS        0000000000000000 1090cd 000000 00
     0   0  1
  [37] .debug_pubtypes   PROGBITS        0000000000000000 1090cd 000000 00
     0   0  1

Can someone point me in the right direction?

Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160509/620d0a31/attachment.html>


More information about the llvm-dev mailing list