| 
									
										
										
										
											2015-05-24 06:55:12 +02:00
										 |  |  | // Copyright 2008 Dolphin Emulator Project
 | 
					
						
							| 
									
										
										
										
											2015-05-18 01:08:10 +02:00
										 |  |  | // Licensed under GPLv2+
 | 
					
						
							| 
									
										
										
										
											2013-04-17 23:09:55 -04:00
										 |  |  | // Refer to the license.txt file included.
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-10 13:54:46 -05:00
										 |  |  | #pragma once
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <string>
 | 
					
						
							| 
									
										
										
										
											2014-02-17 05:18:15 -05:00
										 |  |  | #include <vector>
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-17 05:18:15 -05:00
										 |  |  | #include "Common/CommonTypes.h"
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-28 12:15:31 +00:00
										 |  |  | class DebugInterface; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | struct TBreakPoint | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2014-02-09 18:29:13 -05:00
										 |  |  | 	u32  iAddress; | 
					
						
							|  |  |  | 	bool bOn; | 
					
						
							|  |  |  | 	bool bTemporary; | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct TMemCheck | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2014-08-30 16:14:56 -04:00
										 |  |  | 	TMemCheck() | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2008-12-20 14:00:33 +00:00
										 |  |  | 		numHits = 0; | 
					
						
							| 
									
										
										
										
											2011-02-25 09:35:56 +00:00
										 |  |  | 		StartAddress = EndAddress = 0; | 
					
						
							|  |  |  | 		bRange = OnRead = OnWrite = Log = Break = false; | 
					
						
							| 
									
										
										
										
											2008-12-20 14:00:33 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-08-30 16:14:56 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 	u32 StartAddress; | 
					
						
							|  |  |  | 	u32 EndAddress; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 18:29:13 -05:00
										 |  |  | 	bool bRange; | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 18:29:13 -05:00
										 |  |  | 	bool OnRead; | 
					
						
							|  |  |  | 	bool OnWrite; | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 18:29:13 -05:00
										 |  |  | 	bool Log; | 
					
						
							|  |  |  | 	bool Break; | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 18:29:13 -05:00
										 |  |  | 	u32 numHits; | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-23 01:22:35 -04:00
										 |  |  | 	// returns whether to break
 | 
					
						
							|  |  |  | 	bool Action(DebugInterface *dbg_interface, u32 _iValue, u32 addr, | 
					
						
							| 
									
										
										
										
											2014-02-09 18:29:13 -05:00
										 |  |  | 	            bool write, int size, u32 pc); | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-19 21:45:40 +11:00
										 |  |  | struct TWatch | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	std::string name = ""; | 
					
						
							|  |  |  | 	u32  iAddress; | 
					
						
							|  |  |  | 	bool bOn; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-20 14:00:33 +00:00
										 |  |  | // Code breakpoints.
 | 
					
						
							|  |  |  | class BreakPoints | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	typedef std::vector<TBreakPoint> TBreakPoints; | 
					
						
							| 
									
										
										
										
											2011-02-25 09:35:56 +00:00
										 |  |  | 	typedef std::vector<std::string> TBreakPointsStr; | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-21 08:39:21 +00:00
										 |  |  | 	const TBreakPoints& GetBreakPoints() { return m_BreakPoints; } | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-25 09:35:56 +00:00
										 |  |  | 	TBreakPointsStr GetStrings() const; | 
					
						
							|  |  |  | 	void AddFromStrings(const TBreakPointsStr& bps); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 	// is address breakpoint
 | 
					
						
							| 
									
										
										
										
											2015-04-15 00:38:21 -04:00
										 |  |  | 	bool IsAddressBreakPoint(u32 address) const; | 
					
						
							|  |  |  | 	bool IsTempBreakPoint(u32 address) const; | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-25 09:35:56 +00:00
										 |  |  | 	// Add BreakPoint
 | 
					
						
							| 
									
										
										
										
											2015-02-15 14:43:31 -05:00
										 |  |  | 	void Add(u32 em_address, bool temp = false); | 
					
						
							| 
									
										
										
										
											2011-02-25 09:35:56 +00:00
										 |  |  | 	void Add(const TBreakPoint& bp); | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Remove Breakpoint
 | 
					
						
							| 
									
										
										
										
											2011-02-25 09:35:56 +00:00
										 |  |  | 	void Remove(u32 _iAddress); | 
					
						
							| 
									
										
										
										
											2012-03-15 21:48:19 +11:00
										 |  |  | 	void Clear(); | 
					
						
							| 
									
										
										
										
											2014-10-18 11:02:26 +11:00
										 |  |  | 	void ClearAllTemporary(); | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2009-06-21 08:39:21 +00:00
										 |  |  | 	TBreakPoints m_BreakPoints; | 
					
						
							| 
									
										
										
										
											2008-12-20 14:00:33 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-20 14:00:33 +00:00
										 |  |  | // Memory breakpoints
 | 
					
						
							|  |  |  | class MemChecks | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	typedef std::vector<TMemCheck> TMemChecks; | 
					
						
							| 
									
										
										
										
											2011-02-25 09:35:56 +00:00
										 |  |  | 	typedef std::vector<std::string> TMemChecksStr; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-21 08:39:21 +00:00
										 |  |  | 	TMemChecks m_MemChecks; | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-25 09:35:56 +00:00
										 |  |  | 	const TMemChecks& GetMemChecks() { return m_MemChecks; } | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-25 09:35:56 +00:00
										 |  |  | 	TMemChecksStr GetStrings() const; | 
					
						
							|  |  |  | 	void AddFromStrings(const TMemChecksStr& mcs); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-21 08:39:21 +00:00
										 |  |  | 	void Add(const TMemCheck& _rMemoryCheck); | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-25 09:35:56 +00:00
										 |  |  | 	// memory breakpoint
 | 
					
						
							| 
									
										
										
										
											2009-06-21 08:39:21 +00:00
										 |  |  | 	TMemCheck *GetMemCheck(u32 address); | 
					
						
							| 
									
										
										
										
											2013-10-17 00:32:18 -04:00
										 |  |  | 	void Remove(u32 _Address); | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-11 13:00:40 -04:00
										 |  |  | 	void Clear() { m_MemChecks.clear(); } | 
					
						
							| 
									
										
										
										
											2015-04-23 00:05:31 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	bool HasAny() const { return !m_MemChecks.empty(); } | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2014-10-19 21:45:40 +11:00
										 |  |  | 
 | 
					
						
							|  |  |  | class Watches | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	typedef std::vector<TWatch> TWatches; | 
					
						
							|  |  |  | 	typedef std::vector<std::string> TWatchesStr; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	const TWatches& GetWatches() { return m_Watches; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	TWatchesStr GetStrings() const; | 
					
						
							|  |  |  | 	void AddFromStrings(const TWatchesStr& bps); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-28 04:28:50 -07:00
										 |  |  | 	bool IsAddressWatch(u32 _iAddress) const; | 
					
						
							| 
									
										
										
										
											2014-10-19 21:45:40 +11:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Add BreakPoint
 | 
					
						
							|  |  |  | 	void Add(u32 em_address); | 
					
						
							|  |  |  | 	void Add(const TWatch& bp); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void Update(int count, u32 em_address); | 
					
						
							| 
									
										
										
										
											2014-10-26 23:23:45 +11:00
										 |  |  | 	void UpdateName(int count, const std::string name); | 
					
						
							| 
									
										
										
										
											2014-10-19 21:45:40 +11:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Remove Breakpoint
 | 
					
						
							|  |  |  | 	void Remove(u32 _iAddress); | 
					
						
							|  |  |  | 	void Clear(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 	TWatches m_Watches; | 
					
						
							| 
									
										
										
										
											2014-10-28 04:28:50 -07:00
										 |  |  | }; |