[Haiku-commits] r31246 - in haiku/trunk/src/apps/debugger: . arch arch/x86 debugger_interface model

bonefish at BerliOS bonefish at mail.berlios.de
Fri Jun 26 02:39:24 CEST 2009


Author: bonefish
Date: 2009-06-26 02:39:23 +0200 (Fri, 26 Jun 2009)
New Revision: 31246
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=31246&view=rev

Added:
   haiku/trunk/src/apps/debugger/model/TeamMemory.cpp
   haiku/trunk/src/apps/debugger/model/TeamMemory.h
Modified:
   haiku/trunk/src/apps/debugger/Jamfile
   haiku/trunk/src/apps/debugger/arch/Architecture.cpp
   haiku/trunk/src/apps/debugger/arch/Architecture.h
   haiku/trunk/src/apps/debugger/arch/ArchitectureTypes.h
   haiku/trunk/src/apps/debugger/arch/x86/ArchitectureX86.cpp
   haiku/trunk/src/apps/debugger/arch/x86/ArchitectureX86.h
   haiku/trunk/src/apps/debugger/debugger_interface/DebuggerInterface.h
   haiku/trunk/src/apps/debugger/model/TeamDebugModel.cpp
   haiku/trunk/src/apps/debugger/model/TeamDebugModel.h
Log:
Pulled interface TeamMemory out of DebuggerInterface to make the arch and model
packages indepent of the latter.


Modified: haiku/trunk/src/apps/debugger/Jamfile
===================================================================
--- haiku/trunk/src/apps/debugger/Jamfile	2009-06-26 00:37:34 UTC (rev 31245)
+++ haiku/trunk/src/apps/debugger/Jamfile	2009-06-26 00:39:23 UTC (rev 31246)
@@ -71,6 +71,7 @@
 	SymbolInfo.cpp
 	Team.cpp
 	TeamDebugModel.cpp
+	TeamMemory.cpp
 	Thread.cpp
 	ThreadInfo.cpp
 

Modified: haiku/trunk/src/apps/debugger/arch/Architecture.cpp
===================================================================
--- haiku/trunk/src/apps/debugger/arch/Architecture.cpp	2009-06-26 00:37:34 UTC (rev 31245)
+++ haiku/trunk/src/apps/debugger/arch/Architecture.cpp	2009-06-26 00:39:23 UTC (rev 31246)
@@ -20,9 +20,9 @@
 #include "Team.h"
 
 
-Architecture::Architecture(DebuggerInterface* debuggerInterface)
+Architecture::Architecture(TeamMemory* teamMemory)
 	:
-	fDebuggerInterface(debuggerInterface)
+	fTeamMemory(teamMemory)
 {
 }
 

Modified: haiku/trunk/src/apps/debugger/arch/Architecture.h
===================================================================
--- haiku/trunk/src/apps/debugger/arch/Architecture.h	2009-06-26 00:37:34 UTC (rev 31245)
+++ haiku/trunk/src/apps/debugger/arch/Architecture.h	2009-06-26 00:39:23 UTC (rev 31246)
@@ -13,7 +13,6 @@
 
 
 class CpuState;
-class DebuggerInterface;
 class FunctionDebugInfo;
 class Image;
 class ImageDebugInfoProvider;
@@ -24,12 +23,12 @@
 class StackTrace;
 class Statement;
 class Team;
+class TeamMemory;
 
 
 class Architecture : public Referenceable {
 public:
-								Architecture(
-									DebuggerInterface* debuggerInterface);
+								Architecture(TeamMemory* teamMemory);
 	virtual						~Architecture();
 
 	virtual	status_t			Init();
@@ -72,7 +71,7 @@
 										// team is not locked
 
 protected:
-			DebuggerInterface*	fDebuggerInterface;
+			TeamMemory*			fTeamMemory;
 };
 
 

Modified: haiku/trunk/src/apps/debugger/arch/ArchitectureTypes.h
===================================================================
--- haiku/trunk/src/apps/debugger/arch/ArchitectureTypes.h	2009-06-26 00:37:34 UTC (rev 31245)
+++ haiku/trunk/src/apps/debugger/arch/ArchitectureTypes.h	2009-06-26 00:39:23 UTC (rev 31246)
@@ -5,7 +5,9 @@
 #ifndef ARCHITECTURE_TYPES_H
 #define ARCHITECTURE_TYPES_H
 
+#include <SupportDefs.h>
 
+
 typedef uint64 target_addr_t;
 typedef uint64 target_size_t;
 

Modified: haiku/trunk/src/apps/debugger/arch/x86/ArchitectureX86.cpp
===================================================================
--- haiku/trunk/src/apps/debugger/arch/x86/ArchitectureX86.cpp	2009-06-26 00:37:34 UTC (rev 31245)
+++ haiku/trunk/src/apps/debugger/arch/x86/ArchitectureX86.cpp	2009-06-26 00:39:23 UTC (rev 31246)
@@ -12,19 +12,19 @@
 #include <AutoDeleter.h>
 
 #include "CpuStateX86.h"
-#include "DebuggerInterface.h"
 #include "DisassembledCode.h"
 #include "FunctionDebugInfo.h"
 #include "InstructionInfo.h"
 #include "StackFrame.h"
 #include "Statement.h"
+#include "TeamMemory.h"
 
 #include "disasm/DisassemblerX86.h"
 
 
-ArchitectureX86::ArchitectureX86(DebuggerInterface* debuggerInterface)
+ArchitectureX86::ArchitectureX86(TeamMemory* teamMemory)
 	:
-	Architecture(debuggerInterface)
+	Architecture(teamMemory)
 {
 }
 
@@ -138,7 +138,7 @@
 		// stack.
 		uint32 esp = cpuState->IntRegisterValue(X86_REGISTER_ESP);
 		uint32 address;
-		if (fDebuggerInterface->ReadMemory(esp, &address, 4) == 4) {
+		if (fTeamMemory->ReadMemory(esp, &address, 4) == 4) {
 			returnAddress = address;
 			previousFramePointer = framePointer;
 			framePointer = 0;
@@ -171,7 +171,7 @@
 				// The epilogue is a single "pop %ebp", so we check whether the
 				// current instruction is already a "ret".
 				uint8 code[1];
-				if (fDebuggerInterface->ReadMemory(eip, &code, 1) == 1
+				if (fTeamMemory->ReadMemory(eip, &code, 1) == 1
 					&& code[0] == 0xc3) {
 					stack = cpuState->IntRegisterValue(X86_REGISTER_ESP);
 				}
@@ -179,7 +179,7 @@
 
 			if (stack != 0) {
 				uint32 address;
-				if (fDebuggerInterface->ReadMemory(stack, &address, 4) == 4) {
+				if (fTeamMemory->ReadMemory(stack, &address, 4) == 4) {
 					returnAddress = address;
 					previousFramePointer = framePointer;
 					framePointer = 0;
@@ -201,8 +201,7 @@
 	if (readStandardFrame) {
 		uint32 frameData[2];
 		if (framePointer != 0
-			&& fDebuggerInterface->ReadMemory(framePointer, frameData, 8)
-				== 8) {
+			&& fTeamMemory->ReadMemory(framePointer, frameData, 8) == 8) {
 			previousFramePointer = frameData[0];
 			returnAddress = frameData[1];
 		}
@@ -252,7 +251,7 @@
 	MemoryDeleter bufferDeleter(buffer);
 
 	// read the code
-	ssize_t bytesRead = fDebuggerInterface->ReadMemory(functionAddress, buffer,
+	ssize_t bytesRead = fTeamMemory->ReadMemory(functionAddress, buffer,
 		bufferSize);
 	if (bytesRead != (ssize_t)bufferSize)
 		return;
@@ -339,7 +338,7 @@
 	// read the code
 	uint8 buffer[16];
 		// TODO: What's the maximum instruction size?
-	ssize_t bytesRead = fDebuggerInterface->ReadMemory(address, buffer,
+	ssize_t bytesRead = fTeamMemory->ReadMemory(address, buffer,
 		sizeof(buffer));
 	if (bytesRead < 0)
 		return bytesRead;
@@ -410,7 +409,7 @@
 		return false;
 
 	uint8 buffer[3];
-	if (fDebuggerInterface->ReadMemory(function->Address(), buffer, 3) != 3)
+	if (fTeamMemory->ReadMemory(function->Address(), buffer, 3) != 3)
 		return false;
 
 	return buffer[0] == 0x55 && buffer[1] == 0x89 && buffer[2] == 0xe5;

Modified: haiku/trunk/src/apps/debugger/arch/x86/ArchitectureX86.h
===================================================================
--- haiku/trunk/src/apps/debugger/arch/x86/ArchitectureX86.h	2009-06-26 00:37:34 UTC (rev 31245)
+++ haiku/trunk/src/apps/debugger/arch/x86/ArchitectureX86.h	2009-06-26 00:39:23 UTC (rev 31246)
@@ -12,8 +12,7 @@
 
 class ArchitectureX86 : public Architecture {
 public:
-								ArchitectureX86(
-									DebuggerInterface* debuggerInterface);
+								ArchitectureX86(TeamMemory* teamMemory);
 	virtual						~ArchitectureX86();
 
 	virtual	status_t			Init();

Modified: haiku/trunk/src/apps/debugger/debugger_interface/DebuggerInterface.h
===================================================================
--- haiku/trunk/src/apps/debugger/debugger_interface/DebuggerInterface.h	2009-06-26 00:37:34 UTC (rev 31245)
+++ haiku/trunk/src/apps/debugger/debugger_interface/DebuggerInterface.h	2009-06-26 00:39:23 UTC (rev 31246)
@@ -10,7 +10,7 @@
 #include <debug_support.h>
 #include <ObjectList.h>
 
-#include "ArchitectureTypes.h"
+#include "TeamMemory.h"
 
 
 class Architecture;
@@ -21,7 +21,7 @@
 class ThreadInfo;
 
 
-class DebuggerInterface {
+class DebuggerInterface : public TeamMemory {
 public:
 								DebuggerInterface(team_id teamID);
 	virtual						~DebuggerInterface();
@@ -54,7 +54,8 @@
 									CpuState*& _state);
 										// returns a reference to the caller
 
-	ssize_t						ReadMemory(target_addr_t address, void* buffer,
+	// TeamMemory
+	virtual	ssize_t				ReadMemory(target_addr_t address, void* buffer,
 									size_t size);
 
 private:

Modified: haiku/trunk/src/apps/debugger/model/TeamDebugModel.cpp
===================================================================
--- haiku/trunk/src/apps/debugger/model/TeamDebugModel.cpp	2009-06-26 00:37:34 UTC (rev 31245)
+++ haiku/trunk/src/apps/debugger/model/TeamDebugModel.cpp	2009-06-26 00:39:23 UTC (rev 31246)
@@ -37,11 +37,11 @@
 // #pragma mark - TeamDebugModel
 
 
-TeamDebugModel::TeamDebugModel(Team* team, DebuggerInterface* debuggerInterface,
+TeamDebugModel::TeamDebugModel(Team* team, TeamMemory* teamMemory,
 	Architecture* architecture)
 	:
 	fTeam(team),
-	fDebuggerInterface(debuggerInterface),
+	fTeamMemory(teamMemory),
 	fArchitecture(architecture)
 {
 }

Modified: haiku/trunk/src/apps/debugger/model/TeamDebugModel.h
===================================================================
--- haiku/trunk/src/apps/debugger/model/TeamDebugModel.h	2009-06-26 00:37:34 UTC (rev 31245)
+++ haiku/trunk/src/apps/debugger/model/TeamDebugModel.h	2009-06-26 00:39:23 UTC (rev 31246)
@@ -22,7 +22,7 @@
 
 class Architecture;
 class Breakpoint;
-class DebuggerInterface;
+class TeamMemory;
 
 
 class TeamDebugModel {
@@ -33,7 +33,7 @@
 
 public:
 								TeamDebugModel(Team* team,
-									DebuggerInterface* debuggerInterface,
+									TeamMemory* teamMemory,
 									Architecture* architecture);
 								~TeamDebugModel();
 
@@ -43,8 +43,8 @@
 			void				Unlock()	{ fTeam->Unlock(); }
 
 			Team*				GetTeam() const	{ return fTeam; }
-			DebuggerInterface*	GetDebuggerInterface() const
-									{ return fDebuggerInterface; }
+			TeamMemory*			GetTeamMemory() const
+									{ return fTeamMemory; }
 			Architecture*		GetArchitecture() const
 									{ return fArchitecture; }
 
@@ -79,7 +79,7 @@
 
 private:
 			Team*				fTeam;
-			DebuggerInterface*	fDebuggerInterface;
+			TeamMemory*			fTeamMemory;
 			Architecture*		fArchitecture;
 			BreakpointList		fBreakpoints;
 			ListenerList		fListeners;

Added: haiku/trunk/src/apps/debugger/model/TeamMemory.cpp
===================================================================
--- haiku/trunk/src/apps/debugger/model/TeamMemory.cpp	2009-06-26 00:37:34 UTC (rev 31245)
+++ haiku/trunk/src/apps/debugger/model/TeamMemory.cpp	2009-06-26 00:39:23 UTC (rev 31246)
@@ -0,0 +1,11 @@
+/*
+ * Copyright 2009, Ingo Weinhold, ingo_weinhold at gmx.de.
+ * Distributed under the terms of the MIT License.
+ */
+
+#include "TeamMemory.h"
+
+
+TeamMemory::~TeamMemory()
+{
+}

Added: haiku/trunk/src/apps/debugger/model/TeamMemory.h
===================================================================
--- haiku/trunk/src/apps/debugger/model/TeamMemory.h	2009-06-26 00:37:34 UTC (rev 31245)
+++ haiku/trunk/src/apps/debugger/model/TeamMemory.h	2009-06-26 00:39:23 UTC (rev 31246)
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2009, Ingo Weinhold, ingo_weinhold at gmx.de.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef TEAM_MEMORY_H
+#define TEAM_MEMORY_H
+
+#include "TargetAddressRange.h"
+
+
+class TeamMemory {
+public:
+	virtual						~TeamMemory();
+
+
+	virtual	ssize_t				ReadMemory(target_addr_t address, void* buffer,
+									size_t size) = 0;
+};
+
+
+#endif	// TEAM_MEMORY_H




More information about the Haiku-commits mailing list