* Add interface TeamTypeInformation and implement in TeamDebugInfo. Pass along
to various classes that need a reference to it in order to allow value nodes to look up type information from the target team. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42354 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -130,6 +130,7 @@ Application Debugger :
|
|||||||
Team.cpp
|
Team.cpp
|
||||||
TeamMemory.cpp
|
TeamMemory.cpp
|
||||||
TeamMemoryBlock.cpp
|
TeamMemoryBlock.cpp
|
||||||
|
TeamTypeInformation.cpp
|
||||||
Thread.cpp
|
Thread.cpp
|
||||||
ThreadInfo.cpp
|
ThreadInfo.cpp
|
||||||
Type.cpp
|
Type.cpp
|
||||||
|
|||||||
@@ -25,9 +25,10 @@
|
|||||||
#include "StackFrameValues.h"
|
#include "StackFrameValues.h"
|
||||||
#include "StackTrace.h"
|
#include "StackTrace.h"
|
||||||
#include "Team.h"
|
#include "Team.h"
|
||||||
|
#include "TeamDebugInfo.h"
|
||||||
#include "TeamMemory.h"
|
#include "TeamMemory.h"
|
||||||
#include "TeamMemoryBlock.h"
|
#include "TeamMemoryBlock.h"
|
||||||
#include "TeamDebugInfo.h"
|
#include "TeamTypeInformation.h"
|
||||||
#include "Thread.h"
|
#include "Thread.h"
|
||||||
#include "Tracing.h"
|
#include "Tracing.h"
|
||||||
#include "Type.h"
|
#include "Type.h"
|
||||||
@@ -416,12 +417,14 @@ LoadSourceCodeJob::Do()
|
|||||||
|
|
||||||
ResolveValueNodeValueJob::ResolveValueNodeValueJob(
|
ResolveValueNodeValueJob::ResolveValueNodeValueJob(
|
||||||
DebuggerInterface* debuggerInterface, Architecture* architecture,
|
DebuggerInterface* debuggerInterface, Architecture* architecture,
|
||||||
CpuState* cpuState, ValueNodeContainer* container, ValueNode* valueNode)
|
CpuState* cpuState, TeamTypeInformation* typeInformation,
|
||||||
|
ValueNodeContainer* container, ValueNode* valueNode)
|
||||||
:
|
:
|
||||||
fKey(valueNode, JOB_TYPE_RESOLVE_VALUE_NODE_VALUE),
|
fKey(valueNode, JOB_TYPE_RESOLVE_VALUE_NODE_VALUE),
|
||||||
fDebuggerInterface(debuggerInterface),
|
fDebuggerInterface(debuggerInterface),
|
||||||
fArchitecture(architecture),
|
fArchitecture(architecture),
|
||||||
fCpuState(cpuState),
|
fCpuState(cpuState),
|
||||||
|
fTypeInformation(typeInformation),
|
||||||
fContainer(container),
|
fContainer(container),
|
||||||
fValueNode(valueNode)
|
fValueNode(valueNode)
|
||||||
{
|
{
|
||||||
@@ -534,7 +537,8 @@ ResolveValueNodeValueJob::_ResolveNodeValue()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// resolve the node location and value
|
// resolve the node location and value
|
||||||
ValueLoader valueLoader(fArchitecture, fDebuggerInterface, fCpuState);
|
ValueLoader valueLoader(fArchitecture, fDebuggerInterface,
|
||||||
|
fTypeInformation, fCpuState);
|
||||||
ValueLocation* location;
|
ValueLocation* location;
|
||||||
Value* value;
|
Value* value;
|
||||||
status_t error = fValueNode->ResolvedLocationAndValue(&valueLoader,
|
status_t error = fValueNode->ResolvedLocationAndValue(&valueLoader,
|
||||||
@@ -565,7 +569,8 @@ status_t
|
|||||||
ResolveValueNodeValueJob::_ResolveNodeChildLocation(ValueNodeChild* nodeChild)
|
ResolveValueNodeValueJob::_ResolveNodeChildLocation(ValueNodeChild* nodeChild)
|
||||||
{
|
{
|
||||||
// resolve the location
|
// resolve the location
|
||||||
ValueLoader valueLoader(fArchitecture, fDebuggerInterface, fCpuState);
|
ValueLoader valueLoader(fArchitecture, fDebuggerInterface,
|
||||||
|
fTypeInformation, fCpuState);
|
||||||
ValueLocation* location = NULL;
|
ValueLocation* location = NULL;
|
||||||
status_t error = nodeChild->ResolveLocation(&valueLoader, location);
|
status_t error = nodeChild->ResolveLocation(&valueLoader, location);
|
||||||
BReference<ValueLocation> locationReference(location, true);
|
BReference<ValueLocation> locationReference(location, true);
|
||||||
@@ -605,7 +610,8 @@ ResolveValueNodeValueJob::_ResolveParentNodeValue(ValueNode* parentNode)
|
|||||||
// schedule the job
|
// schedule the job
|
||||||
status_t error = GetWorker()->ScheduleJob(
|
status_t error = GetWorker()->ScheduleJob(
|
||||||
new(std::nothrow) ResolveValueNodeValueJob(fDebuggerInterface,
|
new(std::nothrow) ResolveValueNodeValueJob(fDebuggerInterface,
|
||||||
fArchitecture, fCpuState, fContainer, parentNode));
|
fArchitecture, fCpuState, fTypeInformation, fContainer,
|
||||||
|
parentNode));
|
||||||
if (error != B_OK) {
|
if (error != B_OK) {
|
||||||
// scheduling failed -- set the value to invalid
|
// scheduling failed -- set the value to invalid
|
||||||
parentNode->SetLocationAndValue(NULL, NULL, error);
|
parentNode->SetLocationAndValue(NULL, NULL, error);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class StackFrameValues;
|
|||||||
class Team;
|
class Team;
|
||||||
class TeamMemory;
|
class TeamMemory;
|
||||||
class TeamMemoryBlock;
|
class TeamMemoryBlock;
|
||||||
|
class TeamTypeInformation;
|
||||||
class Thread;
|
class Thread;
|
||||||
class Type;
|
class Type;
|
||||||
class TypeComponentPath;
|
class TypeComponentPath;
|
||||||
@@ -158,6 +159,7 @@ public:
|
|||||||
DebuggerInterface* debuggerInterface,
|
DebuggerInterface* debuggerInterface,
|
||||||
Architecture* architecture,
|
Architecture* architecture,
|
||||||
CpuState* cpuState,
|
CpuState* cpuState,
|
||||||
|
TeamTypeInformation* typeInformation,
|
||||||
ValueNodeContainer* container,
|
ValueNodeContainer* container,
|
||||||
ValueNode* valueNode);
|
ValueNode* valueNode);
|
||||||
virtual ~ResolveValueNodeValueJob();
|
virtual ~ResolveValueNodeValueJob();
|
||||||
@@ -177,6 +179,8 @@ private:
|
|||||||
DebuggerInterface* fDebuggerInterface;
|
DebuggerInterface* fDebuggerInterface;
|
||||||
Architecture* fArchitecture;
|
Architecture* fArchitecture;
|
||||||
CpuState* fCpuState;
|
CpuState* fCpuState;
|
||||||
|
TeamTypeInformation*
|
||||||
|
fTypeInformation;
|
||||||
ValueNodeContainer* fContainer;
|
ValueNodeContainer* fContainer;
|
||||||
ValueNode* fValueNode;
|
ValueNode* fValueNode;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -252,7 +252,8 @@ TeamDebugger::Init(team_id teamID, thread_id threadID, bool stopInMain)
|
|||||||
|
|
||||||
// create a team object
|
// create a team object
|
||||||
fTeam = new(std::nothrow) ::Team(fTeamID, fDebuggerInterface,
|
fTeam = new(std::nothrow) ::Team(fTeamID, fDebuggerInterface,
|
||||||
fDebuggerInterface->GetArchitecture(), teamDebugInfo);
|
fDebuggerInterface->GetArchitecture(), teamDebugInfo,
|
||||||
|
teamDebugInfo);
|
||||||
if (fTeam == NULL)
|
if (fTeam == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
@@ -625,9 +626,8 @@ TeamDebugger::ValueNodeValueRequested(CpuState* cpuState,
|
|||||||
// schedule the job
|
// schedule the job
|
||||||
status_t error = fWorker->ScheduleJob(
|
status_t error = fWorker->ScheduleJob(
|
||||||
new(std::nothrow) ResolveValueNodeValueJob(fDebuggerInterface,
|
new(std::nothrow) ResolveValueNodeValueJob(fDebuggerInterface,
|
||||||
fDebuggerInterface->GetArchitecture(), cpuState, container,
|
fDebuggerInterface->GetArchitecture(), cpuState,
|
||||||
valueNode),
|
fTeam->GetTeamTypeInformation(), container, valueNode), this);
|
||||||
this);
|
|
||||||
if (error != B_OK) {
|
if (error != B_OK) {
|
||||||
// scheduling failed -- set the value to invalid
|
// scheduling failed -- set the value to invalid
|
||||||
valueNode->SetLocationAndValue(NULL, NULL, error);
|
valueNode->SetLocationAndValue(NULL, NULL, error);
|
||||||
|
|||||||
@@ -361,6 +361,13 @@ TeamDebugInfo::Init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
TeamDebugInfo::LookupTypeByName(const BString& name,
|
||||||
|
const TypeLookupConstraints& constraints, Type*& _type)
|
||||||
|
{
|
||||||
|
return GetType(fTypeCache, name, constraints, _type);
|
||||||
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
TeamDebugInfo::GetType(GlobalTypeCache* cache, const BString& name,
|
TeamDebugInfo::GetType(GlobalTypeCache* cache, const BString& name,
|
||||||
const TypeLookupConstraints& constraints, Type*& _type)
|
const TypeLookupConstraints& constraints, Type*& _type)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "GlobalTypeLookup.h"
|
#include "GlobalTypeLookup.h"
|
||||||
#include "ImageInfo.h"
|
#include "ImageInfo.h"
|
||||||
|
#include "TeamTypeInformation.h"
|
||||||
|
|
||||||
|
|
||||||
class Architecture;
|
class Architecture;
|
||||||
@@ -32,7 +33,8 @@ class SourceLocation;
|
|||||||
class SpecificTeamDebugInfo;
|
class SpecificTeamDebugInfo;
|
||||||
|
|
||||||
|
|
||||||
class TeamDebugInfo : public BReferenceable, public GlobalTypeLookup {
|
class TeamDebugInfo : public BReferenceable, public GlobalTypeLookup,
|
||||||
|
public TeamTypeInformation {
|
||||||
public:
|
public:
|
||||||
TeamDebugInfo(
|
TeamDebugInfo(
|
||||||
DebuggerInterface* debuggerInterface,
|
DebuggerInterface* debuggerInterface,
|
||||||
@@ -47,6 +49,10 @@ public:
|
|||||||
const TypeLookupConstraints& constraints,
|
const TypeLookupConstraints& constraints,
|
||||||
Type*& _type);
|
Type*& _type);
|
||||||
|
|
||||||
|
virtual status_t LookupTypeByName(const BString& name,
|
||||||
|
const TypeLookupConstraints& constraints,
|
||||||
|
Type*& _type);
|
||||||
|
|
||||||
status_t LoadImageDebugInfo(const ImageInfo& imageInfo,
|
status_t LoadImageDebugInfo(const ImageInfo& imageInfo,
|
||||||
LocatableFile* imageFile,
|
LocatableFile* imageFile,
|
||||||
ImageDebugInfo*& _imageDebugInfo);
|
ImageDebugInfo*& _imageDebugInfo);
|
||||||
|
|||||||
@@ -50,11 +50,12 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
Team::Team(team_id teamID, TeamMemory* teamMemory, Architecture* architecture,
|
Team::Team(team_id teamID, TeamMemory* teamMemory, Architecture* architecture,
|
||||||
TeamDebugInfo* debugInfo)
|
TeamDebugInfo* debugInfo, TeamTypeInformation* typeInformation)
|
||||||
:
|
:
|
||||||
fLock("team lock"),
|
fLock("team lock"),
|
||||||
fID(teamID),
|
fID(teamID),
|
||||||
fTeamMemory(teamMemory),
|
fTeamMemory(teamMemory),
|
||||||
|
fTypeInformation(typeInformation),
|
||||||
fArchitecture(architecture),
|
fArchitecture(architecture),
|
||||||
fDebugInfo(debugInfo)
|
fDebugInfo(debugInfo)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ class SourceLocation;
|
|||||||
class Statement;
|
class Statement;
|
||||||
class TeamDebugInfo;
|
class TeamDebugInfo;
|
||||||
class TeamMemory;
|
class TeamMemory;
|
||||||
|
class TeamTypeInformation;
|
||||||
class UserBreakpoint;
|
class UserBreakpoint;
|
||||||
|
|
||||||
|
|
||||||
@@ -63,7 +64,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
Team(team_id teamID, TeamMemory* teamMemory,
|
Team(team_id teamID, TeamMemory* teamMemory,
|
||||||
Architecture* architecture,
|
Architecture* architecture,
|
||||||
TeamDebugInfo* debugInfo);
|
TeamDebugInfo* debugInfo,
|
||||||
|
TeamTypeInformation* typeInformation);
|
||||||
~Team();
|
~Team();
|
||||||
|
|
||||||
status_t Init();
|
status_t Init();
|
||||||
@@ -77,6 +79,9 @@ public:
|
|||||||
Architecture* GetArchitecture() const
|
Architecture* GetArchitecture() const
|
||||||
{ return fArchitecture; }
|
{ return fArchitecture; }
|
||||||
TeamDebugInfo* DebugInfo() const { return fDebugInfo; }
|
TeamDebugInfo* DebugInfo() const { return fDebugInfo; }
|
||||||
|
TeamTypeInformation*
|
||||||
|
GetTeamTypeInformation() const
|
||||||
|
{ return fTypeInformation; }
|
||||||
|
|
||||||
const char* Name() const { return fName.String(); }
|
const char* Name() const { return fName.String(); }
|
||||||
void SetName(const BString& name);
|
void SetName(const BString& name);
|
||||||
@@ -172,6 +177,8 @@ private:
|
|||||||
BLocker fLock;
|
BLocker fLock;
|
||||||
team_id fID;
|
team_id fID;
|
||||||
TeamMemory* fTeamMemory;
|
TeamMemory* fTeamMemory;
|
||||||
|
TeamTypeInformation*
|
||||||
|
fTypeInformation;
|
||||||
Architecture* fArchitecture;
|
Architecture* fArchitecture;
|
||||||
TeamDebugInfo* fDebugInfo;
|
TeamDebugInfo* fDebugInfo;
|
||||||
BString fName;
|
BString fName;
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011, Rene Gollent, rene@gollent.com.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "TeamTypeInformation.h"
|
||||||
|
|
||||||
|
|
||||||
|
TeamTypeInformation::~TeamTypeInformation()
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011, Rene Gollent, rene@gollent.com.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef TEAM_TYPE_INFORMATION_H
|
||||||
|
#define TEAM_TYPE_INFORMATION_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <Referenceable.h>
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
|
||||||
|
class BString;
|
||||||
|
class Type;
|
||||||
|
class TypeLookupConstraints;
|
||||||
|
|
||||||
|
|
||||||
|
class TeamTypeInformation {
|
||||||
|
public:
|
||||||
|
virtual ~TeamTypeInformation();
|
||||||
|
|
||||||
|
|
||||||
|
virtual status_t LookupTypeByName(const BString& name,
|
||||||
|
const TypeLookupConstraints& constraints,
|
||||||
|
Type*& _type) = 0;
|
||||||
|
// returns reference
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // TEAM_TYPE_INFORMATION_H
|
||||||
@@ -11,15 +11,18 @@
|
|||||||
#include "CpuState.h"
|
#include "CpuState.h"
|
||||||
#include "Register.h"
|
#include "Register.h"
|
||||||
#include "TeamMemory.h"
|
#include "TeamMemory.h"
|
||||||
|
#include "TeamTypeInformation.h"
|
||||||
#include "Tracing.h"
|
#include "Tracing.h"
|
||||||
|
#include "TypeLookupConstraints.h"
|
||||||
#include "ValueLocation.h"
|
#include "ValueLocation.h"
|
||||||
|
|
||||||
|
|
||||||
ValueLoader::ValueLoader(Architecture* architecture, TeamMemory* teamMemory,
|
ValueLoader::ValueLoader(Architecture* architecture, TeamMemory* teamMemory,
|
||||||
CpuState* cpuState)
|
TeamTypeInformation* typeInformation, CpuState* cpuState)
|
||||||
:
|
:
|
||||||
fArchitecture(architecture),
|
fArchitecture(architecture),
|
||||||
fTeamMemory(teamMemory),
|
fTeamMemory(teamMemory),
|
||||||
|
fTypeInformation(typeInformation),
|
||||||
fCpuState(cpuState)
|
fCpuState(cpuState)
|
||||||
{
|
{
|
||||||
// TODO: TeamMemory is not BReferenceable!
|
// TODO: TeamMemory is not BReferenceable!
|
||||||
@@ -208,3 +211,11 @@ ValueLoader::LoadStringValue(BVariant& location, size_t maxSize, BString& _value
|
|||||||
return fTeamMemory->ReadMemoryString(location.ToUInt64(),
|
return fTeamMemory->ReadMemoryString(location.ToUInt64(),
|
||||||
std::min(maxSize, kMaxStringSize), _value);
|
std::min(maxSize, kMaxStringSize), _value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
ValueLoader::LookupTypeByName(const BString& name,
|
||||||
|
const TypeLookupConstraints& constraints, Type*& _type)
|
||||||
|
{
|
||||||
|
return fTypeInformation->LookupTypeByName(name, constraints, _type);
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,13 +14,18 @@
|
|||||||
class Architecture;
|
class Architecture;
|
||||||
class CpuState;
|
class CpuState;
|
||||||
class TeamMemory;
|
class TeamMemory;
|
||||||
|
class TeamTypeInformation;
|
||||||
|
class Type;
|
||||||
|
class TypeLookupConstraints;
|
||||||
class ValueLocation;
|
class ValueLocation;
|
||||||
|
|
||||||
|
|
||||||
class ValueLoader {
|
class ValueLoader {
|
||||||
public:
|
public:
|
||||||
ValueLoader(Architecture* architecture,
|
ValueLoader(Architecture* architecture,
|
||||||
TeamMemory* teamMemory, CpuState* cpuState);
|
TeamMemory* teamMemory,
|
||||||
|
TeamTypeInformation* typeInformation,
|
||||||
|
CpuState* cpuState);
|
||||||
// cpuState can be NULL
|
// cpuState can be NULL
|
||||||
~ValueLoader();
|
~ValueLoader();
|
||||||
|
|
||||||
@@ -37,9 +42,16 @@ public:
|
|||||||
status_t LoadStringValue(BVariant& location,
|
status_t LoadStringValue(BVariant& location,
|
||||||
size_t maxSize, BString& _value);
|
size_t maxSize, BString& _value);
|
||||||
|
|
||||||
|
status_t LookupTypeByName(const BString& name,
|
||||||
|
const TypeLookupConstraints& constraints,
|
||||||
|
Type*& _type);
|
||||||
|
// returns reference
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Architecture* fArchitecture;
|
Architecture* fArchitecture;
|
||||||
TeamMemory* fTeamMemory;
|
TeamMemory* fTeamMemory;
|
||||||
|
TeamTypeInformation*
|
||||||
|
fTypeInformation;
|
||||||
CpuState* fCpuState;
|
CpuState* fCpuState;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user