Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.
  • Loading branch information...
commit 4f9eec722ccbf709057a8c8df2539772ead7199e 1 parent 36b41db
@anevilyak anevilyak authored
View
13 src/apps/debugger/arch/Architecture.h
@@ -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 @@ class Architecture : public BReferenceable {
bool useExistingTrace = false);
// team is not locked
+ virtual status_t GetWatchpointDebugCapabilities(
+ int32& _maxRegisterCount,
+ uint8& _watchpointCapabilityFlags) = 0;
+
+
protected:
TeamMemory* fTeamMemory;
uint8 fAddressSize;
View
18 src/apps/debugger/arch/x86/ArchitectureX86.cpp
@@ -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
8 src/apps/debugger/arch/x86/ArchitectureX86.h
@@ -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 @@ class ArchitectureX86 : public Architecture {
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 @@ class ArchitectureX86 : public Architecture {
virtual status_t GetInstructionInfo(target_addr_t address,
InstructionInfo& _info);
+ virtual status_t GetWatchpointDebugCapabilities(
+ int32& _maxRegisterCount,
+ uint8& _watchpointCapabilityFlags);
+
private:
struct ToDwarfRegisterMap;
struct FromDwarfRegisterMap;
Please sign in to comment.
Something went wrong with that request. Please try again.