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.
This commit is contained in:
Rene Gollent 2012-11-11 11:32:30 -05:00
parent 36b41db7aa
commit 4f9eec722c
3 changed files with 35 additions and 4 deletions

View File

@ -1,6 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2011, Rene Gollent, rene@gollent.com.
* Copyright 2011-2012, Rene Gollent, rene@gollent.com.
* 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;

View File

@ -1,6 +1,6 @@
/*
* Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2011, Rene Gollent, rene@gollent.com.
* Copyright 2011-2012, Rene Gollent, rene@gollent.com.
* 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)

View File

@ -1,6 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2011, Rene Gollent, rene@gollent.com.
* Copyright 2011-2012, Rene Gollent, rene@gollent.com.
* 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;