Add support for memory block events to CliContext.
This commit is contained in:
parent
779b84b17b
commit
c7f5dd6207
@ -26,10 +26,11 @@ static CliContext* sCurrentContext;
|
||||
|
||||
|
||||
struct CliContext::Event : DoublyLinkedListLinkImpl<CliContext::Event> {
|
||||
Event(int type, Thread* thread = NULL)
|
||||
Event(int type, Thread* thread = NULL, TeamMemoryBlock* block = NULL)
|
||||
:
|
||||
fType(type),
|
||||
fThreadReference(thread)
|
||||
fThreadReference(thread),
|
||||
fMemoryBlockReference(block)
|
||||
{
|
||||
}
|
||||
|
||||
@ -43,9 +44,15 @@ struct CliContext::Event : DoublyLinkedListLinkImpl<CliContext::Event> {
|
||||
return fThreadReference.Get();
|
||||
}
|
||||
|
||||
TeamMemoryBlock* GetMemoryBlock() const
|
||||
{
|
||||
return fMemoryBlockReference.Get();
|
||||
}
|
||||
|
||||
private:
|
||||
int fType;
|
||||
BReference<Thread> fThreadReference;
|
||||
BReference<TeamMemoryBlock> fMemoryBlockReference;
|
||||
};
|
||||
|
||||
|
||||
@ -68,7 +75,8 @@ CliContext::CliContext()
|
||||
fTerminating(false),
|
||||
fCurrentThread(NULL),
|
||||
fCurrentStackTrace(NULL),
|
||||
fCurrentStackFrameIndex(-1)
|
||||
fCurrentStackFrameIndex(-1),
|
||||
fCurrentBlock(NULL)
|
||||
{
|
||||
sCurrentContext = this;
|
||||
}
|
||||
@ -151,6 +159,11 @@ CliContext::Cleanup()
|
||||
fNodeManager->ReleaseReference();
|
||||
fNodeManager = NULL;
|
||||
}
|
||||
|
||||
if (fCurrentBlock != NULL) {
|
||||
fCurrentBlock->ReleaseReference();
|
||||
fCurrentBlock = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -376,6 +389,13 @@ CliContext::ProcessPendingEvents()
|
||||
SetCurrentStackFrameIndex(0);
|
||||
}
|
||||
break;
|
||||
case EVENT_TEAM_MEMORY_BLOCK_RETRIEVED:
|
||||
if (fCurrentBlock != NULL) {
|
||||
fCurrentBlock->ReleaseReference();
|
||||
fCurrentBlock = NULL;
|
||||
}
|
||||
fCurrentBlock = event->GetMemoryBlock();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -424,6 +444,16 @@ CliContext::ThreadStackTraceChanged(const Team::ThreadEvent& threadEvent)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CliContext::MemoryBlockRetrieved(TeamMemoryBlock* block)
|
||||
{
|
||||
_QueueEvent(
|
||||
new(std::nothrow) Event(EVENT_TEAM_MEMORY_BLOCK_RETRIEVED,
|
||||
NULL, block));
|
||||
_SignalInputLoop(EVENT_TEAM_MEMORY_BLOCK_RETRIEVED);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CliContext::ValueNodeChanged(ValueNodeChild* nodeChild, ValueNode* oldNode,
|
||||
ValueNode* newNode)
|
||||
|
@ -13,17 +13,20 @@
|
||||
#include <Locker.h>
|
||||
|
||||
#include "Team.h"
|
||||
#include "TeamMemoryBlock.h"
|
||||
#include "ValueNodeContainer.h"
|
||||
|
||||
|
||||
class StackFrame;
|
||||
class StackTrace;
|
||||
class Team;
|
||||
class TeamMemoryBlock;
|
||||
class UserInterfaceListener;
|
||||
class ValueNodeManager;
|
||||
|
||||
|
||||
class CliContext : private Team::Listener,
|
||||
public TeamMemoryBlock::Listener,
|
||||
private ValueNodeContainer::Listener {
|
||||
public:
|
||||
enum {
|
||||
@ -33,7 +36,8 @@ public:
|
||||
EVENT_THREAD_REMOVED = 0x08,
|
||||
EVENT_THREAD_STOPPED = 0x10,
|
||||
EVENT_THREAD_STACK_TRACE_CHANGED = 0x20,
|
||||
EVENT_VALUE_NODE_CHANGED = 0x40
|
||||
EVENT_VALUE_NODE_CHANGED = 0x40,
|
||||
EVENT_TEAM_MEMORY_BLOCK_RETRIEVED = 0x80
|
||||
};
|
||||
|
||||
public:
|
||||
@ -67,6 +71,8 @@ public:
|
||||
{ return fCurrentStackFrameIndex; }
|
||||
void SetCurrentStackFrameIndex(int32 index);
|
||||
|
||||
TeamMemoryBlock* CurrentBlock() const { return fCurrentBlock; }
|
||||
|
||||
const char* PromptUser(const char* prompt);
|
||||
void AddLineToInputHistory(const char* line);
|
||||
|
||||
@ -91,6 +97,9 @@ private:
|
||||
virtual void ThreadStackTraceChanged(
|
||||
const Team::ThreadEvent& event);
|
||||
|
||||
// TeamMemoryBlock::Listener
|
||||
virtual void MemoryBlockRetrieved(TeamMemoryBlock* block);
|
||||
|
||||
// ValueNodeContainer::Listener
|
||||
virtual void ValueNodeChanged(ValueNodeChild* nodeChild,
|
||||
ValueNode* oldNode, ValueNode* newNode);
|
||||
@ -124,6 +133,7 @@ private:
|
||||
Thread* fCurrentThread;
|
||||
StackTrace* fCurrentStackTrace;
|
||||
int32 fCurrentStackFrameIndex;
|
||||
TeamMemoryBlock* fCurrentBlock;
|
||||
|
||||
EventList fPendingEvents;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user