break_points.h 2.0 KB

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