Actually create the memory block manager in TeamDebugger, and add a menu item

allowing one to bring up the inspector. This gets us as far as successfully
retrieving memory data from the target team and passing it on to any listeners.
Right now there's not much to see though, as the memory view to visualize the
data is not yet implemented.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42143 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent 2011-06-13 02:09:12 +00:00
parent 90ade5e298
commit 689f750f2d
5 changed files with 38 additions and 1 deletions

View File

@ -45,6 +45,7 @@ enum {
MSG_SHOW_TEAMS_WINDOW = 'stsw', MSG_SHOW_TEAMS_WINDOW = 'stsw',
MSG_TEAMS_WINDOW_CLOSED = 'tswc', MSG_TEAMS_WINDOW_CLOSED = 'tswc',
MSG_DEBUG_THIS_TEAM = 'dbtt', MSG_DEBUG_THIS_TEAM = 'dbtt',
MSG_SHOW_INSPECTOR_WINDOW = 'sirw',
MSG_INSPECTOR_WINDOW_CLOSED = 'irwc', MSG_INSPECTOR_WINDOW_CLOSED = 'irwc',
MSG_INSPECT_ADDRESS = 'isad' MSG_INSPECT_ADDRESS = 'isad'
}; };

View File

@ -142,6 +142,7 @@ TeamDebugger::TeamDebugger(Listener* listener, UserInterface* userInterface,
fFileManager(NULL), fFileManager(NULL),
fWorker(NULL), fWorker(NULL),
fBreakpointManager(NULL), fBreakpointManager(NULL),
fMemoryBlockManager(NULL),
fDebugEventListener(-1), fDebugEventListener(-1),
fUserInterface(userInterface), fUserInterface(userInterface),
fTerminating(false), fTerminating(false),
@ -296,6 +297,15 @@ TeamDebugger::Init(team_id teamID, thread_id threadID, bool stopInMain)
if (error != B_OK) if (error != B_OK)
return error; return error;
// create the memory block manager
fMemoryBlockManager = new(std::nothrow) TeamMemoryBlockManager();
if (fMemoryBlockManager == NULL)
return B_NO_MEMORY;
error = fMemoryBlockManager->Init();
if (error != B_OK)
return error;
// set team debugging flags // set team debugging flags
fDebuggerInterface->SetTeamDebuggingFlags( fDebuggerInterface->SetTeamDebuggingFlags(
B_TEAM_DEBUG_THREADS | B_TEAM_DEBUG_IMAGES); B_TEAM_DEBUG_THREADS | B_TEAM_DEBUG_IMAGES);
@ -757,6 +767,7 @@ void
TeamDebugger::JobFailed(Job* job) TeamDebugger::JobFailed(Job* job)
{ {
TRACE_JOBS("TeamDebugger::JobFailed(%p)\n", job); TRACE_JOBS("TeamDebugger::JobFailed(%p)\n", job);
// TODO: notify user
} }

View File

@ -122,7 +122,7 @@ TeamMemoryBlockManager::GetMemoryBlock(target_addr_t address)
{ {
AutoLocker<BLocker> lock(fLock); AutoLocker<BLocker> lock(fLock);
address &= ~B_PAGE_SIZE - 1; address &= ~(B_PAGE_SIZE - 1);
MemoryBlockEntry* entry = fActiveBlocks->Lookup(address); MemoryBlockEntry* entry = fActiveBlocks->Lookup(address);
if (entry != NULL) { if (entry != NULL) {
if (entry->block->AcquireReference() != 0) if (entry->block->AcquireReference() != 0)

View File

@ -32,6 +32,7 @@
#include "FileSourceCode.h" #include "FileSourceCode.h"
#include "Image.h" #include "Image.h"
#include "ImageDebugInfo.h" #include "ImageDebugInfo.h"
#include "InspectorWindow.h"
#include "LocatableFile.h" #include "LocatableFile.h"
#include "MessageCodes.h" #include "MessageCodes.h"
#include "RegistersView.h" #include "RegistersView.h"
@ -203,6 +204,22 @@ void
TeamWindow::MessageReceived(BMessage* message) TeamWindow::MessageReceived(BMessage* message)
{ {
switch (message->what) { switch (message->what) {
case MSG_SHOW_INSPECTOR_WINDOW:
{
if (fInspectorWindow) {
fInspectorWindow->Activate(true);
break;
}
try {
fInspectorWindow = InspectorWindow::Create(fListener);
if (fInspectorWindow != NULL)
fInspectorWindow->Show();
} catch (...) {
// TODO: notify user
}
break;
}
case B_REFS_RECEIVED: case B_REFS_RECEIVED:
{ {
entry_ref locatedPath; entry_ref locatedPath;
@ -537,6 +554,12 @@ TeamWindow::_Init()
item = new BMenuItem("Select All", new BMessage(B_SELECT_ALL), 'A'); item = new BMenuItem("Select All", new BMessage(B_SELECT_ALL), 'A');
menu->AddItem(item); menu->AddItem(item);
item->SetTarget(this); item->SetTarget(this);
menu = new BMenu("Tools");
fMenuBar->AddItem(menu);
item = new BMenuItem("Inspect Memory",
new BMessage(MSG_SHOW_INSPECTOR_WINDOW), 'I');
menu->AddItem(item);
item->SetTarget(this);
AutoLocker< ::Team> locker(fTeam); AutoLocker< ::Team> locker(fTeam);
_UpdateRunButtons(); _UpdateRunButtons();

View File

@ -27,6 +27,7 @@ class BMenuBar;
class BStringView; class BStringView;
class BTabView; class BTabView;
class Image; class Image;
class InspectorWindow;
class RegistersView; class RegistersView;
class SourceCode; class SourceCode;
class StackFrame; class StackFrame;
@ -161,6 +162,7 @@ private:
BButton* fStepOutButton; BButton* fStepOutButton;
BMenuBar* fMenuBar; BMenuBar* fMenuBar;
BStringView* fSourcePathView; BStringView* fSourcePathView;
InspectorWindow* fInspectorWindow;
}; };