llvm-symbolizer.rst 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. llvm-symbolizer - convert addresses into source code locations
  2. ==============================================================
  3. SYNOPSIS
  4. --------
  5. :program:`llvm-symbolizer` [options]
  6. DESCRIPTION
  7. -----------
  8. :program:`llvm-symbolizer` reads object file names and addresses from standard
  9. input and prints corresponding source code locations to standard output.
  10. If object file is specified in command line, :program:`llvm-symbolizer`
  11. processes only addresses from standard input, the rest is output verbatim.
  12. This program uses debug info sections and symbol table in the object files.
  13. EXAMPLE
  14. --------
  15. .. code-block:: console
  16. $ cat addr.txt
  17. a.out 0x4004f4
  18. /tmp/b.out 0x400528
  19. /tmp/c.so 0x710
  20. /tmp/mach_universal_binary:i386 0x1f84
  21. /tmp/mach_universal_binary:x86_64 0x100000f24
  22. $ llvm-symbolizer < addr.txt
  23. main
  24. /tmp/a.cc:4
  25. f(int, int)
  26. /tmp/b.cc:11
  27. h_inlined_into_g
  28. /tmp/header.h:2
  29. g_inlined_into_f
  30. /tmp/header.h:7
  31. f_inlined_into_main
  32. /tmp/source.cc:3
  33. main
  34. /tmp/source.cc:8
  35. _main
  36. /tmp/source_i386.cc:8
  37. _main
  38. /tmp/source_x86_64.cc:8
  39. $ cat addr2.txt
  40. 0x4004f4
  41. 0x401000
  42. $ llvm-symbolizer -obj=a.out < addr2.txt
  43. main
  44. /tmp/a.cc:4
  45. foo(int)
  46. /tmp/a.cc:12
  47. $cat addr.txt
  48. 0x40054d
  49. $llvm-symbolizer -inlining -print-address -pretty-print -obj=addr.exe < addr.txt
  50. 0x40054d: inc at /tmp/x.c:3:3
  51. (inlined by) main at /tmp/x.c:9:0
  52. $llvm-symbolizer -inlining -pretty-print -obj=addr.exe < addr.txt
  53. inc at /tmp/x.c:3:3
  54. (inlined by) main at /tmp/x.c:9:0
  55. OPTIONS
  56. -------
  57. .. option:: -obj
  58. Path to object file to be symbolized.
  59. .. option:: -functions=[none|short|linkage]
  60. Specify the way function names are printed (omit function name,
  61. print short function name, or print full linkage name, respectively).
  62. Defaults to ``linkage``.
  63. .. option:: -use-symbol-table
  64. Prefer function names stored in symbol table to function names
  65. in debug info sections. Defaults to true.
  66. .. option:: -demangle
  67. Print demangled function names. Defaults to true.
  68. .. option:: -inlining
  69. If a source code location is in an inlined function, prints all the
  70. inlnied frames. Defaults to true.
  71. .. option:: -default-arch
  72. If a binary contains object files for multiple architectures (e.g. it is a
  73. Mach-O universal binary), symbolize the object file for a given architecture.
  74. You can also specify architecture by writing ``binary_name:arch_name`` in the
  75. input (see example above). If architecture is not specified in either way,
  76. address will not be symbolized. Defaults to empty string.
  77. .. option:: -dsym-hint=<path/to/file.dSYM>
  78. (Darwin-only flag). If the debug info for a binary isn't present in the default
  79. location, look for the debug info at the .dSYM path provided via the
  80. ``-dsym-hint`` flag. This flag can be used multiple times.
  81. .. option:: -print-address
  82. Print address before the source code location. Defaults to false.
  83. .. option:: -pretty-print
  84. Print human readable output. If ``-inlining`` is specified, enclosing scope is
  85. prefixed by (inlined by). Refer to listed examples.
  86. EXIT STATUS
  87. -----------
  88. :program:`llvm-symbolizer` returns 0. Other exit codes imply internal program error.