aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-objdump
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2012-11-12 21:40:38 +0000
committerEric Christopher <echristo@gmail.com>2012-11-12 21:40:38 +0000
commitd1726a4580f3dc42e2debbfea41acb9e815c06be (patch)
tree7b93c655e87f7362272c5dbbf0367ffd2a1b59b8 /tools/llvm-objdump
parentf4e3309e849dd0b89a39363c7f2fac337c6db81e (diff)
Rewrite DIContext interface to take an object. Update all callers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167757 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-objdump')
-rw-r--r--tools/llvm-objdump/MachODump.cpp45
1 files changed, 4 insertions, 41 deletions
diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp
index 1feea421f2..46e71ceb4d 100644
--- a/tools/llvm-objdump/MachODump.cpp
+++ b/tools/llvm-objdump/MachODump.cpp
@@ -309,16 +309,10 @@ void llvm::DisassembleInputMachO(StringRef Filename) {
raw_ostream &DebugOut = nulls();
#endif
- StringRef DebugAbbrevSection, DebugInfoSection, DebugArangesSection,
- DebugLineSection, DebugStrSection;
OwningPtr<DIContext> diContext;
- OwningPtr<MachOObjectFile> DSYMObj;
- MachOObject *DbgInfoObj = MachOObj;
+ ObjectFile *DbgObj = MachOOF.get();
// Try to find debug info and set up the DIContext for it.
if (UseDbg) {
- ArrayRef<SectionRef> DebugSections = Sections;
- std::vector<SectionRef> DSYMSections;
-
// A separate DSym file path was specified, parse it as a macho file,
// get the sections and supply it to the section name parsing machinery.
if (!DSYMFile.empty()) {
@@ -327,42 +321,11 @@ void llvm::DisassembleInputMachO(StringRef Filename) {
errs() << "llvm-objdump: " << Filename << ": " << ec.message() << '\n';
return;
}
- DSYMObj.reset(static_cast<MachOObjectFile*>(
- ObjectFile::createMachOObjectFile(Buf.take())));
- const macho::Header &Header = DSYMObj->getObject()->getHeader();
-
- std::vector<SymbolRef> Symbols;
- SmallVector<uint64_t, 8> FoundFns;
- getSectionsAndSymbols(Header, DSYMObj.get(), 0, DSYMSections, Symbols,
- FoundFns);
- DebugSections = DSYMSections;
- DbgInfoObj = DSYMObj.get()->getObject();
- }
-
- // Find the named debug info sections.
- for (unsigned SectIdx = 0; SectIdx != DebugSections.size(); SectIdx++) {
- StringRef SectName;
- if (!DebugSections[SectIdx].getName(SectName)) {
- if (SectName.equals("__DWARF,__debug_abbrev"))
- DebugSections[SectIdx].getContents(DebugAbbrevSection);
- else if (SectName.equals("__DWARF,__debug_info"))
- DebugSections[SectIdx].getContents(DebugInfoSection);
- else if (SectName.equals("__DWARF,__debug_aranges"))
- DebugSections[SectIdx].getContents(DebugArangesSection);
- else if (SectName.equals("__DWARF,__debug_line"))
- DebugSections[SectIdx].getContents(DebugLineSection);
- else if (SectName.equals("__DWARF,__debug_str"))
- DebugSections[SectIdx].getContents(DebugStrSection);
- }
+ DbgObj = ObjectFile::createMachOObjectFile(Buf.take());
}
- // Setup the DIContext.
- diContext.reset(DIContext::getDWARFContext(DbgInfoObj->isLittleEndian(),
- DebugInfoSection,
- DebugAbbrevSection,
- DebugArangesSection,
- DebugLineSection,
- DebugStrSection));
+ // Setup the DIContext
+ diContext.reset(DIContext::getDWARFContext(DbgObj));
}
FunctionMapTy FunctionMap;