Skip to content

Commit

Permalink
Add support for creating derived types to DwarfType.
Browse files Browse the repository at this point in the history
  • Loading branch information
anevilyak committed Nov 5, 2012
1 parent 1229052 commit ab7a2ea
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/apps/debugger/debug_info/DwarfTypes.cpp
@@ -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.
*/

Expand Down Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions src/apps/debugger/debug_info/DwarfTypes.h
@@ -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
Expand Down Expand Up @@ -107,6 +108,10 @@ class DwarfType : public virtual Type {
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);
Expand Down
9 changes: 9 additions & 0 deletions src/apps/debugger/model/Type.cpp
Expand Up @@ -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


Expand Down
7 changes: 7 additions & 0 deletions src/apps/debugger/model/Type.h
Expand Up @@ -52,6 +52,7 @@ enum {
};


class AddressType;
class ArrayIndexPath;
class BString;
class Type;
Expand Down Expand Up @@ -117,6 +118,12 @@ class Type : public BReferenceable {
// 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;
Expand Down

0 comments on commit ab7a2ea

Please sign in to comment.