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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 20 21:41:57 PST 2020


MaskRay 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
----------------
rupprecht wrote:
> 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?
I prefer an IR test for this case. The result is known to be stable and cannot affect people who work on CodeGen (`test/CodeGen`).

`"frame-pointer"="none"` can make the emitted instructions even simpler.



================
Comment at: llvm/test/tools/llvm-objdump/X86/source-interleave-function-from-debug.test:21
+; CHECK-NEXT:        a: c3                            retq
+; CHECK-NEXT:        b: 90                            nop
+; CHECK-NEXT:        c: 90                            nop
----------------
With `"frame-pointer"="none"`, there will be even more NOPs. Consider `CHECK-COUNT-10: nop` or just omit NOPs.


================
Comment at: llvm/tools/llvm-objdump/llvm-objdump.cpp:651
+    // only if demangling did not run or was unsuccessful.
+    if (!StringRef(LineInfo.FunctionName).endswith("()")) OS << "()";
+    OS << ":\n";
----------------
Please reformat.


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