[Lldb-commits] [lldb] r193794 - Migrate DWARFDebugLine to DWARFDataExtractor 64-bit DWARF support

Ed Maste emaste at freebsd.org
Thu Oct 31 12:51:53 PDT 2013


Author: emaste
Date: Thu Oct 31 14:51:53 2013
New Revision: 193794

URL: http://llvm.org/viewvc/llvm-project?rev=193794&view=rev
Log:
Migrate DWARFDebugLine to DWARFDataExtractor 64-bit DWARF support

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h?rev=193794&r1=193793&r2=193794&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h Thu Oct 31 14:51:53 2013
@@ -30,6 +30,9 @@ public:
     dw_offset_t
     GetDWARFOffset(lldb::offset_t *offset_ptr) const;
 
+    size_t
+    GetDWARFSizeofInitialLength() const { return m_is_dwarf64 ? 12 : 4; }
+
 protected:
     mutable bool m_is_dwarf64;
 };

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp?rev=193794&r1=193793&r2=193794&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp Thu Oct 31 14:51:53 2013
@@ -410,23 +410,12 @@ DWARFDebugLine::ParsePrologue(const DWAR
     prologue->Clear();
     uint32_t i;
     const char * s;
-    prologue->total_length      = debug_line_data.GetU32(offset_ptr);
-    // 7.4 32-Bit and 64-Bit DWARF Formats
-    if (prologue->total_length == 0xffffffff)
-    {
-        prologue->is_64_bit     = true;
-        prologue->total_length  = debug_line_data.GetU64(offset_ptr);
-    }
-    else if (prologue->total_length >= 0xffffff00)
-    {
-        // Reserved.
-        return false;
-    }
+    prologue->total_length      = debug_line_data.GetDWARFInitialLength(offset_ptr);
     prologue->version           = debug_line_data.GetU16(offset_ptr);
     if (prologue->version != 2)
       return false;
 
-    prologue->prologue_length   = debug_line_data.GetMaxU64(offset_ptr, prologue->SizeofPrologueLength());
+    prologue->prologue_length   = debug_line_data.GetDWARFOffset(offset_ptr);
     const lldb::offset_t end_prologue_offset = prologue->prologue_length + *offset_ptr;
     prologue->min_inst_length   = debug_line_data.GetU8(offset_ptr);
     prologue->default_is_stmt   = debug_line_data.GetU8(offset_ptr);
@@ -488,18 +477,13 @@ DWARFDebugLine::ParseSupportFiles (const
 {
     lldb::offset_t offset = stmt_list;
     // Skip the total length
-    size_t dwarf_offset_size = 4;
-    if (debug_line_data.GetU32(&offset) == 0xffffffff)
-    {
-        dwarf_offset_size = 8;
-        (void)debug_line_data.GetU64(&offset);
-    }
+    (void)debug_line_data.GetDWARFInitialLength(&offset);
     const char * s;
     uint32_t version = debug_line_data.GetU16(&offset);
     if (version != 2)
       return false;
 
-    const dw_offset_t end_prologue_offset = debug_line_data.GetMaxU64(&offset, dwarf_offset_size) + offset;
+    const dw_offset_t end_prologue_offset = debug_line_data.GetDWARFOffset(&offset) + offset;
     // Skip instruction length, default is stmt, line base, line range and
     // opcode base, and all opcode lengths
     offset += 4;
@@ -619,7 +603,7 @@ DWARFDebugLine::ParseStatementTable
     if (log)
         prologue->Dump (log);
 
-    const dw_offset_t end_offset = debug_line_offset + prologue->total_length + (prologue->SizeofTotalLength());
+    const dw_offset_t end_offset = debug_line_offset + prologue->total_length + (debug_line_data.GetDWARFSizeofInitialLength());
 
     State state(prologue, log, callback, userData);
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h?rev=193794&r1=193793&r2=193794&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h Thu Oct 31 14:51:53 2013
@@ -65,8 +65,7 @@ public:
             opcode_base(0),
             standard_opcode_lengths(),
             include_directories(),
-            file_names(),
-            is_64_bit(false)
+            file_names()
         {
         }
 
@@ -84,9 +83,6 @@ public:
         std::vector<std::string>        include_directories;
         std::vector<FileNameEntry>      file_names;
 
-        bool        is_64_bit;      // 64-bit dwarf
-        uint32_t SizeofTotalLength() const { return is_64_bit ? 12 : 4; }
-        uint32_t SizeofPrologueLength() const { return is_64_bit ? 8 : 4; }
         int32_t MaxLineIncrementForSpecialOpcode() const { return line_base + (int8_t)line_range - 1; }
         bool IsValid() const;
 //      void Append(BinaryStreamBuf& buff) const;
@@ -98,7 +94,6 @@ public:
             standard_opcode_lengths.clear();
             include_directories.clear();
             file_names.clear();
-            is_64_bit = false;
         }
         bool GetFile(uint32_t file_idx, std::string& file, std::string& dir) const;
 





More information about the lldb-commits mailing list