hrev44816 adds 1 changeset to branch 'master' old head: 36b41db7aaa7c0fd032cb408234b58f3839f577c new head: 4f9eec722ccbf709057a8c8df2539772ead7199e ---------------------------------------------------------------------------- 4f9eec7: Add watchpoint capabilities hook to Architecture. Will be used by the watchpoint manager and/or watchpoint UI to present and/or handle the relative limitations of the current platform. [ Rene Gollent <anevilyak@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev44816 Commit: 4f9eec722ccbf709057a8c8df2539772ead7199e URL: http://cgit.haiku-os.org/haiku/commit/?id=4f9eec7 Author: Rene Gollent <anevilyak@xxxxxxxxx> Date: Sun Nov 11 16:32:30 2012 UTC ---------------------------------------------------------------------------- 3 files changed, 35 insertions(+), 4 deletions(-) src/apps/debugger/arch/Architecture.h | 13 ++++++++++++- src/apps/debugger/arch/x86/ArchitectureX86.cpp | 18 +++++++++++++++++- src/apps/debugger/arch/x86/ArchitectureX86.h | 8 ++++++-- ---------------------------------------------------------------------------- diff --git a/src/apps/debugger/arch/Architecture.h b/src/apps/debugger/arch/Architecture.h index 845af2e..0b8ba3a 100644 --- a/src/apps/debugger/arch/Architecture.h +++ b/src/apps/debugger/arch/Architecture.h @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@xxxxxxx - * Copyright 2011, Rene Gollent, rene@xxxxxxxxxxxx + * Copyright 2011-2012, Rene Gollent, rene@xxxxxxxxxxxx * Distributed under the terms of the MIT License. */ #ifndef ARCHITECTURE_H @@ -38,6 +38,12 @@ enum { }; +enum { + WATCHPOINT_CAPABILITY_FLAG_READ = 1, + WATCHPOINT_CAPABILITY_FLAG_WRITE = 2 +}; + + class Architecture : public BReferenceable { public: Architecture(TeamMemory* teamMemory, @@ -105,6 +111,11 @@ public: bool useExistingTrace = false); // team is not locked + virtual status_t GetWatchpointDebugCapabilities( + int32& _maxRegisterCount, + uint8& _watchpointCapabilityFlags) = 0; + + protected: TeamMemory* fTeamMemory; uint8 fAddressSize; diff --git a/src/apps/debugger/arch/x86/ArchitectureX86.cpp b/src/apps/debugger/arch/x86/ArchitectureX86.cpp index 9fd80cf..6cb370b 100644 --- a/src/apps/debugger/arch/x86/ArchitectureX86.cpp +++ b/src/apps/debugger/arch/x86/ArchitectureX86.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@xxxxxxx - * Copyright 2011, Rene Gollent, rene@xxxxxxxxxxxx + * Copyright 2011-2012, Rene Gollent, rene@xxxxxxxxxxxx * Distributed under the terms of the MIT License. */ @@ -611,6 +611,22 @@ ArchitectureX86::GetInstructionInfo(target_addr_t address, } +status_t +ArchitectureX86::GetWatchpointDebugCapabilities(int32& _maxRegisterCount, + 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; + + // x86 only supports write watchpoints. + _watchpointCapabilityFlags = WATCHPOINT_CAPABILITY_FLAG_WRITE; + + return B_OK; +} + + void ArchitectureX86::_AddRegister(int32 index, const char* name, uint32 bitSize, uint32 valueType, register_type type, bool calleePreserved) diff --git a/src/apps/debugger/arch/x86/ArchitectureX86.h b/src/apps/debugger/arch/x86/ArchitectureX86.h index 33369aa..b58be05 100644 --- a/src/apps/debugger/arch/x86/ArchitectureX86.h +++ b/src/apps/debugger/arch/x86/ArchitectureX86.h @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@xxxxxxx - * Copyright 2011, Rene Gollent, rene@xxxxxxxxxxxx + * Copyright 2011-2012, Rene Gollent, rene@xxxxxxxxxxxx * Distributed under the terms of the MIT License. */ #ifndef ARCHITECTURE_X86_H @@ -23,7 +23,7 @@ public: virtual status_t Init(); - virtual int32 StackGrowthDirection() const; + virtual int32 StackGrowthDirection() const; virtual int32 CountRegisters() const; virtual const Register* Registers() const; @@ -61,6 +61,10 @@ public: virtual status_t GetInstructionInfo(target_addr_t address, InstructionInfo& _info); + virtual status_t GetWatchpointDebugCapabilities( + int32& _maxRegisterCount, + uint8& _watchpointCapabilityFlags); + private: struct ToDwarfRegisterMap; struct FromDwarfRegisterMap;