diff --git a/src/apps/debugger/dwarf/DebugInfoEntries.cpp b/src/apps/debugger/dwarf/DebugInfoEntries.cpp index 9af863feb3..dbc7509dc9 100644 --- a/src/apps/debugger/dwarf/DebugInfoEntries.cpp +++ b/src/apps/debugger/dwarf/DebugInfoEntries.cpp @@ -620,6 +620,45 @@ DIEDeclaredNamedBase::AddAttribute_declaration(uint16 attributeName, } +// #pragma mark - DIEArrayIndexType + + +DIEArrayIndexType::DIEArrayIndexType() +{ +} + + +const DynamicAttributeValue* +DIEArrayIndexType::ByteSize() const +{ + return &fByteSize; +} + + +status_t +DIEArrayIndexType::AddAttribute_bit_stride(uint16 attributeName, + const AttributeValue& value) +{ + return SetDynamicAttributeValue(fBitStride, value); +} + + +status_t +DIEArrayIndexType::AddAttribute_byte_size(uint16 attributeName, + const AttributeValue& value) +{ + return SetDynamicAttributeValue(fByteSize, value); +} + + +status_t +DIEArrayIndexType::AddAttribute_byte_stride(uint16 attributeName, + const AttributeValue& value) +{ + return SetDynamicAttributeValue(fByteStride, value); +} + + // #pragma mark - DIEArrayType @@ -770,13 +809,6 @@ DIEEnumerationType::Specification() const } -const DynamicAttributeValue* -DIEEnumerationType::ByteSize() const -{ - return &fByteSize; -} - - status_t DIEEnumerationType::AddChild(DebugInfoEntry* child) { @@ -789,30 +821,6 @@ DIEEnumerationType::AddChild(DebugInfoEntry* 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) @@ -1414,6 +1422,24 @@ DIEPointerToMemberType::AddAttribute_containing_type(uint16 attributeName, } +status_t +DIEPointerToMemberType::AddAttribute_use_location(uint16 attributeName, + const AttributeValue& value) +{ + if (value.attributeClass == ATTRIBUTE_CLASS_LOCLISTPTR) { + fUseLocation.SetToLocationList(value.pointer); + return B_OK; + } + + if (value.attributeClass == ATTRIBUTE_CLASS_BLOCK) { + fUseLocation.SetToExpression(value.block.data, value.block.length); + return B_OK; + } + + return B_BAD_DATA; +} + + // #pragma mark - DIESetType @@ -1461,37 +1487,6 @@ DIESubrangeType::Tag() const } -const DynamicAttributeValue* -DIESubrangeType::ByteSize() const -{ - return &fByteSize; -} - - -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) diff --git a/src/apps/debugger/dwarf/DebugInfoEntries.h b/src/apps/debugger/dwarf/DebugInfoEntries.h index 5cd3af8004..dbbc0b8ff8 100644 --- a/src/apps/debugger/dwarf/DebugInfoEntries.h +++ b/src/apps/debugger/dwarf/DebugInfoEntries.h @@ -42,6 +42,11 @@ // class base: compound +// array index: derived +// DW_AT_bit_stride +// DW_AT_byte_stride +// DW_AT_byte_size + // unspecified: common // DECL @@ -65,10 +70,7 @@ // DW_AT_type -// enumeration: derived -// DW_AT_bit_stride -// DW_AT_byte_size -// DW_AT_byte_stride +// enumeration: array index // DW_AT_specification // pointer to member: derived @@ -79,10 +81,7 @@ // set: derived // DW_AT_byte_size -// subrange: derived -// DW_AT_bit_stride -// DW_AT_byte_size -// DW_AT_byte_stride +// subrange: array index // DW_AT_count // DW_AT_lower_bound // DW_AT_threads_scaled @@ -425,6 +424,31 @@ protected: }; +class DIEArrayIndexType : public DIEDerivedType { +public: + DIEArrayIndexType(); + + virtual const DynamicAttributeValue* ByteSize() const; + + const DynamicAttributeValue* BitStride() const + { return &fBitStride; } + const DynamicAttributeValue* ByteStride() const + { return &fByteStride; } + + 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); + +private: + DynamicAttributeValue fBitStride; + DynamicAttributeValue fByteSize; + DynamicAttributeValue fByteStride; +}; + + // #pragma mark - @@ -441,6 +465,9 @@ public: virtual const DynamicAttributeValue* ByteSize() const; + const DynamicAttributeValue* BitStride() const + { return &fBitStride; } + const DebugInfoEntryList& Dimensions() const { return fDimensions; } @@ -495,7 +522,7 @@ public: }; -class DIEEnumerationType : public DIEDerivedType { +class DIEEnumerationType : public DIEArrayIndexType { public: DIEEnumerationType(); @@ -503,26 +530,15 @@ public: virtual DebugInfoEntry* Specification() const; - virtual const DynamicAttributeValue* ByteSize() const; - const DebugInfoEntryList& Enumerators() const { return fEnumerators; } 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; }; @@ -606,8 +622,8 @@ public: target_addr_t LowPC() const { return fLowPC; } target_addr_t HighPC() const { return fHighPC; } - const DebugInfoEntryList Variables() const { return fVariables; } - const DebugInfoEntryList Blocks() const { return fBlocks; } + const DebugInfoEntryList& Variables() const { return fVariables; } + const DebugInfoEntryList& Blocks() const { return fBlocks; } virtual status_t AddChild(DebugInfoEntry* child); @@ -738,6 +754,10 @@ public: virtual uint16 Tag() const; + DIEType* ReturnType() const { return fReturnType; } + + const DebugInfoEntryList& Parameters() const { return fParameters; } + virtual status_t AddChild(DebugInfoEntry* child); virtual status_t AddAttribute_address_class(uint16 attributeName, @@ -899,17 +919,24 @@ public: virtual uint16 Tag() const; + DIECompoundType* ContainingType() const + { return fContainingType; } + + const LocationDescription& UseLocation() const + { return fUseLocation; } + virtual status_t AddAttribute_address_class(uint16 attributeName, const AttributeValue& value); virtual status_t AddAttribute_containing_type( uint16 attributeName, const AttributeValue& value); + virtual status_t AddAttribute_use_location(uint16 attributeName, + const AttributeValue& value); protected: DIECompoundType* fContainingType; + LocationDescription fUseLocation; uint8 fAddressClass; -// TODO: -// DW_AT_use_location }; @@ -929,18 +956,12 @@ private: }; -class DIESubrangeType : public DIEDerivedType { +class DIESubrangeType : public DIEArrayIndexType { public: DIESubrangeType(); virtual uint16 Tag() const; - virtual const DynamicAttributeValue* ByteSize() const; - - const DynamicAttributeValue* BitStride() const - { return &fBitStride; } - const DynamicAttributeValue* ByteStride() const - { return &fByteStride; } const DynamicAttributeValue* LowerBound() const { return &fLowerBound; } const DynamicAttributeValue* UpperBound() const @@ -948,12 +969,6 @@ public: const DynamicAttributeValue* Count() const { return &fCount; } - 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, @@ -965,9 +980,6 @@ public: const AttributeValue& value); private: - DynamicAttributeValue fBitStride; - DynamicAttributeValue fByteSize; - DynamicAttributeValue fByteStride; DynamicAttributeValue fCount; DynamicAttributeValue fLowerBound; DynamicAttributeValue fUpperBound;