summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp6
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp17
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h4
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp4
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp10
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h30
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp21
7 files changed, 67 insertions, 25 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
index 5e86337d8e1..a3f06d7c11b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -176,7 +176,8 @@ DWARFCompileUnit::ExtractDIEsIfNeeded (bool cu_die_only)
die_index_stack.reserve(32);
die_index_stack.push_back(0);
bool prev_die_had_children = false;
- const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize(), m_is_dwarf64);
+ DWARFFormValue::FixedFormSizes fixed_form_sizes =
+ DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize(), m_is_dwarf64);
while (offset < next_cu_offset &&
die.FastExtract (debug_info_data, this, fixed_form_sizes, &offset))
{
@@ -661,7 +662,8 @@ DWARFCompileUnit::Index (const uint32_t cu_idx,
{
const DWARFDataExtractor* debug_str = &m_dwarf2Data->get_debug_str_data();
- const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize(), m_is_dwarf64);
+ DWARFFormValue::FixedFormSizes fixed_form_sizes =
+ DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize(), m_is_dwarf64);
Log *log (LogChannelDWARF::GetLogIfAll (DWARF_LOG_LOOKUPS));
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index 0ad1f1a3a95..844028d9df6 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -119,7 +119,7 @@ DWARFDebugInfoEntry::FastExtract
(
const DWARFDataExtractor& debug_info_data,
const DWARFCompileUnit* cu,
- const uint8_t *fixed_form_sizes,
+ const DWARFFormValue::FixedFormSizes& fixed_form_sizes,
lldb::offset_t *offset_ptr
)
{
@@ -158,7 +158,7 @@ DWARFDebugInfoEntry::FastExtract
{
form = abbrevDecl->GetFormByIndexUnchecked(i);
- const uint8_t fixed_skip_size = fixed_form_sizes [form];
+ const uint8_t fixed_skip_size = fixed_form_sizes.GetSize(form);
if (fixed_skip_size)
offset += fixed_skip_size;
else
@@ -1210,7 +1210,7 @@ DWARFDebugInfoEntry::GetAttributes
(
SymbolFileDWARF* dwarf2Data,
const DWARFCompileUnit* cu,
- const uint8_t *fixed_form_sizes,
+ DWARFFormValue::FixedFormSizes fixed_form_sizes,
DWARFDebugInfoEntry::Attributes& attributes,
uint32_t curr_depth
) const
@@ -1222,8 +1222,9 @@ DWARFDebugInfoEntry::GetAttributes
{
const DWARFDataExtractor& debug_info_data = dwarf2Data->get_debug_info_data();
- if (fixed_form_sizes == NULL)
- fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize(cu->GetAddressByteSize(), cu->IsDWARF64());
+ if (fixed_form_sizes.Empty())
+ fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize(
+ cu->GetAddressByteSize(), cu->IsDWARF64());
const uint32_t num_attributes = abbrevDecl->NumAttributes();
uint32_t i;
@@ -1277,7 +1278,7 @@ DWARFDebugInfoEntry::GetAttributes
}
else
{
- const uint8_t fixed_skip_size = fixed_form_sizes [form];
+ const uint8_t fixed_skip_size = fixed_form_sizes.GetSize(form);
if (fixed_skip_size)
offset += fixed_skip_size;
else
@@ -1956,7 +1957,7 @@ DWARFDebugInfoEntry::GetParentDeclContextDIE (SymbolFileDWARF* dwarf2Data,
DWARFCompileUnit* cu) const
{
DWARFDebugInfoEntry::Attributes attributes;
- GetAttributes(dwarf2Data, cu, NULL, attributes);
+ GetAttributes(dwarf2Data, cu, DWARFFormValue::FixedFormSizes(), attributes);
return GetParentDeclContextDIE (dwarf2Data, cu, attributes);
}
@@ -2026,7 +2027,7 @@ DWARFDebugInfoEntry::GetQualifiedName (SymbolFileDWARF* dwarf2Data,
std::string &storage) const
{
DWARFDebugInfoEntry::Attributes attributes;
- GetAttributes(dwarf2Data, cu, NULL, attributes);
+ GetAttributes(dwarf2Data, cu, DWARFFormValue::FixedFormSizes(), attributes);
return GetQualifiedName (dwarf2Data, cu, attributes, storage);
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
index d8af6342660..e8c937387ee 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
@@ -143,7 +143,7 @@ public:
bool FastExtract(
const lldb_private::DWARFDataExtractor& debug_info_data,
const DWARFCompileUnit* cu,
- const uint8_t *fixed_form_sizes,
+ const DWARFFormValue::FixedFormSizes& fixed_form_sizes,
lldb::offset_t* offset_ptr);
bool Extract(
@@ -161,7 +161,7 @@ public:
size_t GetAttributes(
SymbolFileDWARF* dwarf2Data,
const DWARFCompileUnit* cu,
- const uint8_t *fixed_form_sizes,
+ DWARFFormValue::FixedFormSizes fixed_form_sizes,
DWARFDebugInfoEntry::Attributes& attrs,
uint32_t curr_depth = 0) const; // "curr_depth" for internal use only, don't set this yourself!!!
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
index 8469b78d0dd..b37626cc8ed 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
@@ -87,7 +87,9 @@ DWARFDebugPubnames::GeneratePubnames(SymbolFileDWARF* dwarf2Data)
DWARFCompileUnit* cu = debug_info->GetCompileUnitAtIndex(cu_idx);
- const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (cu->GetAddressByteSize(), cu->IsDWARF64());
+ DWARFFormValue::FixedFormSizes fixed_form_sizes =
+ DWARFFormValue::GetFixedFormSizesForAddressSize (cu->GetAddressByteSize(),
+ cu->IsDWARF64());
bool clear_dies = cu->ExtractDIEsIfNeeded (false) > 1;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
index c733832e4f4..6353cfc9e70 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -136,21 +136,21 @@ g_form_sizes_addr8_dwarf64[] =
8, // 0x20 DW_FORM_ref_sig8
};
-const uint8_t *
+DWARFFormValue::FixedFormSizes
DWARFFormValue::GetFixedFormSizesForAddressSize (uint8_t addr_size, bool is_dwarf64)
{
if (!is_dwarf64) {
switch (addr_size)
{
- case 4: return g_form_sizes_addr4;
- case 8: return g_form_sizes_addr8;
+ case 4: return FixedFormSizes(g_form_sizes_addr4, sizeof(g_form_sizes_addr4));
+ case 8: return FixedFormSizes(g_form_sizes_addr8, sizeof(g_form_sizes_addr8));
}
} else {
if (addr_size == 8)
- return g_form_sizes_addr8_dwarf64;
+ return FixedFormSizes(g_form_sizes_addr8_dwarf64, sizeof(g_form_sizes_addr8_dwarf64));
// is_dwarf64 && addr_size == 4 : no provider does this.
}
- return NULL;
+ return FixedFormSizes();
}
DWARFFormValue::DWARFFormValue() :
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
index 392df26a088..ee8dfa02da7 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
@@ -35,6 +35,34 @@ public:
} value;
const uint8_t* data;
} ValueType;
+
+ class FixedFormSizes
+ {
+ public:
+ FixedFormSizes() :
+ m_fix_sizes(nullptr), m_size(0)
+ {}
+
+ FixedFormSizes(const uint8_t* fix_sizes, size_t size) :
+ m_fix_sizes(fix_sizes), m_size(size)
+ {}
+
+ uint8_t
+ GetSize(uint32_t index) const
+ {
+ return index < m_size ? m_fix_sizes[index] : 0;
+ }
+
+ bool
+ Empty() const
+ {
+ return m_size == 0;
+ }
+
+ private:
+ const uint8_t* m_fix_sizes;
+ size_t m_size;
+ };
enum
{
@@ -69,7 +97,7 @@ public:
static bool SkipValue(const dw_form_t form, const lldb_private::DWARFDataExtractor& debug_info_data, lldb::offset_t *offset_ptr, const DWARFCompileUnit* cu);
static bool IsBlockForm(const dw_form_t form);
static bool IsDataForm(const dw_form_t form);
- static const uint8_t * GetFixedFormSizesForAddressSize (uint8_t addr_size, bool is_dwarf64);
+ static FixedFormSizes GetFixedFormSizesForAddressSize (uint8_t addr_size, bool is_dwarf64);
static int Compare (const DWARFFormValue& a, const DWARFFormValue& b, const lldb_private::DWARFDataExtractor* debug_str_data_ptr);
protected:
const DWARFCompileUnit* m_cu; // Compile unit for this form
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index c8ca9f99da3..a8bcd3b6ea6 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2540,7 +2540,7 @@ SymbolFileDWARF::FunctionDieMatchesPartialName (const DWARFDebugInfoEntry* die,
Mangled best_name;
DWARFDebugInfoEntry::Attributes attributes;
DWARFFormValue form_value;
- die->GetAttributes(this, dwarf_cu, NULL, attributes);
+ die->GetAttributes(this, dwarf_cu, DWARFFormValue::FixedFormSizes(), attributes);
uint32_t idx = attributes.FindAttributeIndex(DW_AT_MIPS_linkage_name);
if (idx == UINT32_MAX)
idx = attributes.FindAttributeIndex(DW_AT_linkage_name);
@@ -3990,7 +3990,10 @@ SymbolFileDWARF::ParseVariableDIE
(tag == DW_TAG_formal_parameter && sc.function))
{
DWARFDebugInfoEntry::Attributes attributes;
- const size_t num_attributes = die->GetAttributes(this, dwarf_cu, NULL, attributes);
+ const size_t num_attributes = die->GetAttributes(this,
+ dwarf_cu,
+ DWARFFormValue::FixedFormSizes(),
+ attributes);
if (num_attributes > 0)
{
const char *name = NULL;
@@ -4040,9 +4043,12 @@ SymbolFileDWARF::ParseVariableDIE
else if (DWARFFormValue::IsDataForm(form_value.Form()))
{
// Retrieve the value as a data expression.
- const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (attributes.CompileUnitAtIndex(i)->GetAddressByteSize(), attributes.CompileUnitAtIndex(i)->IsDWARF64());
+ DWARFFormValue::FixedFormSizes fixed_form_sizes =
+ DWARFFormValue::GetFixedFormSizesForAddressSize (
+ attributes.CompileUnitAtIndex(i)->GetAddressByteSize(),
+ attributes.CompileUnitAtIndex(i)->IsDWARF64());
uint32_t data_offset = attributes.DIEOffsetAtIndex(i);
- uint32_t data_length = fixed_form_sizes[form_value.Form()];
+ uint32_t data_length = fixed_form_sizes.GetSize(form_value.Form());
if (data_length == 0)
{
const uint8_t *data_pointer = form_value.BlockData();
@@ -4064,9 +4070,12 @@ SymbolFileDWARF::ParseVariableDIE
// Retrieve the value as a string expression.
if (form_value.Form() == DW_FORM_strp)
{
- const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (attributes.CompileUnitAtIndex(i)->GetAddressByteSize(), attributes.CompileUnitAtIndex(i)->IsDWARF64());
+ DWARFFormValue::FixedFormSizes fixed_form_sizes =
+ DWARFFormValue::GetFixedFormSizesForAddressSize (
+ attributes.CompileUnitAtIndex(i)->GetAddressByteSize(),
+ attributes.CompileUnitAtIndex(i)->IsDWARF64());
uint32_t data_offset = attributes.DIEOffsetAtIndex(i);
- uint32_t data_length = fixed_form_sizes[form_value.Form()];
+ uint32_t data_length = fixed_form_sizes.GetSize(form_value.Form());
location.CopyOpcodeData(module, debug_info_data, data_offset, data_length);
}
else
OpenPOWER on IntegriCloud