<rdar://problem/13561911>

Modify LLDB to handle DW_FORM_ref_addr attributes for DWARF3 and DWARF4.

llvm-svn: 178696
This commit is contained in:
Greg Clayton 2013-04-03 21:09:33 +00:00
parent 26cf0b5130
commit a75f0ca30e
2 changed files with 31 additions and 7 deletions

View File

@ -184,9 +184,14 @@ DWARFDebugInfoEntry::FastExtract
// Compile unit address sized values
case DW_FORM_addr :
case DW_FORM_ref_addr :
form_size = cu->GetAddressByteSize();
break;
case DW_FORM_ref_addr :
if (cu->GetVersion() <= 2)
form_size = cu->GetAddressByteSize();
else
form_size = 4; // 4 bytes for DWARF 32, 8 bytes for DWARF 64, but we don't support DWARF64 yet
break;
// 0 sized form
case DW_FORM_flag_present:
@ -343,9 +348,14 @@ DWARFDebugInfoEntry::Extract
// Compile unit address sized values
case DW_FORM_addr :
case DW_FORM_ref_addr :
form_size = cu_addr_size;
break;
case DW_FORM_ref_addr :
if (cu->GetVersion() <= 2)
form_size = cu_addr_size;
else
form_size = 4; // 4 bytes for DWARF 32, 8 bytes for DWARF 64, but we don't support DWARF64 yet
break;
// 0 sized form
case DW_FORM_flag_present:

View File

@ -38,7 +38,7 @@ static uint8_t g_form_sizes_addr4[] =
0, // 0x0d DW_FORM_sdata
4, // 0x0e DW_FORM_strp
0, // 0x0f DW_FORM_udata
4, // 0x10 DW_FORM_ref_addr
0, // 0x10 DW_FORM_ref_addr (addr size for DWARF2 and earlier, 4 bytes for DWARF32, 8 bytes for DWARF32 in DWARF 3 and later
1, // 0x11 DW_FORM_ref1
2, // 0x12 DW_FORM_ref2
4, // 0x13 DW_FORM_ref4
@ -77,7 +77,7 @@ g_form_sizes_addr8[] =
0, // 0x0d DW_FORM_sdata
4, // 0x0e DW_FORM_strp
0, // 0x0f DW_FORM_udata
8, // 0x10 DW_FORM_ref_addr
0, // 0x10 DW_FORM_ref_addr (addr size for DWARF2 and earlier, 4 bytes for DWARF32, 8 bytes for DWARF32 in DWARF 3 and later
1, // 0x11 DW_FORM_ref1
2, // 0x12 DW_FORM_ref2
4, // 0x13 DW_FORM_ref4
@ -145,7 +145,12 @@ DWARFFormValue::ExtractValue(const DataExtractor& data, lldb::offset_t* offset_p
case DW_FORM_strp: m_value.value.uval = data.GetU32(offset_ptr); break;
// case DW_FORM_APPLE_db_str:
case DW_FORM_udata: m_value.value.uval = data.GetULEB128(offset_ptr); break;
case DW_FORM_ref_addr: m_value.value.uval = data.GetMaxU64(offset_ptr, DWARFCompileUnit::GetAddressByteSize(cu)); break;
case DW_FORM_ref_addr:
if (cu->GetVersion() <= 2)
m_value.value.uval = data.GetMaxU64(offset_ptr, DWARFCompileUnit::GetAddressByteSize(cu));
else
m_value.value.uval = data.GetU32(offset_ptr); // 4 for DWARF32, 8 for DWARF64, but we don't support DWARF64 yet
break;
case DW_FORM_ref1: m_value.value.uval = data.GetU8(offset_ptr); break;
case DW_FORM_ref2: m_value.value.uval = data.GetU16(offset_ptr); break;
case DW_FORM_ref4: m_value.value.uval = data.GetU32(offset_ptr); break;
@ -203,10 +208,16 @@ DWARFFormValue::SkipValue(dw_form_t form, const DataExtractor& debug_info_data,
// Compile unit address sized values
case DW_FORM_addr:
case DW_FORM_ref_addr:
*offset_ptr += DWARFCompileUnit::GetAddressByteSize(cu);
return true;
case DW_FORM_ref_addr:
if (cu->GetVersion() <= 2)
*offset_ptr += DWARFCompileUnit::GetAddressByteSize(cu);
else
*offset_ptr += 4;// 4 for DWARF32, 8 for DWARF64, but we don't support DWARF64 yet
return true;
// 0 bytes values (implied from DW_FORM)
case DW_FORM_flag_present:
return true;
@ -337,7 +348,10 @@ DWARFFormValue::Dump(Stream &s, const DataExtractor* debug_str_data, const DWARF
case DW_FORM_ref_addr:
{
s.Address(uvalue, sizeof (uint64_t) * 2);
if (cu->GetVersion() <= 2)
s.Address(uvalue, sizeof (uint64_t) * 2);
else
s.Address(uvalue, 4 * 2);// 4 for DWARF32, 8 for DWARF64, but we don't support DWARF64 yet
break;
}
case DW_FORM_ref1: cu_relative_offset = true; if (verbose) s.Printf("cu + 0x%2.2x", (uint8_t)uvalue); break;