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 862895233b..9042ff3e16 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp @@ -261,8 +261,9 @@ TeamWindow::MessageReceived(BMessage* message) } try { - WatchPromptWindow* window = WatchPromptWindow::Create(address, - type, length, fListener); + WatchPromptWindow* window = WatchPromptWindow::Create( + fTeam->GetArchitecture(), address, type, length, + fListener); window->Show(); } catch (...) { // TODO: notify user diff --git a/src/apps/debugger/user_interface/gui/team_window/WatchPromptWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/WatchPromptWindow.cpp index 2718ce80ff..8464582e1f 100644 --- a/src/apps/debugger/user_interface/gui/team_window/WatchPromptWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/WatchPromptWindow.cpp @@ -15,38 +15,43 @@ #include +#include "Architecture.h" #include "MessageCodes.h" #include "UserInterface.h" #include "Watchpoint.h" -WatchPromptWindow::WatchPromptWindow(target_addr_t address, uint32 type, - int32 length, UserInterfaceListener* listener) +WatchPromptWindow::WatchPromptWindow(Architecture* architecture, + target_addr_t address, uint32 type, int32 length, + UserInterfaceListener* listener) : BWindow(BRect(), "Edit Watchpoint", B_FLOATING_WINDOW, B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE), fInitialAddress(address), fInitialType(type), fInitialLength(length), + fArchitecture(architecture), fAddressInput(NULL), fLengthInput(NULL), fTypeField(NULL), fListener(listener) { + fArchitecture->AcquireReference(); } WatchPromptWindow::~WatchPromptWindow() { + fArchitecture->ReleaseReference(); } WatchPromptWindow* -WatchPromptWindow::Create(target_addr_t address, uint32 type, int32 length, - UserInterfaceListener* listener) +WatchPromptWindow::Create(Architecture* architecture, target_addr_t address, + uint32 type, int32 length, UserInterfaceListener* listener) { - WatchPromptWindow* self = new WatchPromptWindow(address, type, length, - listener); + WatchPromptWindow* self = new WatchPromptWindow(architecture, address, + type, length, listener); try { self->_Init(); @@ -69,10 +74,29 @@ WatchPromptWindow::_Init() text.SetToFormat("%" B_PRId32, fInitialLength); fLengthInput = new BTextControl("Length:", text, NULL); + int32 maxDebugRegisters = 0; + int32 maxBytesPerRegister = 0; + uint8 debugCapabilityFlags = 0; + fArchitecture->GetWatchpointDebugCapabilities(maxDebugRegisters, + maxBytesPerRegister, debugCapabilityFlags); + BMenu* typeMenu = new BMenu("Watch Type"); - typeMenu->AddItem(new BMenuItem("Read", NULL)); - typeMenu->AddItem(new BMenuItem("Write", NULL)); - typeMenu->AddItem(new BMenuItem("Read/Write", NULL)); + + BMenuItem* watchTypeItem = new BMenuItem("Read", NULL); + watchTypeItem->SetEnabled( + (debugCapabilityFlags & WATCHPOINT_CAPABILITY_FLAG_READ) != 0); + typeMenu->AddItem(watchTypeItem); + + watchTypeItem = new BMenuItem("Write", NULL); + watchTypeItem->SetEnabled( + (debugCapabilityFlags & WATCHPOINT_CAPABILITY_FLAG_WRITE) != 0); + typeMenu->AddItem(watchTypeItem); + + watchTypeItem = new BMenuItem("Read/Write", NULL); + watchTypeItem->SetEnabled( + (debugCapabilityFlags & WATCHPOINT_CAPABILITY_FLAG_READ_WRITE) != 0); + typeMenu->AddItem(watchTypeItem); + fTypeField = new BMenuField("Type:", typeMenu); BLayoutItem* labelItem = fTypeField->CreateLabelLayoutItem(); labelItem->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); diff --git a/src/apps/debugger/user_interface/gui/team_window/WatchPromptWindow.h b/src/apps/debugger/user_interface/gui/team_window/WatchPromptWindow.h index 465fdd696c..5854ca8e4e 100644 --- a/src/apps/debugger/user_interface/gui/team_window/WatchPromptWindow.h +++ b/src/apps/debugger/user_interface/gui/team_window/WatchPromptWindow.h @@ -11,6 +11,7 @@ #include "types/Types.h" +class Architecture; class BTextControl; class Watchpoint; class BMenuField; @@ -20,14 +21,15 @@ class UserInterfaceListener; class WatchPromptWindow : public BWindow { public: - // edit existing watchpoint - WatchPromptWindow(target_addr_t address, - uint32 type, int32 length, + WatchPromptWindow(Architecture* architecture, + target_addr_t address, uint32 type, + int32 length, UserInterfaceListener* listener); ~WatchPromptWindow(); - static WatchPromptWindow* Create(target_addr_t address, uint32 type, + static WatchPromptWindow* Create(Architecture* architecture, + target_addr_t address, uint32 type, int32 length, UserInterfaceListener* listener); // throws @@ -45,6 +47,7 @@ private: target_addr_t fInitialAddress; uint32 fInitialType; int32 fInitialLength; + Architecture* fArchitecture; BTextControl* fAddressInput; BTextControl* fLengthInput; BMenuField* fTypeField;