[Lldb-commits] [lldb] r144975 - in /lldb/trunk/source: Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Target/Process.cpp
Greg Clayton
gclayton at apple.com
Thu Nov 17 20:43:59 PST 2011
Author: gclayton
Date: Thu Nov 17 22:43:59 2011
New Revision: 144975
URL: http://llvm.org/viewvc/llvm-project?rev=144975&view=rev
Log:
Looking at our memory usage with Instruments when debugging a large application
we say that the vectors of DWARFDebugInfoEntry objects were the highest on the
the list.
With these changes we cut our memory usage by 40%!!! I did this by reducing
the size of the DWARFDebugInfoEntry from a previous:
uint32_t offset
uint32_t parent_idx
uint32_t sibling_idx
Abbrev * abbrev_ptr
which was 20 bytes, but rounded up to 24 bytes due to alignment. Now we have:
uint32_t offset
uint32_t parent_idx
uint32_t sibling_idx
uint32_t abbr_idx:15, // 32767 possible abbreviation codes
has_children:1, // 0 = no children, 1 = has children
tag:16; // DW_TAG_XXX value
This gets us down to 16 bytes per DIE. I tested some VERY large DWARF files
(900MB) and found there were only ~700 unique abbreviations, so 32767 should
be enough for any sane compiler. If it isn't there are built in assertions
that will fire off and tell us.
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
lldb/trunk/source/Target/Process.cpp
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=144975&r1=144974&r2=144975&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Thu Nov 17 22:43:59 2011
@@ -210,14 +210,7 @@
AddDIE (die);
}
- const DWARFAbbreviationDeclaration* abbrDecl = die.GetAbbreviationDeclarationPtr();
- if (abbrDecl)
- {
- // Normal DIE
- if (abbrDecl->HasChildren())
- ++depth;
- }
- else
+ if (die.IsNULL())
{
// NULL DIE.
if (depth > 0)
@@ -225,6 +218,12 @@
if (depth == 0)
break; // We are done with this compile unit!
}
+ else
+ {
+ // Normal DIE
+ if (die.HasChildren())
+ ++depth;
+ }
}
@@ -469,23 +468,21 @@
// safely access the next die in the array.
DWARFDebugInfoEntry* next_die = curr_die + 1;
- const DWARFAbbreviationDeclaration* curr_die_abbrev = curr_die->GetAbbreviationDeclarationPtr();
-
- if (curr_die_abbrev)
- {
- // Normal DIE
- if (curr_die_abbrev->HasChildren())
- next_die->SetParent(curr_die);
- else
- curr_die->SetSibling(next_die);
- }
- else
+ if (curr_die->IsNULL())
{
// NULL DIE that terminates a sibling chain
DWARFDebugInfoEntry* parent = curr_die->GetParent();
if (parent)
parent->SetSibling(next_die);
}
+ else
+ {
+ // Normal DIE
+ if (curr_die->HasChildren())
+ next_die->SetParent(curr_die);
+ else
+ curr_die->SetSibling(next_die);
+ }
}
// Since we skipped the last element, we need to fix it up!
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=144975&r1=144974&r2=144975&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Thu Nov 17 22:43:59 2011
@@ -113,23 +113,27 @@
{
m_offset = *offset_ptr;
- dw_uleb128_t abbrCode = debug_info_data.GetULEB128 (offset_ptr);
+ uint64_t abbr_idx = debug_info_data.GetULEB128 (offset_ptr);
+ assert (abbr_idx < (1 << DIE_ABBR_IDX_BITSIZE));
+ m_abbr_idx = abbr_idx;
assert (fixed_form_sizes); // For best performance this should be specified!
- if (abbrCode)
+ if (m_abbr_idx)
{
uint32_t offset = *offset_ptr;
- m_abbrevDecl = cu->GetAbbreviations()->GetAbbreviationDeclaration(abbrCode);
+ const DWARFAbbreviationDeclaration *abbrevDecl = cu->GetAbbreviations()->GetAbbreviationDeclaration(m_abbr_idx);
+ m_tag = abbrevDecl->Tag();
+ m_has_children = abbrevDecl->HasChildren();
// Skip all data in the .debug_info for the attributes
- const uint32_t numAttributes = m_abbrevDecl->NumAttributes();
+ const uint32_t numAttributes = abbrevDecl->NumAttributes();
register uint32_t i;
register dw_form_t form;
for (i=0; i<numAttributes; ++i)
{
- form = m_abbrevDecl->GetFormByIndexUnchecked(i);
+ form = abbrevDecl->GetFormByIndexUnchecked(i);
const uint8_t fixed_skip_size = fixed_form_sizes [form];
if (fixed_skip_size)
@@ -213,7 +217,8 @@
}
else
{
- m_abbrevDecl = NULL;
+ m_tag = 0;
+ m_has_children = false;
return true; // NULL debug tag entry
}
@@ -246,28 +251,30 @@
{
m_offset = offset;
- dw_uleb128_t abbrCode = debug_info_data.GetULEB128(&offset);
-
- if (abbrCode)
+ const uint64_t abbr_idx = debug_info_data.GetULEB128(&offset);
+ assert (abbr_idx < (1 << DIE_ABBR_IDX_BITSIZE));
+ m_abbr_idx = abbr_idx;
+ if (abbr_idx)
{
- m_abbrevDecl = cu->GetAbbreviations()->GetAbbreviationDeclaration(abbrCode);
+ const DWARFAbbreviationDeclaration *abbrevDecl = cu->GetAbbreviations()->GetAbbreviationDeclaration(abbr_idx);
- if (m_abbrevDecl)
+ if (abbrevDecl)
{
- dw_tag_t tag = m_abbrevDecl->Tag();
+ m_tag = abbrevDecl->Tag();
+ m_has_children = abbrevDecl->HasChildren();
- bool isCompileUnitTag = tag == DW_TAG_compile_unit;
+ bool isCompileUnitTag = m_tag == DW_TAG_compile_unit;
if (cu && isCompileUnitTag)
((DWARFCompileUnit*)cu)->SetBaseAddress(0);
// Skip all data in the .debug_info for the attributes
- const uint32_t numAttributes = m_abbrevDecl->NumAttributes();
+ const uint32_t numAttributes = abbrevDecl->NumAttributes();
uint32_t i;
dw_attr_t attr;
dw_form_t form;
for (i=0; i<numAttributes; ++i)
{
- m_abbrevDecl->GetAttrAndFormByIndexUnchecked(i, attr, form);
+ abbrevDecl->GetAttrAndFormByIndexUnchecked(i, attr, form);
if (isCompileUnitTag && ((attr == DW_AT_entry_pc) || (attr == DW_AT_low_pc)))
{
@@ -359,7 +366,8 @@
}
else
{
- m_abbrevDecl = NULL;
+ m_tag = 0;
+ m_has_children = false;
*offset_ptr = offset;
return true; // NULL debug tag entry
}
@@ -369,209 +377,6 @@
}
//----------------------------------------------------------------------
-// AppendDependentDIES()
-//----------------------------------------------------------------------
-bool
-DWARFDebugInfoEntry::AppendDependentDIES
-(
- SymbolFileDWARF* dwarf2Data,
- const DWARFCompileUnit* cu,
- const bool add_children,
- DWARFDIECollection& dependent_dies
-) const
-{
- // Add this object's DIE offset
- // The line below is the only place that should add a die to the
- // dependent_dies collection as we have to be careful of recursion!
- if ( !dependent_dies.Insert(this) )
- return false; // This DIE already exists in the collection, nothing to do!
-
- //DEBUG_PRINTF(" dependent_dies.Insert(0x%8.8x)\n", GetOffset());///
-
- if (m_abbrevDecl)
- {
- // Keep adding parent DIE offsets as long as the offsets do not
- // already exist in the collection
- const DWARFDebugInfoEntry* die = GetParent();
- while ( die && die->AppendDependentDIES(dwarf2Data, cu, false, dependent_dies) )
- die = die->GetParent();
-
- bool add_non_subprogram_children = false;
- bool add_children_override = false;
-
- if (!add_children)
- {
- switch (m_abbrevDecl->Tag())
- {
- case DW_TAG_array_type: break;
- case DW_TAG_class_type: add_non_subprogram_children = true; break;
- case DW_TAG_entry_point: break;
- case DW_TAG_enumeration_type: break;
- case DW_TAG_formal_parameter: break;
- case DW_TAG_imported_declaration: break;
- case DW_TAG_label: break;
- case DW_TAG_lexical_block: add_children_override = true; break;
- case DW_TAG_member: break;
- case DW_TAG_pointer_type: break;
- case DW_TAG_reference_type: break;
- case DW_TAG_compile_unit: break;
- case DW_TAG_string_type: break;
- case DW_TAG_structure_type: add_non_subprogram_children = true; break;
- case DW_TAG_subroutine_type: add_children_override = true; break;
- case DW_TAG_typedef: break;
- case DW_TAG_union_type: add_non_subprogram_children = true; break;
- case DW_TAG_unspecified_parameters: break;
- case DW_TAG_variant: break;
- case DW_TAG_common_block: break;
- case DW_TAG_common_inclusion: break;
- case DW_TAG_inheritance: break;
- case DW_TAG_inlined_subroutine: break;
- case DW_TAG_module: break;
- case DW_TAG_ptr_to_member_type: break;
- case DW_TAG_set_type: break;
- case DW_TAG_subrange_type: break;
- case DW_TAG_with_stmt: break;
- case DW_TAG_access_declaration: break;
- case DW_TAG_base_type: break;
- case DW_TAG_catch_block: break;
- case DW_TAG_const_type: break;
- case DW_TAG_constant: break;
- case DW_TAG_enumerator: break;
- case DW_TAG_file_type: break;
- case DW_TAG_friend: break;
- case DW_TAG_namelist: break;
- case DW_TAG_namelist_item: break;
- case DW_TAG_packed_type: break;
- case DW_TAG_subprogram: add_children_override = true; break;
- case DW_TAG_template_type_parameter: break;
- case DW_TAG_template_value_parameter: break;
- case DW_TAG_thrown_type: break;
- case DW_TAG_try_block: break;
- case DW_TAG_variant_part: break;
- case DW_TAG_variable: break;
- case DW_TAG_volatile_type: break;
- case DW_TAG_dwarf_procedure: break;
- case DW_TAG_restrict_type: break;
- case DW_TAG_interface_type: break;
- case DW_TAG_namespace: break;
- case DW_TAG_imported_module: break;
- case DW_TAG_unspecified_type: break;
- case DW_TAG_partial_unit: break;
- case DW_TAG_imported_unit: break;
- case DW_TAG_shared_type: break;
- }
- }
- const DataExtractor& debug_info_data = dwarf2Data->get_debug_info_data();
-
- // Dump all data in the .debug_info for the attributes
- const uint32_t numAttributes = m_abbrevDecl->NumAttributes();
- uint32_t i;
- dw_offset_t offset = GetOffset();
- debug_info_data.Skip_LEB128(&offset); // Skip abbreviation code
-
- dw_attr_t attr;
- dw_form_t form;
- for (i=0; i<numAttributes; ++i)
- {
- m_abbrevDecl->GetAttrAndFormByIndexUnchecked(i, attr, form);
- DWARFFormValue form_value(form);
-
- switch (attr)
- {
- // All cases that use refer to another DIE should use this case
- // without
- // having to check the FORM of the attribute to tell if it refers to another
- // DIE
- case DW_AT_abstract_origin:
- case DW_AT_import:
- case DW_AT_discr:
- case DW_AT_containing_type:
- case DW_AT_base_types:
- case DW_AT_friend:
- case DW_AT_specification:
- case DW_AT_type:
- case DW_AT_common_reference:
- case DW_AT_default_value:
- {
- form_value.ExtractValue(debug_info_data, &offset, cu);
- DWARFCompileUnitSP cu_sp_ptr;
- const DWARFDebugInfoEntry* ref_die = const_cast<SymbolFileDWARF*>(dwarf2Data)->DebugInfo()->GetDIEPtr(form_value.Reference(cu), &cu_sp_ptr);
- if (ref_die)
- ref_die->AppendDependentDIES(dwarf2Data, cu_sp_ptr.get(), true, dependent_dies);
- }
- break;
-
- default:
- if (attr != DW_AT_sibling)
- {
- switch (form_value.Form())
- {
- case DW_FORM_ref_addr:
- case DW_FORM_ref1:
- case DW_FORM_ref2:
- case DW_FORM_ref4:
- case DW_FORM_ref8:
- case DW_FORM_ref_udata:
-// Log::WarningVerbose("DWARFDebugInfoEntry::AppendDependentDIES() -- check on this item %s: attr = %s form = %s",
-// DW_TAG_value_to_name(m_abbrevDecl->Tag()),
-// DW_AT_value_to_name(attr),
-// DW_FORM_value_to_name(form));
- break;
- }
- }
- form_value.SkipValue(debug_info_data, &offset, cu);
- break;
- }
- }
-
- if (m_abbrevDecl->HasChildren())
- {
- const DWARFDebugInfoEntry* child;
- for (child = GetFirstChild(); child != NULL; child = child->GetSibling())
- {
- bool add = add_children || add_children_override;
-
- if (!add)
- {
- if (add_non_subprogram_children)
- {
- // add_non_subprogram_children is used for classes and structs
- // that may contain children that are the member variables that
- // may have functions as children and whom may add the class or
- // struct by adding their parent. We don't want to add any
- // functions though since they may have been optimized out. But
- // we do need to watch for declarations and keep them.
- if (child->Tag() == DW_TAG_subprogram)
- {
- // Check if this subprogram TAG had a DW_AT_declaration attribute set to 1.
- // If so we need to include this DIE so that we always have a complete view
- // of a class definition so debuggers can track down any weak symbols that
- // may not have had weak definition entries.
- if (child->GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_declaration, 0) == 1)
- add = true;
- }
- else
- {
- // Add all other items inside a class/struct
- add = true;
- }
- }
- else
- {
- // We don't need to add this child, only add it if it's a NULL tag
- add = child->IsNULL();
- }
- }
-
- if (add)
- child->AppendDependentDIES(dwarf2Data, cu, true, dependent_dies);
- }
- }
- }
- return true;
-}
-
-//----------------------------------------------------------------------
// DumpAncestry
//
// Dumps all of a debug information entries parents up until oldest and
@@ -894,7 +699,10 @@
dw_addr_t hi_pc = DW_INVALID_ADDRESS;
std::vector<dw_offset_t> die_offsets;
bool set_frame_base_loclist_addr = false;
- if (m_abbrevDecl)
+
+ const DWARFAbbreviationDeclaration* abbrevDecl = GetAbbreviationDeclarationPtr(cu);
+
+ if (abbrevDecl)
{
const DataExtractor& debug_info_data = dwarf2Data->get_debug_info_data();
uint32_t offset = m_offset;
@@ -905,13 +713,13 @@
// Skip the abbreviation code
debug_info_data.Skip_LEB128(&offset);
- const uint32_t numAttributes = m_abbrevDecl->NumAttributes();
+ const uint32_t numAttributes = abbrevDecl->NumAttributes();
uint32_t i;
dw_attr_t attr;
dw_form_t form;
for (i=0; i<numAttributes; ++i)
{
- m_abbrevDecl->GetAttrAndFormByIndexUnchecked(i, attr, form);
+ abbrevDecl->GetAttrAndFormByIndexUnchecked(i, attr, form);
DWARFFormValue form_value(form);
if (form_value.ExtractValue(debug_info_data, &offset, cu))
{
@@ -1088,19 +896,21 @@
s.Indent();
if (abbrCode)
{
- if (m_abbrevDecl)
+ const DWARFAbbreviationDeclaration* abbrevDecl = GetAbbreviationDeclarationPtr(cu);
+
+ if (abbrevDecl)
{
- s.PutCString(DW_TAG_value_to_name(m_abbrevDecl->Tag()));
- s.Printf( " [%u] %c\n", abbrCode, m_abbrevDecl->HasChildren() ? '*':' ');
+ s.PutCString(DW_TAG_value_to_name(abbrevDecl->Tag()));
+ s.Printf( " [%u] %c\n", abbrCode, abbrevDecl->HasChildren() ? '*':' ');
// Dump all data in the .debug_info for the attributes
- const uint32_t numAttributes = m_abbrevDecl->NumAttributes();
+ const uint32_t numAttributes = abbrevDecl->NumAttributes();
uint32_t i;
dw_attr_t attr;
dw_form_t form;
for (i=0; i<numAttributes; ++i)
{
- m_abbrevDecl->GetAttrAndFormByIndexUnchecked(i, attr, form);
+ abbrevDecl->GetAttrAndFormByIndexUnchecked(i, attr, form);
DumpAttribute(dwarf2Data, cu, debug_info_data, &offset, s, attr, form);
}
@@ -1326,7 +1136,9 @@
uint32_t curr_depth
) const
{
- if (m_abbrevDecl)
+ const DWARFAbbreviationDeclaration* abbrevDecl = GetAbbreviationDeclarationPtr(cu);
+
+ if (abbrevDecl)
{
if (fixed_form_sizes == NULL)
fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize(cu->GetAddressByteSize());
@@ -1336,14 +1148,14 @@
// Skip the abbreviation code so we are at the data for the attributes
debug_info_data.Skip_LEB128(&offset);
- const uint32_t num_attributes = m_abbrevDecl->NumAttributes();
+ const uint32_t num_attributes = abbrevDecl->NumAttributes();
uint32_t i;
dw_attr_t attr;
dw_form_t form;
DWARFFormValue form_value;
for (i=0; i<num_attributes; ++i)
{
- m_abbrevDecl->GetAttrAndFormByIndexUnchecked (i, attr, form);
+ abbrevDecl->GetAttrAndFormByIndexUnchecked (i, attr, form);
// If we are tracking down DW_AT_specification or DW_AT_abstract_origin
// attributes, the depth will be non-zero. We need to omit certain
@@ -1423,9 +1235,11 @@
dw_offset_t* end_attr_offset_ptr
) const
{
- if (m_abbrevDecl)
+ const DWARFAbbreviationDeclaration* abbrevDecl = GetAbbreviationDeclarationPtr(cu);
+
+ if (abbrevDecl)
{
- uint32_t attr_idx = m_abbrevDecl->FindAttributeIndex(attr);
+ uint32_t attr_idx = abbrevDecl->FindAttributeIndex(attr);
if (attr_idx != DW_INVALID_INDEX)
{
@@ -1438,10 +1252,10 @@
uint32_t idx=0;
while (idx<attr_idx)
- DWARFFormValue::SkipValue(m_abbrevDecl->GetFormByIndex(idx++), debug_info_data, &offset, cu);
+ DWARFFormValue::SkipValue(abbrevDecl->GetFormByIndex(idx++), debug_info_data, &offset, cu);
const dw_offset_t attr_offset = offset;
- form_value.SetForm(m_abbrevDecl->GetFormByIndex(idx));
+ form_value.SetForm(abbrevDecl->GetFormByIndex(idx));
if (form_value.ExtractValue(debug_info_data, &offset, cu))
{
if (end_attr_offset_ptr)
@@ -1749,7 +1563,7 @@
else
{
bool result = true;
- const DWARFAbbreviationDeclaration* abbrevDecl = die.GetAbbreviationDeclarationPtr();
+ const DWARFAbbreviationDeclaration* abbrevDecl = die.GetAbbreviationDeclarationPtr(cu);
switch (abbrevDecl->Tag())
{
@@ -1831,10 +1645,9 @@
DWARFDebugAranges* debug_aranges
) const
{
- if (m_abbrevDecl)
+ if (m_tag)
{
- dw_tag_t tag = m_abbrevDecl->Tag();
- if (tag == DW_TAG_subprogram)
+ if (m_tag == DW_TAG_subprogram)
{
dw_addr_t hi_pc = DW_INVALID_ADDRESS;
dw_addr_t lo_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_low_pc, DW_INVALID_ADDRESS);
@@ -1873,10 +1686,9 @@
DWARFDebugAranges* debug_aranges
) const
{
- if (m_abbrevDecl)
+ if (m_tag)
{
- dw_tag_t tag = m_abbrevDecl->Tag();
- if (tag == DW_TAG_subprogram)
+ if (m_tag == DW_TAG_subprogram)
{
dw_addr_t hi_pc = DW_INVALID_ADDRESS;
dw_addr_t lo_pc = GetAttributeValueAsUnsigned(dwarf2Data, cu, DW_AT_low_pc, DW_INVALID_ADDRESS);
@@ -1913,13 +1725,12 @@
)
{
bool found_address = false;
- if (m_abbrevDecl)
+ if (m_tag)
{
bool check_children = false;
bool match_addr_range = false;
- dw_tag_t tag = m_abbrevDecl->Tag();
// printf("0x%8.8x: %30s: address = 0x%8.8x - ", m_offset, DW_TAG_value_to_name(tag), address);
- switch (tag)
+ switch (m_tag)
{
case DW_TAG_array_type : break;
case DW_TAG_class_type : check_children = true; break;
@@ -1993,7 +1804,7 @@
{
found_address = true;
// puts("***MATCH***");
- switch (tag)
+ switch (m_tag)
{
case DW_TAG_compile_unit: // File
check_children = ((function_die != NULL) || (block_die != NULL));
@@ -2024,7 +1835,7 @@
{ // compile units may not have a valid high/low pc when there
// are address gaps in subroutines so we must always search
// if there is no valid high and low PC
- check_children = (tag == DW_TAG_compile_unit) && ((function_die != NULL) || (block_die != NULL));
+ check_children = (m_tag == DW_TAG_compile_unit) && ((function_die != NULL) || (block_die != NULL));
}
}
else
@@ -2043,7 +1854,7 @@
{
found_address = true;
// puts("***MATCH***");
- switch (tag)
+ switch (m_tag)
{
case DW_TAG_compile_unit: // File
check_children = ((function_die != NULL) || (block_die != NULL));
@@ -2093,6 +1904,14 @@
return found_address;
}
+const DWARFAbbreviationDeclaration*
+DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr (const DWARFCompileUnit *cu) const
+{
+ if (m_abbr_idx)
+ return cu->GetAbbreviations()->GetAbbreviationDeclaration (m_abbr_idx);
+ return NULL;
+}
+
bool
DWARFDebugInfoEntry::OffsetLessThan (const DWARFDebugInfoEntry& a, const DWARFDebugInfoEntry& b)
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=144975&r1=144974&r2=144975&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Thu Nov 17 22:43:59 2011
@@ -11,9 +11,9 @@
#define SymbolFileDWARF_DWARFDebugInfoEntry_h_
#include "SymbolFileDWARF.h"
-
#include "llvm/ADT/SmallVector.h"
+#include "DWARFDebugAbbrev.h"
#include "DWARFAbbreviationDeclaration.h"
#include "DWARFDebugRanges.h"
#include <vector>
@@ -41,6 +41,8 @@
typedef UInt32ToDIEMMap::iterator UInt32ToDIEMMapIter;
typedef UInt32ToDIEMMap::const_iterator UInt32ToDIEMMapConstIter;
+#define DIE_ABBR_IDX_BITSIZE 15
+
class DWARFDebugInfoEntry
{
public:
@@ -105,7 +107,8 @@
m_offset (DW_INVALID_OFFSET),
m_parent_idx (0),
m_sibling_idx (0),
- m_abbrevDecl (NULL)
+ m_abbr_idx (0),
+ m_has_children (false)
{
}
@@ -229,12 +232,6 @@
const DWARFDebugInfoEntry& a,
const DWARFDebugInfoEntry& b);
- bool AppendDependentDIES(
- SymbolFileDWARF* dwarf2Data,
- const DWARFCompileUnit* cu,
- const bool add_children,
- DWARFDIECollection& die_offsets) const;
-
void Dump(
SymbolFileDWARF* dwarf2Data,
const DWARFCompileUnit* cu,
@@ -276,13 +273,44 @@
int& call_column,
lldb_private::DWARFExpression *frame_base = NULL) const;
+ const DWARFAbbreviationDeclaration*
+ GetAbbreviationDeclarationPtr (const DWARFCompileUnit *cu) const;
+
+ dw_tag_t
+ Tag () const
+ {
+ return m_tag;
+ }
+
+ bool
+ IsNULL() const
+ {
+ return m_abbr_idx == 0;
+ }
+
+ dw_offset_t
+ GetOffset () const
+ {
+ return m_offset;
+ }
+
+ void
+ SetOffset (dw_offset_t offset)
+ {
+ m_offset = offset;
+ }
- dw_tag_t Tag() const { return m_abbrevDecl ? m_abbrevDecl->Tag() : 0; }
- bool IsNULL() const { return m_abbrevDecl == NULL; }
- dw_offset_t GetOffset() const { return m_offset; }
- void SetOffset(dw_offset_t offset) { m_offset = offset; }
- uint32_t NumAttributes() const { return m_abbrevDecl ? m_abbrevDecl->NumAttributes() : 0; }
- bool HasChildren() const { return m_abbrevDecl != NULL && m_abbrevDecl->HasChildren(); }
+ bool
+ HasChildren () const
+ {
+ return m_has_children;
+ }
+
+ void
+ SetHasChildren (bool b)
+ {
+ m_has_children = b;
+ }
// We know we are kept in a vector of contiguous entries, so we know
// our parent will be some index behind "this".
@@ -323,13 +351,15 @@
else
m_sibling_idx = 0;
}
- const DWARFAbbreviationDeclaration* GetAbbreviationDeclarationPtr() const { return m_abbrevDecl; }
protected:
- dw_offset_t m_offset; // Offset within the .debug_info of the start of this entry
- uint32_t m_parent_idx; // How many to subtract from "this" to get the parent. If zero this die has no parent
- uint32_t m_sibling_idx; // How many to add to "this" to get the sibling.
- const DWARFAbbreviationDeclaration* m_abbrevDecl;
+ dw_offset_t m_offset; // Offset within the .debug_info of the start of this entry
+ uint32_t m_parent_idx; // How many to subtract from "this" to get the parent. If zero this die has no parent
+ uint32_t m_sibling_idx; // How many to add to "this" to get the sibling.
+ uint32_t m_abbr_idx:DIE_ABBR_IDX_BITSIZE,
+ m_has_children:1,
+ m_tag:16;
+
};
#endif // SymbolFileDWARF_DWARFDebugInfoEntry_h_
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=144975&r1=144974&r2=144975&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu Nov 17 22:43:59 2011
@@ -257,7 +257,6 @@
// settings that were set with "settings set"
if (m_file_actions.empty())
{
- const char *path;
if (m_flags.Test(eLaunchFlagDisableSTDIO))
{
AppendSuppressFileAction (STDERR_FILENO, true , true );
More information about the lldb-commits
mailing list