[Lldb-commits] [lldb] r124179 - /lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Greg Clayton
gclayton at apple.com
Mon Jan 24 22:17:32 PST 2011
Author: gclayton
Date: Tue Jan 25 00:17:32 2011
New Revision: 124179
URL: http://llvm.org/viewvc/llvm-project?rev=124179&view=rev
Log:
Fixed an issue that was stopping LLDB from finding complete definitions for
types. What was happening was the DWARF parser was almost ignoring definitions
(DIEs with the DW_AT_declaration set to 1). It wasn't ignoring declarations
that had _some_ children. When this happened, we would treat the declaration
as a complete type. Often we would have a declaration of a type with just
some enum definitions inside and nothing else. Now we correctly ignore these
definitions, and also I added some changes to allow us to figure out what
decl context these special declarations actually point to.
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=124179&r1=124178&r2=124179&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Jan 25 00:17:32 2011
@@ -2788,6 +2788,8 @@
//printf ("SymbolFileDWARF::GetClangDeclContextForDIE ( die = 0x%8.8x )\n", die->GetOffset());
const DWARFDebugInfoEntry * const decl_die = die;
+ clang::DeclContext *decl_ctx = NULL;
+
while (die != NULL)
{
// If this is the original DIE that we are searching for a declaration
@@ -2827,14 +2829,22 @@
case DW_TAG_union_type:
case DW_TAG_class_type:
{
- ResolveType (curr_cu, die);
+ Type* type = ResolveType (curr_cu, die);
pos = m_die_to_decl_ctx.find(die);
- assert (pos != m_die_to_decl_ctx.end());
if (pos != m_die_to_decl_ctx.end())
{
//printf ("SymbolFileDWARF::GetClangDeclContextForDIE ( die = 0x%8.8x ) => 0x%8.8x\n", decl_die->GetOffset(), die->GetOffset());
return pos->second;
}
+ else
+ {
+ if (type)
+ {
+ decl_ctx = ClangASTContext::GetDeclContextForType (type->GetClangForwardType ());
+ if (decl_ctx)
+ return decl_ctx;
+ }
+ }
}
break;
@@ -2843,7 +2853,6 @@
}
}
- clang::DeclContext *decl_ctx;
dw_offset_t die_offset = die->GetAttributeValueAsReference(this, curr_cu, DW_AT_specification, DW_INVALID_OFFSET);
if (die_offset != DW_INVALID_OFFSET)
{
@@ -3180,7 +3189,7 @@
}
- if (is_forward_declaration && die->HasChildren() == false)
+ if (is_forward_declaration)
{
// We have a forward declaration to a type and we need
// to try and find a full declaration. We look in the
@@ -3190,14 +3199,14 @@
type_sp = FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str);
- if (!type_sp)
+ if (!type_sp && m_debug_map_symfile)
{
// We weren't able to find a full declaration in
// this DWARF, see if we have a declaration anywhere
// else...
- if (m_debug_map_symfile)
- type_sp = m_debug_map_symfile->FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str);
+ type_sp = m_debug_map_symfile->FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str);
}
+
if (type_sp)
{
// We found a real definition for this type elsewhere
@@ -3310,6 +3319,8 @@
clang_type = m_forward_decl_die_to_clang_type.lookup (die);
if (clang_type == NULL)
{
+ if (die->GetOffset() == 0x1c436)
+ printf("REMOVE THIS!!!\n");
enumerator_clang_type = ast.GetBuiltinTypeForDWARFEncodingAndBitSize (NULL,
DW_ATE_signed,
byte_size * 8);
More information about the lldb-commits
mailing list