[llvm-commits] [llvm] r140269 - /llvm/trunk/tools/llvm-objdump/MachODump.cpp

Benjamin Kramer benny.kra at googlemail.com
Wed Sep 21 11:18:53 PDT 2011


Author: d0k
Date: Wed Sep 21 13:18:53 2011
New Revision: 140269

URL: http://llvm.org/viewvc/llvm-project?rev=140269&view=rev
Log:
llvm-objdump: Take the data from the right object when there's no dSYM around.

Modified:
    llvm/trunk/tools/llvm-objdump/MachODump.cpp

Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=140269&r1=140268&r2=140269&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Wed Sep 21 13:18:53 2011
@@ -347,6 +347,7 @@
             DebugLineSection, DebugStrSection;
   OwningPtr<DIContext> diContext;
   OwningPtr<MachOObject> DSYMObj;
+  MachOObject *DbgInfoObj = MachOObj.get();
   // Try to find debug info and set up the DIContext for it.
   if (UseDbg) {
     ArrayRef<Section> DebugSections = Sections;
@@ -368,29 +369,30 @@
       getSectionsAndSymbols(Header, DSYMObj.get(), 0, DSYMSections, Symbols,
                             FoundFns);
       DebugSections = DSYMSections;
+      DbgInfoObj = DSYMObj.get();
     }
 
     // Find the named debug info sections.
     for (unsigned SectIdx = 0; SectIdx != DebugSections.size(); SectIdx++) {
       if (!strcmp(DebugSections[SectIdx].Name, "__debug_abbrev"))
-        DebugAbbrevSection = DSYMObj->getData(DebugSections[SectIdx].Offset,
-                                              DebugSections[SectIdx].Size);
+        DebugAbbrevSection = DbgInfoObj->getData(DebugSections[SectIdx].Offset,
+                                                 DebugSections[SectIdx].Size);
       else if (!strcmp(DebugSections[SectIdx].Name, "__debug_info"))
-        DebugInfoSection = DSYMObj->getData(DebugSections[SectIdx].Offset,
-                                            DebugSections[SectIdx].Size);
-      else if (!strcmp(DebugSections[SectIdx].Name, "__debug_aranges"))
-        DebugArangesSection = DSYMObj->getData(DebugSections[SectIdx].Offset,
+        DebugInfoSection = DbgInfoObj->getData(DebugSections[SectIdx].Offset,
                                                DebugSections[SectIdx].Size);
+      else if (!strcmp(DebugSections[SectIdx].Name, "__debug_aranges"))
+        DebugArangesSection = DbgInfoObj->getData(DebugSections[SectIdx].Offset,
+                                                  DebugSections[SectIdx].Size);
       else if (!strcmp(DebugSections[SectIdx].Name, "__debug_line"))
-        DebugLineSection = DSYMObj->getData(DebugSections[SectIdx].Offset,
-                                            DebugSections[SectIdx].Size);
+        DebugLineSection = DbgInfoObj->getData(DebugSections[SectIdx].Offset,
+                                               DebugSections[SectIdx].Size);
       else if (!strcmp(DebugSections[SectIdx].Name, "__debug_str"))
-        DebugStrSection = DSYMObj->getData(DebugSections[SectIdx].Offset,
-                                           DebugSections[SectIdx].Size);
+        DebugStrSection = DbgInfoObj->getData(DebugSections[SectIdx].Offset,
+                                              DebugSections[SectIdx].Size);
     }
 
     // Setup the DIContext.
-    diContext.reset(DIContext::getDWARFContext(MachOObj->isLittleEndian(),
+    diContext.reset(DIContext::getDWARFContext(DbgInfoObj->isLittleEndian(),
                                                DebugInfoSection,
                                                DebugAbbrevSection,
                                                DebugArangesSection,





More information about the llvm-commits mailing list