break_points.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // Copyright 2013 Dolphin Emulator Project
  2. // Licensed under GPLv2
  3. // Refer to the license.txt file included.
  4. #ifndef _DEBUGGER_BREAKPOINTS_H
  5. #define _DEBUGGER_BREAKPOINTS_H
  6. #include <vector>
  7. #include <string>
  8. #include "common.h"
  9. class DebugInterface;
  10. struct TBreakPoint
  11. {
  12. u32 iAddress;
  13. bool bOn;
  14. bool bTemporary;
  15. };
  16. struct TMemCheck
  17. {
  18. TMemCheck() {
  19. numHits = 0;
  20. StartAddress = EndAddress = 0;
  21. bRange = OnRead = OnWrite = Log = Break = false;
  22. }
  23. u32 StartAddress;
  24. u32 EndAddress;
  25. bool bRange;
  26. bool OnRead;
  27. bool OnWrite;
  28. bool Log;
  29. bool Break;
  30. u32 numHits;
  31. void Action(DebugInterface *dbg_interface, u32 _iValue, u32 addr,
  32. bool write, int size, u32 pc);
  33. };
  34. // Code breakpoints.
  35. class BreakPoints
  36. {
  37. public:
  38. typedef std::vector<TBreakPoint> TBreakPoints;
  39. typedef std::vector<std::string> TBreakPointsStr;
  40. const TBreakPoints& GetBreakPoints() { return m_BreakPoints; }
  41. TBreakPointsStr GetStrings() const;
  42. void AddFromStrings(const TBreakPointsStr& bps);
  43. // is address breakpoint
  44. bool IsAddressBreakPoint(u32 _iAddress);
  45. bool IsTempBreakPoint(u32 _iAddress);
  46. // Add BreakPoint
  47. void Add(u32 em_address, bool temp=false);
  48. void Add(const TBreakPoint& bp);
  49. // Remove Breakpoint
  50. void Remove(u32 _iAddress);
  51. void Clear();
  52. void DeleteByAddress(u32 _Address);
  53. private:
  54. TBreakPoints m_BreakPoints;
  55. u32 m_iBreakOnCount;
  56. };
  57. // Memory breakpoints
  58. class MemChecks
  59. {
  60. public:
  61. typedef std::vector<TMemCheck> TMemChecks;
  62. typedef std::vector<std::string> TMemChecksStr;
  63. TMemChecks m_MemChecks;
  64. const TMemChecks& GetMemChecks() { return m_MemChecks; }
  65. TMemChecksStr GetStrings() const;
  66. void AddFromStrings(const TMemChecksStr& mcs);
  67. void Add(const TMemCheck& _rMemoryCheck);
  68. // memory breakpoint
  69. TMemCheck *GetMemCheck(u32 address);
  70. void Remove(u32 _Address);
  71. void Clear() { m_MemChecks.clear(); };
  72. };
  73. #endif