aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-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 23c25d5..907e6ed 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.