From d033ece0c985d3f89c261d030ff2ff1d9c58bbc6 Mon Sep 17 00:00:00 2001 From: Daniel Thornburgh Date: Tue, 23 Aug 2022 13:44:30 -0700 Subject: [PATCH] [llvm-objdump] Find debug information with Build ID/debuginfod. Uses the library introduced in https://reviews.llvm.org/D132504 to add build ID fetching to llvm-objdump. This allows viewing source when disassembling stripped objects. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D131224 --- llvm/docs/CommandGuide/llvm-objdump.rst | 13 ++++ llvm/docs/CommandGuide/llvm-symbolizer.rst | 6 ++ .../tools/llvm-objdump/Inputs/embedded-source | Bin 9528 -> 17144 bytes llvm/test/tools/llvm-objdump/debuginfod.test | 65 ++++++++++++++++++ llvm/tools/llvm-objdump/CMakeLists.txt | 2 + llvm/tools/llvm-objdump/ObjdumpOpts.td | 11 +++ llvm/tools/llvm-objdump/llvm-objdump.cpp | 57 ++++++++++++++- 7 files changed, 153 insertions(+), 1 deletion(-) mode change 100644 => 100755 llvm/test/tools/llvm-objdump/Inputs/embedded-source create mode 100644 llvm/test/tools/llvm-objdump/debuginfod.test diff --git a/llvm/docs/CommandGuide/llvm-objdump.rst b/llvm/docs/CommandGuide/llvm-objdump.rst index 9f3fba4bf0df..07aad86de4a2 100644 --- a/llvm/docs/CommandGuide/llvm-objdump.rst +++ b/llvm/docs/CommandGuide/llvm-objdump.rst @@ -129,6 +129,19 @@ OPTIONS Demangle symbol names in the output. +.. option:: --debug-file-directory + + Provide a path to a directory with a `.build-id` subdirectory to search for + debug information for stripped binaries. Multiple instances of this argument + are searched in the order given. + +.. option:: --debuginfod, --no-debuginfod + + Whether or not to try debuginfod lookups for debug binaries. Unless specified, + debuginfod is only enabled if libcurl was compiled in (``LLVM_ENABLE_CURL``) + and at least one server URL was provided by the environment variable + ``DEBUGINFOD_URLS``. + .. option:: --debug-vars= Print the locations (in registers or memory) of source-level variables diff --git a/llvm/docs/CommandGuide/llvm-symbolizer.rst b/llvm/docs/CommandGuide/llvm-symbolizer.rst index abb174c7579e..fa4f2a0da341 100644 --- a/llvm/docs/CommandGuide/llvm-symbolizer.rst +++ b/llvm/docs/CommandGuide/llvm-symbolizer.rst @@ -221,6 +221,12 @@ OPTIONS ``auto``, which detects whether standard output supports color. Specifying ``--color`` alone is equivalent to ``--color=always``. +.. option:: --debug-file-directory + + Provide a path to a directory with a `.build-id` subdirectory to search for + debug information for stripped binaries. Multiple instances of this argument + are searched in the order given. + .. option:: --debuginfod, --no-debuginfod Whether or not to try debuginfod lookups for debug binaries. Unless specified, diff --git a/llvm/test/tools/llvm-objdump/Inputs/embedded-source b/llvm/test/tools/llvm-objdump/Inputs/embedded-source old mode 100644 new mode 100755 index 8274a6619ed7e867c376451db1d2d5db42aa5f68..f4fa001cf731fa34578ea4ccf144d3b460366faa GIT binary patch literal 17144 zcmeHOYitzP6~43UwKqK0HpF6q6i*0N%)^V#!!iMfU1P&+YX}9CP$kY}c6V%Vv=4W8 zmY6(RklQp{>K1;q>7PpUPg1p&lJ-Yms#FLlAf>I6Mv73Yv@{|rjYvwGq@fM4J?G9j z%j{&GH2qPj(p+igJil|#oVhbQcW3SwhlaQN6h(0Ji#r8M(H2`1CBx4)5d$PD`ow(L zcZe0D5#$D`v+YrvfYom2e6=)4dOuLag^{U4Z?V;aDQAcjakI6v0o%e<&~YG6nn-3n z)89}BOj%#;Po*ARR3jWyCk|^9j@Y>Howc-u>Jlc(I1~}rNw`kJF@2W$W6Jf!n&8$) z^>kAeY}iz}7s8F(PdGOnB!8yZ2e!ShTdDu1zukmuP-Ph5rdw>aV9Nb{7I0XX|FrRG z-b4M(b{;NLJ(-dy)@IU)-VJLrsjf^qSDNaY>g(<5-4H3}BkN=em>2eeV`|5)eZqH0 zoIoApk-r%>EGydE7QCNs9aa{8WmDhsXWCvJn-}zblVczTeXyZF4+)f!$3D=62irm}DA&+_TxF{`2--Oj&L%H+y$=8M2Y8zC#{#bvW0;o~j&U%*5 zZMF4yuCO-T&O7uzRsy}~(9~@G9U{ z;FDB9o4y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