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.
This commit is contained in:
parent
1af58b2afd
commit
1904b0c99a
@ -250,6 +250,7 @@ Application Debugger :
|
||||
GraphicalUserInterface.cpp
|
||||
|
||||
# user_interface/gui/model
|
||||
SyntheticPrimitiveType.cpp
|
||||
VariablesViewState.cpp
|
||||
VariablesViewStateHistory.cpp
|
||||
|
||||
|
@ -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));
|
||||
}
|
@ -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
|
Loading…
Reference in New Issue
Block a user