summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump
diff options
context:
space:
mode:
authorYuanfang Chen <yuanfang.chen@sony.com>2019-06-22 01:13:04 +0000
committerYuanfang Chen <yuanfang.chen@sony.com>2019-06-22 01:13:04 +0000
commit4a2a152490673f5e4513e63e4c1166daa463889a (patch)
treef1b6cd3b49924fbcd9598307c3210c03079a21c6 /llvm/tools/llvm-objdump
parentc900c46d77f8526243b04511082ca564b1d18781 (diff)
downloadbcm5719-llvm-4a2a152490673f5e4513e63e4c1166daa463889a.tar.gz
bcm5719-llvm-4a2a152490673f5e4513e63e4c1166daa463889a.zip
[llvm-objdump] Allow --disassemble-functions to take demangled names
The --disassemble-functions switch takes demangled names when --demangle is specified, otherwise the switch takes mangled names. https://bugs.llvm.org/show_bug.cgi?id=41908 Reviewers: jhenderson, grimar, MaskRay, rupprecht Differential Revision: https://reviews.llvm.org/D63524 llvm-svn: 364121
Diffstat (limited to 'llvm/tools/llvm-objdump')
-rw-r--r--llvm/tools/llvm-objdump/llvm-objdump.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 23c25d59d5d..907e6ed696a 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -143,7 +143,9 @@ static cl::alias DisassembleAllShort("D",
static cl::list<std::string>
DisassembleFunctions("disassemble-functions", cl::CommaSeparated,
- cl::desc("List of functions to disassemble"),
+ cl::desc("List of functions to disassemble. "
+ "Accept demangled names when --demangle is "
+ "specified, otherwise accept mangled names"),
cl::cat(ObjdumpCat));
static cl::opt<bool> DisassembleZeroes(
@@ -1207,17 +1209,20 @@ static void disassembleObject(const Target *TheTarget, const ObjectFile *Obj,
std::vector<RelocationRef>::const_iterator RelEnd = Rels.end();
// Disassemble symbol by symbol.
for (unsigned SI = 0, SE = Symbols.size(); SI != SE; ++SI) {
+ std::string SymbolName = std::get<1>(Symbols[SI]).str();
+ if (Demangle)
+ SymbolName = demangle(SymbolName);
+
// Skip if --disassemble-functions is not empty and the symbol is not in
// the list.
- if (!DisasmFuncsSet.empty() &&
- !DisasmFuncsSet.count(std::get<1>(Symbols[SI])))
+ if (!DisasmFuncsSet.empty() && !DisasmFuncsSet.count(SymbolName))
continue;
uint64_t Start = std::get<0>(Symbols[SI]);
if (Start < SectionAddr || StopAddress <= Start)
continue;
else
- FoundDisasmFuncsSet.insert(std::get<1>(Symbols[SI]));
+ FoundDisasmFuncsSet.insert(SymbolName);
// The end is the section end, the beginning of the next symbol, or
// --stop-address.
@@ -1259,11 +1264,7 @@ static void disassembleObject(const Target *TheTarget, const ObjectFile *Obj,
outs() << format(Is64Bits ? "%016" PRIx64 " " : "%08" PRIx64 " ",
SectionAddr + Start + VMAAdjustment);
- StringRef SymbolName = std::get<1>(Symbols[SI]);
- if (Demangle)
- outs() << demangle(SymbolName) << ":\n";
- else
- outs() << SymbolName << ":\n";
+ outs() << SymbolName << ":\n";
// Don't print raw contents of a virtual section. A virtual section
// doesn't have any contents in the file.
OpenPOWER on IntegriCloud