| 
									
										
										
										
											2009-07-28 21:32:10 +00:00
										 |  |  | // Copyright (C) 2003 Dolphin Project.
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | // This program is free software: you can redistribute it and/or modify
 | 
					
						
							|  |  |  | // it under the terms of the GNU General Public License as published by
 | 
					
						
							|  |  |  | // the Free Software Foundation, version 2.0.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // This program is distributed in the hope that it will be useful,
 | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
					
						
							|  |  |  | // GNU General Public License 2.0 for more details.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // A copy of the GPL 2.0 should have been included with the program.
 | 
					
						
							|  |  |  | // If not, see http://www.gnu.org/licenses/
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Official SVN repository and contact information can be found at
 | 
					
						
							|  |  |  | // http://code.google.com/p/dolphin-emu/
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef _DEBUGGER_BREAKPOINTS_H
 | 
					
						
							|  |  |  | #define _DEBUGGER_BREAKPOINTS_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <vector>
 | 
					
						
							|  |  |  | #include <string>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "Common.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-28 12:15:31 +00:00
										 |  |  | class DebugInterface; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | struct TBreakPoint | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	u32     iAddress; | 
					
						
							|  |  |  | 	bool	bOn; | 
					
						
							|  |  |  | 	bool    bTemporary; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct TMemCheck | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-12-20 14:00:33 +00:00
										 |  |  | 	TMemCheck() { | 
					
						
							|  |  |  | 		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
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 	u32 StartAddress; | 
					
						
							|  |  |  | 	u32 EndAddress; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	bool	bRange; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	bool	OnRead; | 
					
						
							|  |  |  | 	bool	OnWrite; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	bool	Log; | 
					
						
							|  |  |  | 	bool	Break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	u32		numHits; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-25 09:35:56 +00:00
										 |  |  | 	void Action(DebugInterface *dbg_interface, u32 _iValue, u32 addr, | 
					
						
							|  |  |  | 				bool write, int size, u32 pc); | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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
 | 
					
						
							| 
									
										
										
										
											2009-06-21 08:39:21 +00:00
										 |  |  | 	bool IsAddressBreakPoint(u32 _iAddress); | 
					
						
							|  |  |  | 	bool IsTempBreakPoint(u32 _iAddress); | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-25 09:35:56 +00:00
										 |  |  | 	// Add BreakPoint
 | 
					
						
							|  |  |  | 	void Add(u32 em_address, bool temp=false); | 
					
						
							|  |  |  | 	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(); | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-21 08:39:21 +00:00
										 |  |  |     void DeleteByAddress(u32 _Address); | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2009-06-21 08:39:21 +00:00
										 |  |  | 	TBreakPoints m_BreakPoints; | 
					
						
							|  |  |  | 	u32	m_iBreakOnCount; | 
					
						
							| 
									
										
										
										
											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; | 
					
						
							| 
									
										
										
										
											2011-02-25 09:35:56 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	const TMemChecks& GetMemChecks() { return m_MemChecks; } | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	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); | 
					
						
							| 
									
										
										
										
											2011-02-25 09:35:56 +00:00
										 |  |  |     void Remove(u32 _Address); | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-25 09:35:56 +00:00
										 |  |  | 	void Clear() { m_MemChecks.clear(); }; | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 |