hrev44823 adds 2 changesets to branch 'master' old head: 5f78788af97122fa9af398364a21e89027529600 new head: 5ad155d720823ffacbab56f4dff94f41d32d60d4 ---------------------------------------------------------------------------- 6be4555: Also report back the number of bytes each register can watch. 5ad155d: Use Architecture information in WatchPromptWindow. - We now check what types of watchpoints the target CPU supports and limit the UI accordingly. [ Rene Gollent <anevilyak@xxxxxxxxx> ] ---------------------------------------------------------------------------- 6 files changed, 47 insertions(+), 16 deletions(-) src/apps/debugger/arch/Architecture.h | 1 + src/apps/debugger/arch/x86/ArchitectureX86.cpp | 3 +- src/apps/debugger/arch/x86/ArchitectureX86.h | 1 + .../gui/team_window/TeamWindow.cpp | 5 ++- .../gui/team_window/WatchPromptWindow.cpp | 42 +++++++++++++++----- .../gui/team_window/WatchPromptWindow.h | 11 +++-- ############################################################################ Commit: 6be4555f928cf3287544a0a7e0ba63de45b85fff URL: http://cgit.haiku-os.org/haiku/commit/?id=6be4555 Author: Rene Gollent <anevilyak@xxxxxxxxx> Date: Tue Nov 13 01:22:15 2012 UTC Also report back the number of bytes each register can watch. ---------------------------------------------------------------------------- diff --git a/src/apps/debugger/arch/Architecture.h b/src/apps/debugger/arch/Architecture.h index 8d7ed43..998d3be 100644 --- a/src/apps/debugger/arch/Architecture.h +++ b/src/apps/debugger/arch/Architecture.h @@ -114,6 +114,7 @@ public: virtual status_t GetWatchpointDebugCapabilities( int32& _maxRegisterCount, + int32& _maxBytesPerRegister, uint8& _watchpointCapabilityFlags) = 0; diff --git a/src/apps/debugger/arch/x86/ArchitectureX86.cpp b/src/apps/debugger/arch/x86/ArchitectureX86.cpp index 5447247..bc2e075 100644 --- a/src/apps/debugger/arch/x86/ArchitectureX86.cpp +++ b/src/apps/debugger/arch/x86/ArchitectureX86.cpp @@ -613,12 +613,13 @@ ArchitectureX86::GetInstructionInfo(target_addr_t address, status_t ArchitectureX86::GetWatchpointDebugCapabilities(int32& _maxRegisterCount, - uint8& _watchpointCapabilityFlags) + int32& _maxBytesPerRegister, uint8& _watchpointCapabilityFlags) { // while x86 technically has 4 hardware debug registers, one is reserved by // the kernel, and one is required for breakpoint support, which leaves // two available for watchpoints. _maxRegisterCount = 2; + _maxBytesPerRegister = 4; // x86 only supports write and read/write watchpoints. _watchpointCapabilityFlags = WATCHPOINT_CAPABILITY_FLAG_WRITE diff --git a/src/apps/debugger/arch/x86/ArchitectureX86.h b/src/apps/debugger/arch/x86/ArchitectureX86.h index b58be05..48e849c 100644 --- a/src/apps/debugger/arch/x86/ArchitectureX86.h +++ b/src/apps/debugger/arch/x86/ArchitectureX86.h @@ -63,6 +63,7 @@ public: virtual status_t GetWatchpointDebugCapabilities( int32& _maxRegisterCount, + int32& _maxBytesPerRegister, uint8& _watchpointCapabilityFlags); private: ############################################################################ Revision: hrev44823 Commit: 5ad155d720823ffacbab56f4dff94f41d32d60d4 URL: http://cgit.haiku-os.org/haiku/commit/?id=5ad155d Author: Rene Gollent <anevilyak@xxxxxxxxx> Date: Tue Nov 13 01:22:47 2012 UTC Use Architecture information in WatchPromptWindow. - We now check what types of watchpoints the target CPU supports and limit the UI accordingly. ---------------------------------------------------------------------------- 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 8628952..9042ff3 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 2718ce8..8464582 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 <ExpressionParser.h> +#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 465fdd6..5854ca8 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;