* More work on the type debug info entry classes.

* New base classes for other entries handling common attributes.
* Annotated all classes with their missing attributes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31056 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-06-15 00:42:03 +00:00
parent 70e5aac875
commit d49c767c5e
5 changed files with 955 additions and 98 deletions

View File

@ -73,6 +73,45 @@ struct DynamicAttributeValue {
};
struct ConstantAttributeValue {
union {
uint64 constant;
const char* string;
struct {
const void* data;
dwarf_size_t length;
} block;
};
uint8 attributeClass;
ConstantAttributeValue()
:
attributeClass(ATTRIBUTE_CLASS_CONSTANT)
{
this->constant = 0;
}
void SetTo(uint64 constant)
{
this->constant = constant;
attributeClass = ATTRIBUTE_CLASS_CONSTANT;
}
void SetTo(const char* string)
{
this->string = string;
attributeClass = ATTRIBUTE_CLASS_STRING;
}
void SetTo(const void* data, dwarf_size_t length)
{
block.data = data;
block.length = length;
attributeClass = ATTRIBUTE_CLASS_BLOCK;
}
};
struct DeclarationLocation {
uint32 file;
uint32 line;

View File

@ -241,7 +241,7 @@ DIEModifiedType::AddAttribute_type(uint16 attributeName,
const AttributeValue& value)
{
fType = dynamic_cast<DIEType*>(value.reference);
return B_OK;
return fType != NULL ? B_OK : B_BAD_DATA;
}
@ -270,6 +270,7 @@ DIEAddressingType::AddAttribute_address_class(uint16 attributeName,
DIEDeclaredType::DIEDeclaredType()
:
fDescription(NULL),
fAbstractOrigin(NULL),
fAccessibility(0),
fDeclaration(false)
@ -277,30 +278,10 @@ DIEDeclaredType::DIEDeclaredType()
}
status_t
DIEDeclaredType::AddAttribute_decl_file(uint16 attributeName,
const AttributeValue& value)
const char*
DIEDeclaredType::Description() const
{
fDeclarationLocation.SetFile(value.constant);
return B_OK;
}
status_t
DIEDeclaredType::AddAttribute_decl_line(uint16 attributeName,
const AttributeValue& value)
{
fDeclarationLocation.SetLine(value.constant);
return B_OK;
}
status_t
DIEDeclaredType::AddAttribute_decl_column(uint16 attributeName,
const AttributeValue& value)
{
fDeclarationLocation.SetColumn(value.constant);
return B_OK;
return fDescription;
}
@ -322,6 +303,15 @@ DIEDeclaredType::AddAttribute_declaration(uint16 attributeName,
}
status_t
DIEDeclaredType::AddAttribute_description(uint16 attributeName,
const AttributeValue& value)
{
fDescription = value.string;
return B_OK;
}
status_t
DIEDeclaredType::AddAttribute_abstract_origin(uint16 attributeName,
const AttributeValue& value)
@ -331,6 +321,13 @@ DIEDeclaredType::AddAttribute_abstract_origin(uint16 attributeName,
}
DeclarationLocation*
DIEDeclaredType::GetDeclarationLocation()
{
return &fDeclarationLocation;
}
// #pragma mark - DIEDerivedType
@ -346,7 +343,7 @@ DIEDerivedType::AddAttribute_type(uint16 attributeName,
const AttributeValue& value)
{
fType = dynamic_cast<DIEType*>(value.reference);
return B_OK;
return fType != NULL ? B_OK : B_BAD_DATA;
}
@ -356,10 +353,25 @@ DIEDerivedType::AddAttribute_type(uint16 attributeName,
DIECompoundType::DIECompoundType()
:
fSpecification(NULL)
{
}
status_t
DIECompoundType::AddChild(DebugInfoEntry* child)
{
if (child->Tag() == DW_TAG_member) {
// TODO: Not for interfaces!
fDataMembers.Add(child);
return B_OK;
}
return DIEDeclaredType::AddChild(child);
}
status_t
DIECompoundType::AddAttribute_byte_size(uint16 attributeName,
const AttributeValue& value)
@ -368,6 +380,15 @@ DIECompoundType::AddAttribute_byte_size(uint16 attributeName,
}
status_t
DIECompoundType::AddAttribute_specification(uint16 attributeName,
const AttributeValue& value)
{
fSpecification = dynamic_cast<DIECompoundType*>(value.reference);
return fSpecification != NULL ? B_OK : B_BAD_DATA;
}
// #pragma mark - DIEClassBaseType
@ -376,11 +397,158 @@ DIEClassBaseType::DIEClassBaseType()
}
status_t
DIEClassBaseType::AddChild(DebugInfoEntry* child)
{
switch (child->Tag()) {
case DW_TAG_inheritance:
fDataMembers.Add(child);
return B_OK;
case DW_TAG_friend:
fFriends.Add(child);
return B_OK;
case DW_TAG_access_declaration:
fAccessDeclarations.Add(child);
return B_OK;
case DW_TAG_subprogram:
fMemberFunctions.Add(child);
return B_OK;
// TODO: Templates!
// TODO: Variants!
default:
return DIECompoundType::AddChild(child);
}
}
// #pragma mark - DIENamedBase
DIENamedBase::DIENamedBase()
:
fName(NULL),
fDescription(NULL)
{
}
const char*
DIENamedBase::Name() const
{
return fName;
}
const char*
DIENamedBase::Description() const
{
return fDescription;
}
status_t
DIENamedBase::AddAttribute_name(uint16 attributeName,
const AttributeValue& value)
{
fName = value.string;
return B_OK;
}
status_t
DIENamedBase::AddAttribute_description(uint16 attributeName,
const AttributeValue& value)
{
fDescription = value.string;
return B_OK;
}
// #pragma mark - DIEDeclaredBase
DIEDeclaredBase::DIEDeclaredBase()
{
}
DeclarationLocation*
DIEDeclaredBase::GetDeclarationLocation()
{
return &fDeclarationLocation;
}
// #pragma mark - DIEDeclaredNamedBase
DIEDeclaredNamedBase::DIEDeclaredNamedBase()
:
fName(NULL),
fDescription(NULL),
fAccessibility(0),
fVisibility(0),
fDeclaration(false)
{
}
const char*
DIEDeclaredNamedBase::Name() const
{
return fName;
}
const char*
DIEDeclaredNamedBase::Description() const
{
return fDescription;
}
status_t
DIEDeclaredNamedBase::AddAttribute_name(uint16 attributeName,
const AttributeValue& value)
{
fName = value.string;
return B_OK;
}
status_t
DIEDeclaredNamedBase::AddAttribute_description(uint16 attributeName,
const AttributeValue& value)
{
fDescription = value.string;
return B_OK;
}
status_t
DIEDeclaredNamedBase::AddAttribute_accessibility(uint16 attributeName,
const AttributeValue& value)
{
fAccessibility = value.constant;
return B_OK;
}
status_t
DIEDeclaredNamedBase::AddAttribute_declaration(uint16 attributeName,
const AttributeValue& value)
{
fDeclaration = value.flag;
return B_OK;
}
// #pragma mark - DIEArrayType
DIEArrayType::DIEArrayType()
:
fSpecification(NULL),
fOrdering(DW_ORD_row_major)
{
}
@ -448,6 +616,15 @@ DIEArrayType::AddAttribute_byte_size(uint16 attributeName,
}
status_t
DIEArrayType::AddAttribute_specification(uint16 attributeName,
const AttributeValue& value)
{
fSpecification = dynamic_cast<DIEArrayType*>(value.reference);
return fSpecification != NULL ? B_OK : B_BAD_DATA;
}
// #pragma mark - DIEClassType
@ -482,6 +659,8 @@ DIEEntryPoint::Tag() const
DIEEnumerationType::DIEEnumerationType()
:
fSpecification(NULL)
{
}
@ -493,6 +672,51 @@ DIEEnumerationType::Tag() const
}
status_t
DIEEnumerationType::AddChild(DebugInfoEntry* child)
{
if (child->Tag() == DW_TAG_enumerator) {
fEnumerators.Add(child);
return B_OK;
}
return DIEDerivedType::AddChild(child);
}
status_t
DIEEnumerationType::AddAttribute_bit_stride(uint16 attributeName,
const AttributeValue& value)
{
return SetDynamicAttributeValue(fBitStride, value);
}
status_t
DIEEnumerationType::AddAttribute_byte_size(uint16 attributeName,
const AttributeValue& value)
{
return SetDynamicAttributeValue(fByteSize, value);
}
status_t
DIEEnumerationType::AddAttribute_byte_stride(uint16 attributeName,
const AttributeValue& value)
{
return SetDynamicAttributeValue(fByteStride, value);
}
status_t
DIEEnumerationType::AddAttribute_specification(uint16 attributeName,
const AttributeValue& value)
{
fSpecification = dynamic_cast<DIEEnumerationType*>(value.reference);
return fSpecification != NULL ? B_OK : B_BAD_DATA;
}
// #pragma mark - DIEFormalParameter
@ -572,6 +796,8 @@ DIEMember::Tag() const
DIEPointerType::DIEPointerType()
:
fSpecification(NULL)
{
}
@ -583,6 +809,15 @@ DIEPointerType::Tag() const
}
status_t
DIEPointerType::AddAttribute_specification(uint16 attributeName,
const AttributeValue& value)
{
fSpecification = dynamic_cast<DIEPointerType*>(value.reference);
return fSpecification != NULL ? B_OK : B_BAD_DATA;
}
// #pragma mark - DIEReferenceType
@ -628,6 +863,14 @@ DIEStringType::Tag() const
}
status_t
DIEStringType::AddAttribute_byte_size(uint16 attributeName,
const AttributeValue& value)
{
return SetDynamicAttributeValue(fByteSize, value);
}
// #pragma mark - DIEStructureType
@ -647,6 +890,10 @@ DIEStructureType::Tag() const
DIESubroutineType::DIESubroutineType()
:
fReturnType(NULL),
fAddressClass(0),
fPrototyped(false)
{
}
@ -658,6 +905,48 @@ DIESubroutineType::Tag() const
}
status_t
DIESubroutineType::AddChild(DebugInfoEntry* child)
{
switch (child->Tag()) {
case DW_TAG_formal_parameter:
case DW_TAG_unspecified_parameters:
fParameters.Add(child);
return B_OK;
default:
return DIEDeclaredType::AddChild(child);
}
}
status_t
DIESubroutineType::AddAttribute_address_class(uint16 attributeName,
const AttributeValue& value)
{
// TODO: How is the address class handled?
fAddressClass = value.constant;
return B_OK;
}
status_t
DIESubroutineType::AddAttribute_prototyped(uint16 attributeName,
const AttributeValue& value)
{
fPrototyped = value.flag;
return B_OK;
}
status_t
DIESubroutineType::AddAttribute_type(uint16 attributeName,
const AttributeValue& value)
{
fReturnType = dynamic_cast<DIEType*>(value.reference);
return fReturnType != NULL ? B_OK : B_BAD_DATA;
}
// #pragma mark - DIETypedef
@ -797,6 +1086,9 @@ DIEModule::Tag() const
DIEPointerToMemberType::DIEPointerToMemberType()
:
fContainingType(NULL),
fAddressClass(0)
{
}
@ -808,6 +1100,25 @@ DIEPointerToMemberType::Tag() const
}
status_t
DIEPointerToMemberType::AddAttribute_address_class(uint16 attributeName,
const AttributeValue& value)
{
// TODO: How is the address class handled?
fAddressClass = value.constant;
return B_OK;
}
status_t
DIEPointerToMemberType::AddAttribute_containing_type(uint16 attributeName,
const AttributeValue& value)
{
fContainingType = dynamic_cast<DIECompoundType*>(value.reference);
return fContainingType != NULL ? B_OK : B_BAD_DATA;
}
// #pragma mark - DIESetType
@ -823,10 +1134,20 @@ DIESetType::Tag() const
}
status_t
DIESetType::AddAttribute_byte_size(uint16 attributeName,
const AttributeValue& value)
{
return SetDynamicAttributeValue(fByteSize, value);
}
// #pragma mark - DIESubrangeType
DIESubrangeType::DIESubrangeType()
:
fThreadsScaled(false)
{
}
@ -838,6 +1159,63 @@ DIESubrangeType::Tag() const
}
status_t
DIESubrangeType::AddAttribute_bit_stride(uint16 attributeName,
const AttributeValue& value)
{
return SetDynamicAttributeValue(fBitStride, value);
}
status_t
DIESubrangeType::AddAttribute_byte_size(uint16 attributeName,
const AttributeValue& value)
{
return SetDynamicAttributeValue(fByteSize, value);
}
status_t
DIESubrangeType::AddAttribute_byte_stride(uint16 attributeName,
const AttributeValue& value)
{
return SetDynamicAttributeValue(fByteStride, value);
}
status_t
DIESubrangeType::AddAttribute_count(uint16 attributeName,
const AttributeValue& value)
{
return SetDynamicAttributeValue(fCount, value);
}
status_t
DIESubrangeType::AddAttribute_lower_bound(uint16 attributeName,
const AttributeValue& value)
{
return SetDynamicAttributeValue(fLowerBound, value);
}
status_t
DIESubrangeType::AddAttribute_upper_bound(uint16 attributeName,
const AttributeValue& value)
{
return SetDynamicAttributeValue(fUpperBound, value);
}
status_t
DIESubrangeType::AddAttribute_threads_scaled(uint16 attributeName,
const AttributeValue& value)
{
fThreadsScaled = value.flag;
return B_OK;
}
// #pragma mark - DIEWithStatement
@ -988,6 +1366,14 @@ DIEEnumerator::Tag() const
}
status_t
DIEEnumerator::AddAttribute_const_value(uint16 attributeName,
const AttributeValue& value)
{
return SetConstantAttributeValue(fValue, value);
}
// #pragma mark - DIEFileType
@ -1003,6 +1389,14 @@ DIEFileType::Tag() const
}
status_t
DIEFileType::AddAttribute_byte_size(uint16 attributeName,
const AttributeValue& value)
{
return SetDynamicAttributeValue(fByteSize, value);
}
// #pragma mark - DIEFriend

View File

@ -238,7 +238,7 @@ public:
const AttributeValue& value);
protected:
uint64 fAddressClass;
uint8 fAddressClass;
};
@ -246,28 +246,30 @@ class DIEDeclaredType : public DIEType {
public:
DIEDeclaredType();
virtual status_t AddAttribute_decl_file(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_decl_line(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_decl_column(uint16 attributeName,
const AttributeValue& value);
virtual const char* Description() const;
virtual status_t AddAttribute_accessibility(uint16 attributeName,
const AttributeValue& value);
// TODO: !file, !pointer to member
virtual status_t AddAttribute_declaration(uint16 attributeName,
const AttributeValue& value);
// TODO: !file
virtual status_t AddAttribute_description(uint16 attributeName,
const AttributeValue& value);
// TODO: !interface
virtual status_t AddAttribute_abstract_origin(
uint16 attributeName,
const AttributeValue& value);
// TODO: !interface
// TODO:
// DW_AT_description // !interface
// DW_AT_visibility // !interface
protected:
virtual DeclarationLocation* GetDeclarationLocation();
protected:
const char* fDescription;
DeclarationLocation fDeclarationLocation;
DebugInfoEntry* fAbstractOrigin;
uint8 fAccessibility;
@ -291,15 +293,19 @@ class DIECompoundType : public DIEDeclaredType {
public:
DIECompoundType();
virtual status_t AddChild(DebugInfoEntry* child);
virtual status_t AddAttribute_byte_size(uint16 attributeName,
const AttributeValue& value);
// TODO: !interface
// TODO:
// DW_AT_specification // !interface
virtual status_t AddAttribute_specification(uint16 attributeName,
const AttributeValue& value);
// TODO: !interface
protected:
DynamicAttributeValue fByteSize;
DIECompoundType* fSpecification;
DebugInfoEntryList fDataMembers;
};
@ -307,10 +313,70 @@ class DIEClassBaseType : public DIECompoundType {
public:
DIEClassBaseType();
virtual status_t AddChild(DebugInfoEntry* child);
protected:
DebugInfoEntryList fBaseTypes;
DebugInfoEntryList fFriends;
DebugInfoEntryList fAccessDeclarations;
DebugInfoEntryList fMemberFunctions;
};
class DIENamedBase : public DebugInfoEntry {
public:
DIENamedBase();
virtual const char* Name() const;
virtual const char* Description() const;
virtual status_t AddAttribute_name(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_description(uint16 attributeName,
const AttributeValue& value);
protected:
const char* fName;
const char* fDescription;
};
class DIEDeclaredBase : public DebugInfoEntry {
public:
DIEDeclaredBase();
protected:
virtual DeclarationLocation* GetDeclarationLocation();
protected:
DeclarationLocation fDeclarationLocation;
};
class DIEDeclaredNamedBase : public DIEDeclaredBase {
public:
DIEDeclaredNamedBase();
virtual const char* Name() const;
virtual const char* Description() const;
virtual status_t AddAttribute_name(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_description(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_accessibility(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_declaration(uint16 attributeName,
const AttributeValue& value);
protected:
const char* fName;
const char* fDescription;
uint8 fAccessibility;
uint8 fVisibility;
bool fDeclaration;
};
// #pragma mark -
@ -334,14 +400,14 @@ public:
const AttributeValue& value);
virtual status_t AddAttribute_byte_size(uint16 attributeName,
const AttributeValue& value);
// TODO:
// DW_AT_specification
virtual status_t AddAttribute_specification(uint16 attributeName,
const AttributeValue& value);
private:
DynamicAttributeValue fBitStride;
DynamicAttributeValue fByteSize;
DebugInfoEntryList fDimensions;
DIEArrayType* fSpecification;
uint8 fOrdering;
};
@ -359,6 +425,17 @@ public:
DIEEntryPoint();
virtual uint16 Tag() const;
// TODO:
// DW_AT_address_class
// DW_AT_description
// DW_AT_frame_base
// DW_AT_low_pc
// DW_AT_name
// DW_AT_return_addr
// DW_AT_segment
// DW_AT_static_link
// DW_AT_type
};
@ -368,51 +445,101 @@ public:
virtual uint16 Tag() const;
// TODO:
// DW_AT_bit_stride
// DW_AT_byte_size
// DW_AT_byte_stride
// DW_AT_specification
virtual status_t AddChild(DebugInfoEntry* child);
virtual status_t AddAttribute_bit_stride(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_byte_size(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_byte_stride(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_specification(uint16 attributeName,
const AttributeValue& value);
private:
DynamicAttributeValue fBitStride;
DynamicAttributeValue fByteSize;
DynamicAttributeValue fByteStride;
DIEEnumerationType* fSpecification;
DebugInfoEntryList fEnumerators;
};
class DIEFormalParameter : public DebugInfoEntry {
class DIEFormalParameter : public DIEDeclaredNamedBase {
public:
DIEFormalParameter();
virtual uint16 Tag() const;
// TODO:
// DW_AT_abstract_origin
// DW_AT_artificial
// DW_AT_const_value
// DW_AT_default_value
// DW_AT_endianity
// DW_AT_is_optional
// DW_AT_location
// DW_AT_segment
// DW_AT_type
// DW_AT_variable_parameter
};
class DIEImportedDeclaration : public DebugInfoEntry {
class DIEImportedDeclaration : public DIEDeclaredNamedBase {
public:
DIEImportedDeclaration();
virtual uint16 Tag() const;
// TODO:
// DW_AT_import
// DW_AT_start_scope
};
class DIELabel : public DebugInfoEntry {
class DIELabel : public DIEDeclaredNamedBase {
public:
DIELabel();
virtual uint16 Tag() const;
// TODO:
// DW_AT_abstract_origin
// DW_AT_low_pc
// DW_AT_segment
// DW_AT_start_scope
};
class DIELexicalBlock : public DebugInfoEntry {
class DIELexicalBlock : public DIENamedBase {
public:
DIELexicalBlock();
virtual uint16 Tag() const;
// TODO:
// DW_AT_abstract_origin
// DW_AT_high_pc
// DW_AT_low_pc
// DW_AT_ranges
// DW_AT_segment
};
class DIEMember : public DebugInfoEntry {
class DIEMember : public DIEDeclaredNamedBase {
public:
DIEMember();
virtual uint16 Tag() const;
// TODO:
// DW_AT_bit_offset
// DW_AT_bit_size
// DW_AT_byte_size
// DW_AT_data_member_location
// DW_AT_mutable
// DW_AT_type
};
@ -422,8 +549,11 @@ public:
virtual uint16 Tag() const;
// TODO:
// DW_AT_specification
virtual status_t AddAttribute_specification(uint16 attributeName,
const AttributeValue& value);
private:
DIEPointerType* fSpecification;
};
@ -449,8 +579,12 @@ public:
virtual uint16 Tag() const;
virtual status_t AddAttribute_byte_size(uint16 attributeName,
const AttributeValue& value);
private:
DynamicAttributeValue fByteSize;
// TODO:
// DW_AT_byte_size
// DW_AT_string_length
};
@ -469,10 +603,20 @@ public:
virtual uint16 Tag() const;
// TODO:
// DW_AT_address_class
// DW_AT_prototyped
// DW_AT_type
virtual status_t AddChild(DebugInfoEntry* child);
virtual status_t AddAttribute_address_class(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_prototyped(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_type(uint16 attributeName,
const AttributeValue& value);
protected:
DebugInfoEntryList fParameters;
DIEType* fReturnType;
uint8 fAddressClass;
bool fPrototyped;
};
@ -492,43 +636,70 @@ public:
};
class DIEUnspecifiedParameters : public DebugInfoEntry {
class DIEUnspecifiedParameters : public DIEDeclaredBase {
public:
DIEUnspecifiedParameters();
virtual uint16 Tag() const;
// TODO:
// DW_AT_abstract_origin
// DW_AT_artificial
};
class DIEVariant : public DebugInfoEntry {
class DIEVariant : public DIEDeclaredBase {
public:
DIEVariant();
virtual uint16 Tag() const;
// TODO:
// DW_AT_accessibility
// DW_AT_abstract_origin
// DW_AT_declaration
// DW_AT_discr_list
// DW_AT_discr_value
};
class DIECommonBlock : public DebugInfoEntry {
class DIECommonBlock : public DIEDeclaredNamedBase {
public:
DIECommonBlock();
virtual uint16 Tag() const;
// TODO:
// DW_AT_location
// DW_AT_segment
};
class DIECommonInclusion : public DebugInfoEntry {
class DIECommonInclusion : public DIEDeclaredBase {
public:
DIECommonInclusion();
virtual uint16 Tag() const;
// TODO:
// DW_AT_common_reference
// DW_AT_declaration
// DW_AT_visibility
};
class DIEInheritance : public DebugInfoEntry {
class DIEInheritance : public DIEDeclaredBase {
public:
DIEInheritance();
virtual uint16 Tag() const;
// TODO:
// DW_AT_accessibility
// DW_AT_data_member_location
// DW_AT_type
// DW_AT_virtuality
};
@ -537,14 +708,37 @@ public:
DIEInlinedSubroutine();
virtual uint16 Tag() const;
// TODO:
// DW_AT_abstract_origin
// DW_AT_call_column
// DW_AT_call_file
// DW_AT_call_line
// DW_AT_entry_pc
// DW_AT_high_pc
// DW_AT_low_pc
// DW_AT_ranges
// DW_AT_return_addr
// DW_AT_segment
// DW_AT_start_scope
// DW_AT_trampoline
};
class DIEModule : public DebugInfoEntry {
class DIEModule : public DIEDeclaredNamedBase {
public:
DIEModule();
virtual uint16 Tag() const;
// TODO:
// DW_AT_entry_pc
// DW_AT_high_pc
// DW_AT_low_pc
// DW_AT_priority
// DW_AT_ranges
// DW_AT_segment
// DW_AT_specification
};
@ -554,9 +748,16 @@ public:
virtual uint16 Tag() const;
virtual status_t AddAttribute_address_class(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_containing_type(
uint16 attributeName,
const AttributeValue& value);
protected:
DIECompoundType* fContainingType;
uint8 fAddressClass;
// TODO:
// DW_AT_address_class
// DW_AT_containing_type
// DW_AT_use_location
};
@ -567,8 +768,11 @@ public:
virtual uint16 Tag() const;
// TODO:
// DW_AT_byte_size
virtual status_t AddAttribute_byte_size(uint16 attributeName,
const AttributeValue& value);
private:
DynamicAttributeValue fByteSize;
};
@ -578,14 +782,29 @@ public:
virtual uint16 Tag() const;
// TODO:
// DW_AT_bit_stride
// DW_AT_byte_size
// DW_AT_byte_stride
// DW_AT_count
// DW_AT_lower_bound
// DW_AT_threads_scaled
// DW_AT_upper_bound
virtual status_t AddAttribute_bit_stride(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_byte_size(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_byte_stride(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_count(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_lower_bound(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_upper_bound(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_threads_scaled(uint16 attributeName,
const AttributeValue& value);
private:
DynamicAttributeValue fBitStride;
DynamicAttributeValue fByteSize;
DynamicAttributeValue fByteStride;
DynamicAttributeValue fCount;
DynamicAttributeValue fLowerBound;
DynamicAttributeValue fUpperBound;
bool fThreadsScaled;
};
@ -594,10 +813,22 @@ public:
DIEWithStatement();
virtual uint16 Tag() const;
// TODO:
// DW_AT_accessibility
// DW_AT_address_class
// DW_AT_declaration
// DW_AT_high_pc
// DW_AT_location
// DW_AT_low_pc
// DW_AT_ranges
// DW_AT_segment
// DW_AT_type
// DW_AT_visibility
};
class DIEAccessDeclaration : public DebugInfoEntry {
class DIEAccessDeclaration : public DIEDeclaredNamedBase {
public:
DIEAccessDeclaration();
@ -645,6 +876,13 @@ public:
DIECatchBlock();
virtual uint16 Tag() const;
// TODO:
// DW_AT_abstract_origin
// DW_AT_high_pc
// DW_AT_low_pc
// DW_AT_ranges
// DW_AT_segment
};
@ -656,19 +894,32 @@ public:
};
class DIEConstant : public DebugInfoEntry {
class DIEConstant : public DIEDeclaredNamedBase {
public:
DIEConstant();
virtual uint16 Tag() const;
// TODO:
// DW_AT_const_value
// DW_AT_endianity
// DW_AT_external
// DW_AT_start_scope
// DW_AT_type
};
class DIEEnumerator : public DebugInfoEntry {
class DIEEnumerator : public DIEDeclaredNamedBase {
public:
DIEEnumerator();
virtual uint16 Tag() const;
virtual status_t AddAttribute_const_value(uint16 attributeName,
const AttributeValue& value);
private:
ConstantAttributeValue fValue;
};
@ -678,32 +929,45 @@ public:
virtual uint16 Tag() const;
// TODO:
// DW_AT_byte_size
virtual status_t AddAttribute_byte_size(uint16 attributeName,
const AttributeValue& value);
private:
DynamicAttributeValue fByteSize;
};
class DIEFriend : public DebugInfoEntry {
class DIEFriend : public DIEDeclaredBase {
public:
DIEFriend();
virtual uint16 Tag() const;
// TODO:
// DW_AT_abstract_origin
// DW_AT_friend
};
class DIENameList : public DebugInfoEntry {
class DIENameList : public DIEDeclaredNamedBase {
public:
DIENameList();
virtual uint16 Tag() const;
// TODO:
// DW_AT_abstract_origin
};
class DIENameListItem : public DebugInfoEntry {
class DIENameListItem : public DIEDeclaredBase {
public:
DIENameListItem();
virtual uint16 Tag() const;
// TODO:
// DW_AT_namelist_item
};
@ -715,35 +979,76 @@ public:
};
class DIESubprogram : public DebugInfoEntry {
class DIESubprogram : public DIEDeclaredNamedBase {
public:
DIESubprogram();
virtual uint16 Tag() const;
// TODO:
// DW_AT_abstract_origin
// DW_AT_address_class
// DW_AT_artificial
// DW_AT_calling_convention
// DW_AT_elemental
// DW_AT_entry_pc
// DW_AT_explicit
// DW_AT_external
// DW_AT_frame_base
// DW_AT_high_pc
// DW_AT_inline
// DW_AT_low_pc
// DW_AT_object_pointer
// DW_AT_prototyped
// DW_AT_pure
// DW_AT_ranges
// DW_AT_recursive
// DW_AT_return_addr
// DW_AT_segment
// DW_AT_specification
// DW_AT_start_scope
// DW_AT_static_link
// DW_AT_trampoline
// DW_AT_type
// DW_AT_virtuality
// DW_AT_vtable_elem_location
};
class DIETemplateTypeParameter : public DebugInfoEntry {
class DIETemplateTypeParameter : public DIEDeclaredNamedBase {
public:
DIETemplateTypeParameter();
virtual uint16 Tag() const;
// TODO:
// DW_AT_type
};
class DIETemplateValueParameter : public DebugInfoEntry {
class DIETemplateValueParameter : public DIEDeclaredNamedBase {
public:
DIETemplateValueParameter();
virtual uint16 Tag() const;
// TODO:
// DW_AT_const_value
// DW_AT_type
};
class DIEThrownType : public DebugInfoEntry {
class DIEThrownType : public DIEDeclaredBase {
public:
DIEThrownType();
virtual uint16 Tag() const;
// TODO:
// DW_AT_allocated
// DW_AT_associated
// DW_AT_data_location
// DW_AT_type
};
@ -752,22 +1057,47 @@ public:
DIETryBlock();
virtual uint16 Tag() const;
// TODO:
// DW_AT_abstract_origin
// DW_AT_high_pc
// DW_AT_low_pc
// DW_AT_ranges
// DW_AT_segment
};
class DIEVariantPart : public DebugInfoEntry {
class DIEVariantPart : public DIEDeclaredBase {
public:
DIEVariantPart();
virtual uint16 Tag() const;
// TODO:
// DW_AT_abstract_origin
// DW_AT_accessibility
// DW_AT_declaration
// DW_AT_discr
// DW_AT_type
};
class DIEVariable : public DebugInfoEntry {
class DIEVariable : public DIEDeclaredNamedBase {
public:
DIEVariable();
virtual uint16 Tag() const;
// TODO:
// DW_AT_abstract_origin
// DW_AT_const_value
// DW_AT_endianity
// DW_AT_external
// DW_AT_location
// DW_AT_segment
// DW_AT_specification
// DW_AT_start_scope
// DW_AT_type
};
@ -794,6 +1124,9 @@ public:
DIEDwarfProcedure();
virtual uint16 Tag() const;
// TODO:
// DW_AT_location
};
@ -813,19 +1146,27 @@ public:
};
class DIENamespace : public DebugInfoEntry {
class DIENamespace : public DIEDeclaredNamedBase {
public:
DIENamespace();
virtual uint16 Tag() const;
// TODO:
// DW_AT_extension
// DW_AT_start_scope
};
class DIEImportedModule : public DebugInfoEntry {
class DIEImportedModule : public DIEDeclaredBase {
public:
DIEImportedModule();
virtual uint16 Tag() const;
// TODO:
// DW_AT_import
// DW_AT_start_scope
};
@ -866,10 +1207,13 @@ public:
DIEImportedUnit();
virtual uint16 Tag() const;
// TODO:
// DW_AT_import
};
class DIECondition : public DebugInfoEntry {
class DIECondition : public DIEDeclaredNamedBase {
public:
DIECondition();
@ -877,7 +1221,6 @@ public:
};
class DIESharedType : public DIEModifiedType {
public:
DIESharedType();

View File

@ -58,6 +58,13 @@ DebugInfoEntry::Name() const
}
const char*
DebugInfoEntry::Description() const
{
return NULL;
}
status_t
DebugInfoEntry::AddChild(DebugInfoEntry* child)
{
@ -66,6 +73,45 @@ DebugInfoEntry::AddChild(DebugInfoEntry* child)
}
status_t
DebugInfoEntry::AddAttribute_decl_file(uint16 attributeName,
const AttributeValue& value)
{
if (DeclarationLocation* location = GetDeclarationLocation()) {
location->SetFile(value.constant);
return B_OK;
}
return ATTRIBUTE_NOT_HANDLED;
}
status_t
DebugInfoEntry::AddAttribute_decl_line(uint16 attributeName,
const AttributeValue& value)
{
if (DeclarationLocation* location = GetDeclarationLocation()) {
location->SetLine(value.constant);
return B_OK;
}
return ATTRIBUTE_NOT_HANDLED;
}
status_t
DebugInfoEntry::AddAttribute_decl_column(uint16 attributeName,
const AttributeValue& value)
{
if (DeclarationLocation* location = GetDeclarationLocation()) {
location->SetColumn(value.constant);
return B_OK;
}
return ATTRIBUTE_NOT_HANDLED;
}
status_t
DebugInfoEntry::AddAttribute_sibling(uint16 attributeName,
const AttributeValue& value)
@ -113,9 +159,6 @@ DEFINE_DEBUG_INFO_ENTRY_ATTR_SETTER(base_types)
DEFINE_DEBUG_INFO_ENTRY_ATTR_SETTER(calling_convention)
DEFINE_DEBUG_INFO_ENTRY_ATTR_SETTER(count)
DEFINE_DEBUG_INFO_ENTRY_ATTR_SETTER(data_member_location)
DEFINE_DEBUG_INFO_ENTRY_ATTR_SETTER(decl_column)
DEFINE_DEBUG_INFO_ENTRY_ATTR_SETTER(decl_file)
DEFINE_DEBUG_INFO_ENTRY_ATTR_SETTER(decl_line)
DEFINE_DEBUG_INFO_ENTRY_ATTR_SETTER(declaration)
DEFINE_DEBUG_INFO_ENTRY_ATTR_SETTER(discr_list)
DEFINE_DEBUG_INFO_ENTRY_ATTR_SETTER(encoding)
@ -163,6 +206,13 @@ DEFINE_DEBUG_INFO_ENTRY_ATTR_SETTER(pure)
DEFINE_DEBUG_INFO_ENTRY_ATTR_SETTER(recursive)
DeclarationLocation*
DebugInfoEntry::GetDeclarationLocation()
{
return NULL;
}
status_t
DebugInfoEntry::SetDynamicAttributeValue(DynamicAttributeValue& toSet,
const AttributeValue& value)
@ -181,3 +231,23 @@ DebugInfoEntry::SetDynamicAttributeValue(DynamicAttributeValue& toSet,
return B_BAD_DATA;
}
}
status_t
DebugInfoEntry::SetConstantAttributeValue(ConstantAttributeValue& toSet,
const AttributeValue& value)
{
switch (value.attributeClass) {
case ATTRIBUTE_CLASS_CONSTANT:
toSet.SetTo(value.constant);
return B_OK;
case ATTRIBUTE_CLASS_STRING:
toSet.SetTo(value.string);
return B_OK;
case ATTRIBUTE_CLASS_BLOCK:
toSet.SetTo(value.block.data, value.block.length);
return B_OK;
default:
return B_BAD_DATA;
}
}

View File

@ -21,6 +21,8 @@ enum {
class AttributeValue;
class ConstantAttributeValue;
class DeclarationLocation;
class DynamicAttributeValue;
struct SourceLanguageInfo;
@ -45,9 +47,16 @@ public:
virtual bool IsType() const;
virtual const char* Name() const;
virtual const char* Description() const;
virtual status_t AddChild(DebugInfoEntry* child);
virtual status_t AddAttribute_decl_file(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_decl_line(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_decl_column(uint16 attributeName,
const AttributeValue& value);
virtual status_t AddAttribute_sibling(uint16 attributeName,
const AttributeValue& value);
@ -90,9 +99,6 @@ public:
DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(calling_convention)
DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(count)
DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(data_member_location)
DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(decl_column)
DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(decl_file)
DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(decl_line)
DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(declaration)
DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(discr_list)
DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(encoding)
@ -140,9 +146,14 @@ public:
DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(recursive)
protected:
virtual DeclarationLocation* GetDeclarationLocation();
status_t SetDynamicAttributeValue(
DynamicAttributeValue& toSet,
const AttributeValue& value);
status_t SetConstantAttributeValue(
ConstantAttributeValue& toSet,
const AttributeValue& value);
};