Debugger: Handle DW_AT_signature.

- Per DWARF4's specification, if a type's complete definition is
  contained in a .debug_types unit, it should be referenced via the
  DW_AT_signature attribute. 4.8 now actually does this rather than
  setting e.g. DW_AT_attribute_origin to a signature ref, and
  consequently we weren't finding said reference any more.

Gets .debug_types section support working again.
This commit is contained in:
Rene Gollent 2014-03-09 10:10:34 -04:00
parent 0da0db4da0
commit 198fd05030
5 changed files with 41 additions and 3 deletions

View File

@ -314,6 +314,7 @@ DIEDeclaredType::DIEDeclaredType()
:
fDescription(NULL),
fAbstractOrigin(NULL),
fSignatureType(NULL),
fAccessibility(0),
fDeclaration(false)
{
@ -334,6 +335,13 @@ DIEDeclaredType::AbstractOrigin() const
}
DebugInfoEntry*
DIEDeclaredType::SignatureType() const
{
return fSignatureType;
}
bool
DIEDeclaredType::IsDeclaration() const
{
@ -377,6 +385,15 @@ DIEDeclaredType::AddAttribute_abstract_origin(uint16 attributeName,
}
status_t
DIEDeclaredType::AddAttribute_signature(uint16 attributeName,
const AttributeValue& value)
{
fSignatureType = value.reference;
return B_OK;
}
DeclarationLocation*
DIEDeclaredType::GetDeclarationLocation()
{

View File

@ -281,6 +281,8 @@ public:
virtual const char* Description() const;
virtual DebugInfoEntry* AbstractOrigin() const;
virtual DebugInfoEntry* SignatureType() const;
virtual bool IsDeclaration() const;
virtual status_t AddAttribute_accessibility(uint16 attributeName,
@ -296,6 +298,8 @@ public:
uint16 attributeName,
const AttributeValue& value);
// TODO: !interface
virtual status_t AddAttribute_signature(uint16 attributeName,
const AttributeValue& value);
// TODO:
// DW_AT_visibility // !interface
@ -307,6 +311,7 @@ protected:
const char* fDescription;
DeclarationLocation fDeclarationLocation;
DebugInfoEntry* fAbstractOrigin;
DebugInfoEntry* fSignatureType;
uint8 fAccessibility;
bool fDeclaration;
};

View File

@ -1,6 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2013, Rene Gollent, rene@gollent.com.
* Copyright 2013-2014, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
@ -95,6 +95,13 @@ DebugInfoEntry::AbstractOrigin() const
}
DebugInfoEntry*
DebugInfoEntry::SignatureType() const
{
return NULL;
}
LocationDescription*
DebugInfoEntry::GetLocationDescription()
{

View File

@ -1,6 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2013, Rene Gollent, rene@gollent.com.
* Copyright 2013-2014, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef DEBUG_INFO_ENTRY_H
@ -61,6 +61,7 @@ public:
virtual const char* Description() const;
virtual DebugInfoEntry* Specification() const;
virtual DebugInfoEntry* AbstractOrigin() const;
virtual DebugInfoEntry* SignatureType() const;
virtual LocationDescription* GetLocationDescription();
bool GetDeclarationFile(uint32& _file) const;

View File

@ -1,6 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2013, Rene Gollent, rene@gollent.com.
* Copyright 2013-2014, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef DWARF_UTILS_H
@ -61,6 +61,14 @@ DwarfUtils::GetDIEByPredicate(EntryType* entry, const Predicate& predicate)
return entry;
}
// try the type unit signature
if (EntryType* signature = dynamic_cast<EntryType*>(
entry->SignatureType())) {
entry = signature;
if (predicate(entry))
return entry;
}
return NULL;
}