diff --git a/src/apps/debugger/MessageCodes.h b/src/apps/debugger/MessageCodes.h index 176ee98d20..1c76897bde 100644 --- a/src/apps/debugger/MessageCodes.h +++ b/src/apps/debugger/MessageCodes.h @@ -45,6 +45,7 @@ enum { MSG_SHOW_TEAMS_WINDOW = 'stsw', MSG_TEAMS_WINDOW_CLOSED = 'tswc', MSG_DEBUG_THIS_TEAM = 'dbtt', + MSG_SHOW_INSPECTOR_WINDOW = 'sirw', MSG_INSPECTOR_WINDOW_CLOSED = 'irwc', MSG_INSPECT_ADDRESS = 'isad' }; diff --git a/src/apps/debugger/TeamDebugger.cpp b/src/apps/debugger/TeamDebugger.cpp index 3ff224ac9f..821ede0ab1 100644 --- a/src/apps/debugger/TeamDebugger.cpp +++ b/src/apps/debugger/TeamDebugger.cpp @@ -142,6 +142,7 @@ TeamDebugger::TeamDebugger(Listener* listener, UserInterface* userInterface, fFileManager(NULL), fWorker(NULL), fBreakpointManager(NULL), + fMemoryBlockManager(NULL), fDebugEventListener(-1), fUserInterface(userInterface), fTerminating(false), @@ -296,6 +297,15 @@ TeamDebugger::Init(team_id teamID, thread_id threadID, bool stopInMain) if (error != B_OK) 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 fDebuggerInterface->SetTeamDebuggingFlags( B_TEAM_DEBUG_THREADS | B_TEAM_DEBUG_IMAGES); @@ -757,6 +767,7 @@ void TeamDebugger::JobFailed(Job* job) { TRACE_JOBS("TeamDebugger::JobFailed(%p)\n", job); + // TODO: notify user } diff --git a/src/apps/debugger/TeamMemoryBlockManager.cpp b/src/apps/debugger/TeamMemoryBlockManager.cpp index 7921636805..ae5e494596 100644 --- a/src/apps/debugger/TeamMemoryBlockManager.cpp +++ b/src/apps/debugger/TeamMemoryBlockManager.cpp @@ -122,7 +122,7 @@ TeamMemoryBlockManager::GetMemoryBlock(target_addr_t address) { AutoLocker lock(fLock); - address &= ~B_PAGE_SIZE - 1; + address &= ~(B_PAGE_SIZE - 1); MemoryBlockEntry* entry = fActiveBlocks->Lookup(address); if (entry != NULL) { if (entry->block->AcquireReference() != 0) diff --git a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp index 9457b5e29b..5c32c44f70 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp @@ -32,6 +32,7 @@ #include "FileSourceCode.h" #include "Image.h" #include "ImageDebugInfo.h" +#include "InspectorWindow.h" #include "LocatableFile.h" #include "MessageCodes.h" #include "RegistersView.h" @@ -203,6 +204,22 @@ void TeamWindow::MessageReceived(BMessage* message) { 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: { entry_ref locatedPath; @@ -537,6 +554,12 @@ TeamWindow::_Init() item = new BMenuItem("Select All", new BMessage(B_SELECT_ALL), 'A'); menu->AddItem(item); 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); _UpdateRunButtons(); diff --git a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h index 64796f54a4..03239ba818 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h @@ -27,6 +27,7 @@ class BMenuBar; class BStringView; class BTabView; class Image; +class InspectorWindow; class RegistersView; class SourceCode; class StackFrame; @@ -161,6 +162,7 @@ private: BButton* fStepOutButton; BMenuBar* fMenuBar; BStringView* fSourcePathView; + InspectorWindow* fInspectorWindow; };