[Lldb-commits] [lldb] r138644 - in /lldb/trunk/source/Plugins/SymbolFile/DWARF: DWARFDebugInfoEntry.cpp DWARFDebugInfoEntry.h SymbolFileDWARF.cpp

Jim Ingham jingham at apple.com
Fri Aug 26 12:44:13 PDT 2011


Author: jingham
Date: Fri Aug 26 14:44:13 2011
New Revision: 138644

URL: http://llvm.org/viewvc/llvm-project?rev=138644&view=rev
Log:
Move DIE location reporting into the DWARFDebugInfo class, use it from there in SymbolFileDWARF::ParseType (and eventually in other interesting places as well.)

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=138644&r1=138643&r2=138644&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Fri Aug 26 14:44:13 2011
@@ -1129,6 +1129,30 @@
     }
 }
 
+void
+DWARFDebugInfoEntry::DumpLocation
+(
+    SymbolFileDWARF* dwarf2Data,
+    DWARFCompileUnit* cu,
+    Stream *s
+) const
+{
+    const DWARFDebugInfoEntry *cu_die = cu->GetCompileUnitDIEOnly();
+    const char *cu_name = NULL;
+    if (cu_die != NULL)
+        cu_name = cu_die->GetName (dwarf2Data, cu);
+    const char *obj_file_name = NULL;
+    ObjectFile *obj_file = dwarf2Data->GetObjectFile();
+    if (obj_file)
+        obj_file_name = obj_file->GetFileSpec().GetFilename().AsCString();
+    const char *die_name = GetName (dwarf2Data, cu);
+    s->Printf ("CU: %s OBJFILE: %s DIE: %s (0x%llx).", 
+                cu_name ? cu_name : "<UNKNOWN>",
+                obj_file_name ? obj_file_name : "<UNKNOWN>",
+                die_name ? die_name : "<NO NAME>", 
+                GetOffset());
+}
+
 //----------------------------------------------------------------------
 // DumpAttribute
 //

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h?rev=138644&r1=138643&r2=138644&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Fri Aug 26 14:44:13 2011
@@ -256,7 +256,12 @@
                     lldb_private::Stream *s,
                     dw_attr_t attr,
                     dw_form_t form);
-
+    // This one dumps the comp unit name, objfile name and die offset for this die so the stream S.
+    void          DumpLocation(
+                    SymbolFileDWARF* dwarf2Data,
+                    DWARFCompileUnit* cu,
+                    lldb_private::Stream *s) const;
+                    
     bool        GetDIENamesAndRanges(
                     SymbolFileDWARF* dwarf2Data,
                     const DWARFCompileUnit* cu,

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=138644&r1=138643&r2=138644&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Aug 26 14:44:13 2011
@@ -30,6 +30,7 @@
 #include "lldb/Core/Scalar.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Core/StreamFile.h"
+#include "lldb/Core/StreamString.h"
 #include "lldb/Core/Timer.h"
 #include "lldb/Core/Value.h"
 
@@ -2288,6 +2289,7 @@
     // Return the number of variable that were appended to the list
     return sc_list.GetSize() - original_size;
 }
+
 void
 SymbolFileDWARF::ReportError (const char *format, ...)
 {
@@ -3075,20 +3077,10 @@
         Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
         if (log && dwarf_cu)
         {
-            const DWARFDebugInfoEntry *cu_die = dwarf_cu->GetCompileUnitDIEOnly();
-            const char *cu_name = NULL;
-            if (cu_die != NULL)
-                cu_name = cu_die->GetName (this, dwarf_cu);
-            const char *obj_file_name = NULL;
-            if (m_obj_file)
-                obj_file_name = m_obj_file->GetFileSpec().GetFilename().AsCString();
-            const char *die_name = die->GetName (this, dwarf_cu);
-            log->Printf ("SymbolFileDWARF::%s: CU: %s OBJFILE: %s DIE: %s (0x%llx).", 
-                        __FUNCTION__, 
-                        cu_name ? cu_name : "<UNKNOWN>",
-                        obj_file_name ? obj_file_name : "<UNKNOWN>",
-                        die_name ? die_name : "<NO NAME>", 
-                        die->GetOffset());
+            StreamString s;
+            die->DumpLocation (this, dwarf_cu, &s);
+            log->Printf ("SymbolFileDwarf::%s %s", __FUNCTION__, s.GetData());
+            
         }
         
         Type *type_ptr = m_die_to_type.lookup (die);





More information about the lldb-commits mailing list