Migrate DWARFDebugLine to DWARFDataExtractor 64-bit DWARF support

llvm-svn: 193794
This commit is contained in:
Ed Maste 2013-10-31 19:51:53 +00:00
parent 7268e6ef9d
commit 1c09d4a537
3 changed files with 9 additions and 27 deletions

View File

@ -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;
};

View File

@ -410,23 +410,12 @@ DWARFDebugLine::ParsePrologue(const DWARFDataExtractor& debug_line_data, lldb::o
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::ModuleSP &module_sp,
{
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);

View File

@ -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;