-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[llvm-objdump] Add inlined function display support #142246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-llvm-binary-utilities Author: None (gulfemsavrun) ChangesThis patch adds the support for displaying inlined functions into llvm-objdump.
Patch is 62.68 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/142246.diff 10 Files Affected:
diff --git a/llvm/docs/CommandGuide/llvm-objdump.rst b/llvm/docs/CommandGuide/llvm-objdump.rst
index ab9f583e96ec6..65136d5ba22eb 100644
--- a/llvm/docs/CommandGuide/llvm-objdump.rst
+++ b/llvm/docs/CommandGuide/llvm-objdump.rst
@@ -153,10 +153,16 @@ OPTIONS
alongside disassembly. ``format`` may be ``unicode`` or ``ascii``, defaulting
to ``unicode`` if omitted.
-.. option:: --debug-vars-indent=<width>
+.. option:: --debug-indent=<width>
- Distance to indent the source-level variable display, relative to the start
- of the disassembly. Defaults to 52 characters.
+ Distance to indent the source-level variable or inlined function display,
+ relative to the start of the disassembly. Defaults to 52 characters.
+
+.. option:: --debug-inlined-funcs=<format>
+
+ Print the locations of inlined functions alongside disassembly.
+ ``format`` may be ``unicode``, ``ascii`` or ``line`` defaulting to
+ ``unicode`` if omitted.
.. option:: -j, --section=<section1[,section2,...]>
diff --git a/llvm/test/tools/llvm-objdump/ELF/ARM/debug-vars-dwarf4.s b/llvm/test/tools/llvm-objdump/ELF/ARM/debug-vars-dwarf4.s
index 69b7489e7e62e..085f258edfa57 100644
--- a/llvm/test/tools/llvm-objdump/ELF/ARM/debug-vars-dwarf4.s
+++ b/llvm/test/tools/llvm-objdump/ELF/ARM/debug-vars-dwarf4.s
@@ -15,10 +15,10 @@
## Check that passing the default value for --debug-vars-indent (52) makes no
## change to the output.
|
a6851c7
to
2781748
Compare
8bc4966
to
0c29a77
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This deserves a release note, I think, including highlighting the renamed indent option.
Also, I think it would be useful to have a test showing the interaction between the variable and inlined function options, so how a variable is displayed inside an inlined function when both are enabled.
On that note, does it even make sense for the two to have different values? E.g. one having unicode and the other ASCII? I wonder if we need to revisit how the option works. I'm not sure what would be the best approach, but perhaps there could be a "format" option and a separate option (or options) to determine what to enable. Alternatively, we just go with it and accept that ASCII + unicode is allowed.
DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, FileName)) | ||
return; | ||
|
||
assert(!FileName.empty()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this can never fire? What happens if the debug data genuinely has an empty name for a function, e.g. due to malformed/hand-written debug data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I removed the assert and added an early return for such a case.
FuncDie.getName(llvm::DINameKind::LinkageName); | ||
if (!MangledCallerName) | ||
return; | ||
std::string CallerName = llvm::demangle(MangledCallerName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the call to demangle
needs to be conditional on the --demangle
option. Same below. This should also be tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added Demangle
check.
0c29a77
to
91c4418
Compare
Thanks for all the feedback @jh7370!
I added this into the release notes.
I extended the test case to show how it looks like when
I think we can add a new option like Note: I'll be OOO for a few weeks, so my responses might be delayed. |
91c4418
to
c2d8564
Compare
This patch adds the support for displaying inlined functions into llvm-objdump. 1) It extends the source variable display support for inlined functions both for ascii and unicode formats. 2) It also introduces a new format called line that only prints a line for the start and end of an inlined function without line-drawing characters.
c2d8564
to
8ea0679
Compare
This patch adds the support for displaying inlined functions into llvm-objdump.
It extends the source variable display
support for inlined functions both for ascii and unicode formats.
It also introduces a new format called line that only prints a line for the start and end of an inlined function without line-drawing characters.