Author: anevilyak Date: 2011-06-13 04:09:12 +0200 (Mon, 13 Jun 2011) New Revision: 42143 Changeset: https://dev.haiku-os.org/changeset/42143 Modified: haiku/trunk/src/apps/debugger/MessageCodes.h haiku/trunk/src/apps/debugger/TeamDebugger.cpp haiku/trunk/src/apps/debugger/TeamMemoryBlockManager.cpp haiku/trunk/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp haiku/trunk/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h Log: 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. Modified: haiku/trunk/src/apps/debugger/MessageCodes.h =================================================================== --- haiku/trunk/src/apps/debugger/MessageCodes.h 2011-06-13 01:53:11 UTC (rev 42142) +++ haiku/trunk/src/apps/debugger/MessageCodes.h 2011-06-13 02:09:12 UTC (rev 42143) @@ -45,6 +45,7 @@ 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' }; Modified: haiku/trunk/src/apps/debugger/TeamDebugger.cpp =================================================================== --- haiku/trunk/src/apps/debugger/TeamDebugger.cpp 2011-06-13 01:53:11 UTC (rev 42142) +++ haiku/trunk/src/apps/debugger/TeamDebugger.cpp 2011-06-13 02:09:12 UTC (rev 42143) @@ -142,6 +142,7 @@ fFileManager(NULL), fWorker(NULL), fBreakpointManager(NULL), + fMemoryBlockManager(NULL), fDebugEventListener(-1), fUserInterface(userInterface), fTerminating(false), @@ -296,6 +297,15 @@ 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 @@ TeamDebugger::JobFailed(Job* job) { TRACE_JOBS("TeamDebugger::JobFailed(%p)\n", job); + // TODO: notify user } Modified: haiku/trunk/src/apps/debugger/TeamMemoryBlockManager.cpp =================================================================== --- haiku/trunk/src/apps/debugger/TeamMemoryBlockManager.cpp 2011-06-13 01:53:11 UTC (rev 42142) +++ haiku/trunk/src/apps/debugger/TeamMemoryBlockManager.cpp 2011-06-13 02:09:12 UTC (rev 42143) @@ -122,7 +122,7 @@ { AutoLocker<BLocker> 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) Modified: haiku/trunk/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp =================================================================== --- haiku/trunk/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp 2011-06-13 01:53:11 UTC (rev 42142) +++ haiku/trunk/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp 2011-06-13 02:09:12 UTC (rev 42143) @@ -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 @@ 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 @@ 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(); Modified: haiku/trunk/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h =================================================================== --- haiku/trunk/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h 2011-06-13 01:53:11 UTC (rev 42142) +++ haiku/trunk/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h 2011-06-13 02:09:12 UTC (rev 42143) @@ -27,6 +27,7 @@ class BStringView; class BTabView; class Image; +class InspectorWindow; class RegistersView; class SourceCode; class StackFrame; @@ -161,6 +162,7 @@ BButton* fStepOutButton; BMenuBar* fMenuBar; BStringView* fSourcePathView; + InspectorWindow* fInspectorWindow; };