From ab7a2ea818743b87f41e747871b11d58127ee23f Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Mon, 5 Nov 2012 17:53:14 +0100 Subject: [PATCH] Add support for creating derived types to DwarfType. --- src/apps/debugger/debug_info/DwarfTypes.cpp | 16 ++++++++++++++++ src/apps/debugger/debug_info/DwarfTypes.h | 5 +++++ src/apps/debugger/model/Type.cpp | 9 +++++++++ src/apps/debugger/model/Type.h | 7 +++++++ 4 files changed, 37 insertions(+) diff --git a/src/apps/debugger/debug_info/DwarfTypes.cpp b/src/apps/debugger/debug_info/DwarfTypes.cpp index c1544960ce..608ec1dbcf 100644 --- a/src/apps/debugger/debug_info/DwarfTypes.cpp +++ b/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. */ @@ -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) diff --git a/src/apps/debugger/debug_info/DwarfTypes.h b/src/apps/debugger/debug_info/DwarfTypes.h index ef6c4d265e..976f4e1baa 100644 --- a/src/apps/debugger/debug_info/DwarfTypes.h +++ b/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 @@ -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); diff --git a/src/apps/debugger/model/Type.cpp b/src/apps/debugger/model/Type.cpp index e898682525..83f098f1b0 100644 --- a/src/apps/debugger/model/Type.cpp +++ b/src/apps/debugger/model/Type.cpp @@ -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 diff --git a/src/apps/debugger/model/Type.h b/src/apps/debugger/model/Type.h index 20ffdb901b..44b0b2a5c1 100644 --- a/src/apps/debugger/model/Type.h +++ b/src/apps/debugger/model/Type.h @@ -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;