1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[llvm-objdump] Demangle C++ Symbols in branch and call targets

Currently C++ symbols are demangled in the symbol table as well as in
the disassembly and relocations. This patch adds demangling of C++
symbols in targets of calls and branches making it easier to decipher
control flow in disassembly. This also matches up with GNUobjdump's
behavior

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D77957
This commit is contained in:
Markus Böck 2020-04-18 08:23:37 -07:00 committed by Fangrui Song
parent bbdc25ab11
commit ababa31040
2 changed files with 5 additions and 2 deletions

View File

@ -11,7 +11,7 @@
## Check the case when relocations are inlined into disassembly.
# RUN: llvm-objdump -d -r --demangle %t | FileCheck %s --check-prefix=INLINE
# INLINE: <foo()>:
# INLINE-NEXT: 0: {{.*}} callq 0x5 <_Z3foov+0x5>
# INLINE-NEXT: 0: {{.*}} callq 0x5 <foo()+0x5>
# INLINE-NEXT: 0000000000000001: R_X86_64_PLT32 foo()-0x4
.text

View File

@ -1556,7 +1556,10 @@ static void disassembleObject(const Target *TheTarget, const ObjectFile *Obj,
if (TargetSym != TargetSectionSymbols->begin()) {
--TargetSym;
uint64_t TargetAddress = TargetSym->Addr;
StringRef TargetName = TargetSym->Name;
std::string TargetName = TargetSym->Name.str();
if (Demangle)
TargetName = demangle(TargetName);
outs() << " <" << TargetName;
uint64_t Disp = Target - TargetAddress;
if (Disp)