* 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
|
||||
TeamMemory.cpp
|
||||
TeamMemoryBlock.cpp
|
||||
TeamTypeInformation.cpp
|
||||
Thread.cpp
|
||||
ThreadInfo.cpp
|
||||
Type.cpp
|
||||
|
||||
@@ -25,9 +25,10 @@
|
||||
#include "StackFrameValues.h"
|
||||
#include "StackTrace.h"
|
||||
#include "Team.h"
|
||||
#include "TeamDebugInfo.h"
|
||||
#include "TeamMemory.h"
|
||||
#include "TeamMemoryBlock.h"
|
||||
#include "TeamDebugInfo.h"
|
||||
#include "TeamTypeInformation.h"
|
||||
#include "Thread.h"
|
||||
#include "Tracing.h"
|
||||
#include "Type.h"
|
||||
@@ -416,12 +417,14 @@ LoadSourceCodeJob::Do()
|
||||
|
||||
ResolveValueNodeValueJob::ResolveValueNodeValueJob(
|
||||
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),
|
||||
fDebuggerInterface(debuggerInterface),
|
||||
fArchitecture(architecture),
|
||||
fCpuState(cpuState),
|
||||
fTypeInformation(typeInformation),
|
||||
fContainer(container),
|
||||
fValueNode(valueNode)
|
||||
{
|
||||
@@ -534,7 +537,8 @@ ResolveValueNodeValueJob::_ResolveNodeValue()
|
||||
}
|
||||
|
||||
// resolve the node location and value
|
||||
ValueLoader valueLoader(fArchitecture, fDebuggerInterface, fCpuState);
|
||||
ValueLoader valueLoader(fArchitecture, fDebuggerInterface,
|
||||
fTypeInformation, fCpuState);
|
||||
ValueLocation* location;
|
||||
Value* value;
|
||||
status_t error = fValueNode->ResolvedLocationAndValue(&valueLoader,
|
||||
@@ -565,7 +569,8 @@ status_t
|
||||
ResolveValueNodeValueJob::_ResolveNodeChildLocation(ValueNodeChild* nodeChild)
|
||||
{
|
||||
// resolve the location
|
||||
ValueLoader valueLoader(fArchitecture, fDebuggerInterface, fCpuState);
|
||||
ValueLoader valueLoader(fArchitecture, fDebuggerInterface,
|
||||
fTypeInformation, fCpuState);
|
||||
ValueLocation* location = NULL;
|
||||
status_t error = nodeChild->ResolveLocation(&valueLoader, location);
|
||||
BReference<ValueLocation> locationReference(location, true);
|
||||
@@ -605,7 +610,8 @@ ResolveValueNodeValueJob::_ResolveParentNodeValue(ValueNode* parentNode)
|
||||
// schedule the job
|
||||
status_t error = GetWorker()->ScheduleJob(
|
||||
new(std::nothrow) ResolveValueNodeValueJob(fDebuggerInterface,
|
||||
fArchitecture, fCpuState, fContainer, parentNode));
|
||||
fArchitecture, fCpuState, fTypeInformation, fContainer,
|
||||
parentNode));
|
||||
if (error != B_OK) {
|
||||
// scheduling failed -- set the value to invalid
|
||||
parentNode->SetLocationAndValue(NULL, NULL, error);
|
||||
|
||||
@@ -24,6 +24,7 @@ class StackFrameValues;
|
||||
class Team;
|
||||
class TeamMemory;
|
||||
class TeamMemoryBlock;
|
||||
class TeamTypeInformation;
|
||||
class Thread;
|
||||
class Type;
|
||||
class TypeComponentPath;
|
||||
@@ -158,6 +159,7 @@ public:
|
||||
DebuggerInterface* debuggerInterface,
|
||||
Architecture* architecture,
|
||||
CpuState* cpuState,
|
||||
TeamTypeInformation* typeInformation,
|
||||
ValueNodeContainer* container,
|
||||
ValueNode* valueNode);
|
||||
virtual ~ResolveValueNodeValueJob();
|
||||
@@ -177,6 +179,8 @@ private:
|
||||
DebuggerInterface* fDebuggerInterface;
|
||||
Architecture* fArchitecture;
|
||||
CpuState* fCpuState;
|
||||
TeamTypeInformation*
|
||||
fTypeInformation;
|
||||
ValueNodeContainer* fContainer;
|
||||
ValueNode* fValueNode;
|
||||
};
|
||||
|
||||
@@ -252,7 +252,8 @@ TeamDebugger::Init(team_id teamID, thread_id threadID, bool stopInMain)
|
||||
|
||||
// create a team object
|
||||
fTeam = new(std::nothrow) ::Team(fTeamID, fDebuggerInterface,
|
||||
fDebuggerInterface->GetArchitecture(), teamDebugInfo);
|
||||
fDebuggerInterface->GetArchitecture(), teamDebugInfo,
|
||||
teamDebugInfo);
|
||||
if (fTeam == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
@@ -625,9 +626,8 @@ TeamDebugger::ValueNodeValueRequested(CpuState* cpuState,
|
||||
// schedule the job
|
||||
status_t error = fWorker->ScheduleJob(
|
||||
new(std::nothrow) ResolveValueNodeValueJob(fDebuggerInterface,
|
||||
fDebuggerInterface->GetArchitecture(), cpuState, container,
|
||||
valueNode),
|
||||
this);
|
||||
fDebuggerInterface->GetArchitecture(), cpuState,
|
||||
fTeam->GetTeamTypeInformation(), container, valueNode), this);
|
||||
if (error != B_OK) {
|
||||
// scheduling failed -- set the value to invalid
|
||||
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
|
||||
TeamDebugInfo::GetType(GlobalTypeCache* cache, const BString& name,
|
||||
const TypeLookupConstraints& constraints, Type*& _type)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "GlobalTypeLookup.h"
|
||||
#include "ImageInfo.h"
|
||||
#include "TeamTypeInformation.h"
|
||||
|
||||
|
||||
class Architecture;
|
||||
@@ -32,7 +33,8 @@ class SourceLocation;
|
||||
class SpecificTeamDebugInfo;
|
||||
|
||||
|
||||
class TeamDebugInfo : public BReferenceable, public GlobalTypeLookup {
|
||||
class TeamDebugInfo : public BReferenceable, public GlobalTypeLookup,
|
||||
public TeamTypeInformation {
|
||||
public:
|
||||
TeamDebugInfo(
|
||||
DebuggerInterface* debuggerInterface,
|
||||
@@ -47,6 +49,10 @@ public:
|
||||
const TypeLookupConstraints& constraints,
|
||||
Type*& _type);
|
||||
|
||||
virtual status_t LookupTypeByName(const BString& name,
|
||||
const TypeLookupConstraints& constraints,
|
||||
Type*& _type);
|
||||
|
||||
status_t LoadImageDebugInfo(const ImageInfo& imageInfo,
|
||||
LocatableFile* imageFile,
|
||||
ImageDebugInfo*& _imageDebugInfo);
|
||||
|
||||
@@ -50,11 +50,12 @@ private:
|
||||
|
||||
|
||||
Team::Team(team_id teamID, TeamMemory* teamMemory, Architecture* architecture,
|
||||
TeamDebugInfo* debugInfo)
|
||||
TeamDebugInfo* debugInfo, TeamTypeInformation* typeInformation)
|
||||
:
|
||||
fLock("team lock"),
|
||||
fID(teamID),
|
||||
fTeamMemory(teamMemory),
|
||||
fTypeInformation(typeInformation),
|
||||
fArchitecture(architecture),
|
||||
fDebugInfo(debugInfo)
|
||||
{
|
||||
|
||||
@@ -48,6 +48,7 @@ class SourceLocation;
|
||||
class Statement;
|
||||
class TeamDebugInfo;
|
||||
class TeamMemory;
|
||||
class TeamTypeInformation;
|
||||
class UserBreakpoint;
|
||||
|
||||
|
||||
@@ -63,7 +64,8 @@ public:
|
||||
public:
|
||||
Team(team_id teamID, TeamMemory* teamMemory,
|
||||
Architecture* architecture,
|
||||
TeamDebugInfo* debugInfo);
|
||||
TeamDebugInfo* debugInfo,
|
||||
TeamTypeInformation* typeInformation);
|
||||
~Team();
|
||||
|
||||
status_t Init();
|
||||
@@ -77,6 +79,9 @@ public:
|
||||
Architecture* GetArchitecture() const
|
||||
{ return fArchitecture; }
|
||||
TeamDebugInfo* DebugInfo() const { return fDebugInfo; }
|
||||
TeamTypeInformation*
|
||||
GetTeamTypeInformation() const
|
||||
{ return fTypeInformation; }
|
||||
|
||||
const char* Name() const { return fName.String(); }
|
||||
void SetName(const BString& name);
|
||||
@@ -172,6 +177,8 @@ private:
|
||||
BLocker fLock;
|
||||
team_id fID;
|
||||
TeamMemory* fTeamMemory;
|
||||
TeamTypeInformation*
|
||||
fTypeInformation;
|
||||
Architecture* fArchitecture;
|
||||
TeamDebugInfo* fDebugInfo;
|
||||
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 "Register.h"
|
||||
#include "TeamMemory.h"
|
||||
#include "TeamTypeInformation.h"
|
||||
#include "Tracing.h"
|
||||
#include "TypeLookupConstraints.h"
|
||||
#include "ValueLocation.h"
|
||||
|
||||
|
||||
ValueLoader::ValueLoader(Architecture* architecture, TeamMemory* teamMemory,
|
||||
CpuState* cpuState)
|
||||
TeamTypeInformation* typeInformation, CpuState* cpuState)
|
||||
:
|
||||
fArchitecture(architecture),
|
||||
fTeamMemory(teamMemory),
|
||||
fTypeInformation(typeInformation),
|
||||
fCpuState(cpuState)
|
||||
{
|
||||
// TODO: TeamMemory is not BReferenceable!
|
||||
@@ -208,3 +211,11 @@ ValueLoader::LoadStringValue(BVariant& location, size_t maxSize, BString& _value
|
||||
return fTeamMemory->ReadMemoryString(location.ToUInt64(),
|
||||
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 CpuState;
|
||||
class TeamMemory;
|
||||
class TeamTypeInformation;
|
||||
class Type;
|
||||
class TypeLookupConstraints;
|
||||
class ValueLocation;
|
||||
|
||||
|
||||
class ValueLoader {
|
||||
public:
|
||||
ValueLoader(Architecture* architecture,
|
||||
TeamMemory* teamMemory, CpuState* cpuState);
|
||||
TeamMemory* teamMemory,
|
||||
TeamTypeInformation* typeInformation,
|
||||
CpuState* cpuState);
|
||||
// cpuState can be NULL
|
||||
~ValueLoader();
|
||||
|
||||
@@ -37,9 +42,16 @@ public:
|
||||
status_t LoadStringValue(BVariant& location,
|
||||
size_t maxSize, BString& _value);
|
||||
|
||||
status_t LookupTypeByName(const BString& name,
|
||||
const TypeLookupConstraints& constraints,
|
||||
Type*& _type);
|
||||
// returns reference
|
||||
|
||||
private:
|
||||
Architecture* fArchitecture;
|
||||
TeamMemory* fTeamMemory;
|
||||
TeamTypeInformation*
|
||||
fTypeInformation;
|
||||
CpuState* fCpuState;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user