[PATCH] D74507: [llvm-objdump] Print method name from debug info in disassembly output.

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 14 10:48:53 PST 2020


rupprecht marked an inline comment as not done.
rupprecht added inline comments.


================
Comment at: llvm/test/tools/llvm-objdump/X86/source-interleave-function-from-debug.test:4
+
+; RUN: llc < %s -o %t.o -filetype=obj -mtriple=x86_64-pc-linux
+; RUN: llvm-strip %t.o -N foo -N bar -o %t-stripped.o
----------------
dblaikie wrote:
> Clearly there's prior art here, but testing objdump with llc seems a bit heavyweight/circular (no doubt some llc tests use llvm-objdump to verify their result) - I'd expect this to use raw assembly + llvm-mc at most.
> 
> not a requirement for change, just a thought
> Clearly there's prior art here, but testing objdump with llc seems a bit heavyweight/circular (no doubt some llc tests use llvm-objdump to verify their result)
Not entirely circular: it's only the llc tests that depend on llvm-objdump and llvm-objdump tests that depend on llc. The tools themselves don't have a circular dep.

> I'd expect this to use raw assembly + llvm-mc at most.
The reason I went w/ IR is for the relatively straightforward debug annotations, e.g. run "clang++ -S -emit-llvm" on a toy cc file and manipulate it as needed. That doesn't seem to be feasible w/ raw assembly: the dwarf information gets encoded as raw bytes. I think this is a lot more readable, unless there's some other way to represent debug info in assembly?


================
Comment at: llvm/tools/llvm-objdump/llvm-objdump.cpp:652
+      LineInfo.FunctionName != OldLineInfo.FunctionName)
+    OS << Delimiter << LineInfo.FunctionName << "():\n";
+  if (LineInfo.FileName != DILineInfo::BadString && LineInfo.Line != 0)
----------------
dblaikie wrote:
> Is the intent to print the demangled name? The test doesn't verify demangling is happening (since it uses unmangled names to begin with) & it doesn't look like it is happening, given   SymbolizerOpts.Demangle = false; on line 569
For GNU compatibility, it should actually print the mangled string. I wouldn't mind if we changed it & also suggested this change for GNU binutils though, it seems like an oversight that GNU objdump -ldC does not demangle here.

Anyway, added a test case to capture current behavior.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74507/new/

https://reviews.llvm.org/D74507





More information about the llvm-commits mailing list