Add support for creating derived types to DwarfType.

This commit is contained in:
Rene Gollent 2012-11-05 17:53:14 +01:00
parent 122905281d
commit ab7a2ea818
4 changed files with 37 additions and 0 deletions

View File

@ -1,5 +1,6 @@
/*
* Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copryight 2012, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
@ -225,6 +226,21 @@ DwarfType::ByteSize() const
}
status_t
DwarfType::CreateDerivedAddressType(address_type_kind addressType,
AddressType*& _resultType)
{
DwarfAddressType* resultType = new(std::nothrow)
DwarfAddressType(fTypeContext, fName, NULL, addressType, this);
if (resultType == NULL)
return B_NO_MEMORY;
_resultType = resultType;
return B_OK;
}
status_t
DwarfType::ResolveObjectDataLocation(const ValueLocation& objectLocation,
ValueLocation*& _location)

View File

@ -1,5 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copryight 2012, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef DWARF_TYPES_H
@ -107,6 +108,10 @@ public:
virtual const BString& Name() const;
virtual target_size_t ByteSize() const;
virtual status_t CreateDerivedAddressType(
address_type_kind kind,
AddressType*& _resultType);
virtual status_t ResolveObjectDataLocation(
const ValueLocation& objectLocation,
ValueLocation*& _location);

View File

@ -87,6 +87,15 @@ Type::ResolveRawType(bool nextOneOnly) const
}
status_t
Type::CreateDerivedAddressType(address_type_kind kind,
AddressType*& _resultType)
{
_resultType = NULL;
return B_ERROR;
}
// #pragma mark - PrimitiveType

View File

@ -52,6 +52,7 @@ enum {
};
class AddressType;
class ArrayIndexPath;
class BString;
class Type;
@ -117,6 +118,12 @@ public:
// strips modifiers and typedefs (only one,
// if requested)
// TODO: also need the ability to derive array types
virtual status_t CreateDerivedAddressType(
address_type_kind kind,
AddressType*& _resultType);
virtual status_t ResolveObjectDataLocation(
const ValueLocation& objectLocation,
ValueLocation*& _location) = 0;