DebuggerData.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef DEBUGGERDATA_H
  2. #define DEBUGGERDATA_H
  3. #include <QLinkedList>
  4. #include <QString>
  5. #include <QXmlStreamReader>
  6. #include <QXmlStreamWriter>
  7. struct MemoryLayout
  8. {
  9. MemoryLayout();
  10. int primarySlot[4];
  11. int secondarySlot[4];
  12. int mapperSegment[4];
  13. int romBlock[8];
  14. bool isSubslotted[4];
  15. int mapperSize[4][4];
  16. };
  17. class Breakpoints
  18. {
  19. public:
  20. Breakpoints();
  21. enum Type { BREAKPOINT = 0, WATCHPOINT_MEMREAD, WATCHPOINT_MEMWRITE,
  22. WATCHPOINT_IOREAD, WATCHPOINT_IOWRITE, CONDITION };
  23. void clear();
  24. void setMemoryLayout(MemoryLayout* ml);
  25. void setBreakpoints(const QString& str);
  26. QString mergeBreakpoints(const QString& str);
  27. int breakpointCount();
  28. bool isBreakpoint(quint16 addr, QString *id = 0);
  29. bool isWatchpoint(quint16 addr, QString *id = 0);
  30. /* xml session file functions */
  31. void saveBreakpoints(QXmlStreamWriter& xml);
  32. void loadBreakpoints(QXmlStreamReader& xml);
  33. int findBreakpoint(quint16 addr);
  34. int findNextBreakpoint();
  35. static QString createSetCommand(Type type, int address,
  36. char ps = -1, char ss = -1, int segment = -1,
  37. int endRange = -1, QString condition = QString());
  38. static QString createRemoveCommand(const QString& id);
  39. private:
  40. struct Breakpoint {
  41. Type type;
  42. QString id;
  43. quint16 address;
  44. // end for watchpoint region
  45. quint16 regionEnd;
  46. // gui specific condition variables
  47. char ps;
  48. char ss;
  49. qint16 segment;
  50. // general condition
  51. QString condition;
  52. // compare content
  53. bool operator==(const Breakpoint &bp) const;
  54. };
  55. typedef QLinkedList<Breakpoint> BreakpointList;
  56. BreakpointList breakpoints;
  57. MemoryLayout* memLayout;
  58. void parseCondition(Breakpoint& bp);
  59. void insertBreakpoint(Breakpoint& bp);
  60. bool inCurrentSlot(const Breakpoint& bp);
  61. };
  62. #endif // DEBUGGERDATA_H