Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Debugger: Add type subclass for artificial types.
- For expressions we need a Type object to represent their result type. However, this doesn't need to map to an actual DwarfType, as we won't need e.g. location and storage format information to read it out of the target team, so instead derive a simple subclass representing the appropriate result type.
- Loading branch information
Showing
3 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
src/apps/debugger/user_interface/gui/model/SyntheticPrimitiveType.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* Copyright 2014, Rene Gollent, rene@gollent.com. | ||
* Distributed under the terms of the MIT License. | ||
*/ | ||
|
||
|
||
#include "SyntheticPrimitiveType.h" | ||
|
||
#include <Variant.h> | ||
|
||
#include "UiUtils.h" | ||
|
||
|
||
SyntheticPrimitiveType::SyntheticPrimitiveType(uint32 typeConstant) | ||
: | ||
PrimitiveType(), | ||
fTypeConstant(typeConstant), | ||
fID(), | ||
fName() | ||
{ | ||
_Init(); | ||
} | ||
|
||
|
||
SyntheticPrimitiveType::~SyntheticPrimitiveType() | ||
{ | ||
} | ||
|
||
|
||
uint32 | ||
SyntheticPrimitiveType::TypeConstant() const | ||
{ | ||
return fTypeConstant; | ||
} | ||
|
||
|
||
image_id | ||
SyntheticPrimitiveType::ImageID() const | ||
{ | ||
return -1; | ||
} | ||
|
||
|
||
const BString& | ||
SyntheticPrimitiveType::ID() const | ||
{ | ||
return fID; | ||
} | ||
|
||
|
||
const BString& | ||
SyntheticPrimitiveType::Name() const | ||
{ | ||
return fName; | ||
} | ||
|
||
|
||
type_kind | ||
SyntheticPrimitiveType::Kind() const | ||
{ | ||
return TYPE_PRIMITIVE; | ||
} | ||
|
||
|
||
target_size_t | ||
SyntheticPrimitiveType::ByteSize() const | ||
{ | ||
return BVariant::SizeOfType(fTypeConstant); | ||
} | ||
|
||
|
||
status_t | ||
SyntheticPrimitiveType::ResolveObjectDataLocation( | ||
const ValueLocation& objectLocation, ValueLocation*& _location) | ||
{ | ||
_location = NULL; | ||
return B_NOT_SUPPORTED; | ||
} | ||
|
||
|
||
status_t | ||
SyntheticPrimitiveType::ResolveObjectDataLocation(target_addr_t objectAddress, | ||
ValueLocation*& _location) | ||
{ | ||
_location = NULL; | ||
return B_NOT_SUPPORTED; | ||
} | ||
|
||
|
||
void | ||
SyntheticPrimitiveType::_Init() | ||
{ | ||
fID.SetToFormat("%p", this); | ||
fName.SetTo(UiUtils::TypeCodeToString(fTypeConstant)); | ||
} |
44 changes: 44 additions & 0 deletions
44
src/apps/debugger/user_interface/gui/model/SyntheticPrimitiveType.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright 2014, Rene Gollent, rene@gollent.com. | ||
* Distributed under the terms of the MIT License. | ||
*/ | ||
#ifndef SYNTHETIC_PRIMITIVE_TYPE_H | ||
#define SYNTHETIC_PRIMITIVE_TYPE_H | ||
|
||
|
||
#include "Type.h" | ||
|
||
#include <String.h> | ||
|
||
|
||
class SyntheticPrimitiveType : public PrimitiveType { | ||
public: | ||
SyntheticPrimitiveType(uint32 typeConstant); | ||
virtual ~SyntheticPrimitiveType(); | ||
|
||
virtual uint32 TypeConstant() const; | ||
|
||
virtual image_id ImageID() const; | ||
virtual const BString& ID() const; | ||
virtual const BString& Name() const; | ||
virtual type_kind Kind() const; | ||
virtual target_size_t ByteSize() const; | ||
|
||
virtual status_t ResolveObjectDataLocation( | ||
const ValueLocation& objectLocation, | ||
ValueLocation*& _location); | ||
virtual status_t ResolveObjectDataLocation( | ||
target_addr_t objectAddress, | ||
ValueLocation*& _location); | ||
|
||
private: | ||
void _Init(); | ||
|
||
private: | ||
uint32 fTypeConstant; | ||
BString fID; | ||
BString fName; | ||
}; | ||
|
||
|
||
#endif // SYNTHETIC_PRIMITIVE_TYPE |