Fixed problem in DeviceSettings::strParam, returned wrong string
[avr-sim.git] / src / DebugInterface.h
blob3f7939723a9047e873f2cb7edd4d4ada7a1a5f69
1 #ifndef AVR_DEBUGINTERFACE_H
2 #define AVR_DEBUGINTERFACE_H
4 #include "Types.h"
5 #include "Device.h"
6 #include <vector>
7 #include <iostream>
9 namespace avr {
11 class Core;
13 /**
14 * @author Tom Haber
15 * @date Apr 29, 2008
16 * @brief Interface for debugging
18 * This class is used for debugging and tracing functionality.
19 * It has access to some protected parts of the core and can
20 * provide more detailed state information for external use.
22 class DebugInterface {
23 public:
24 DebugInterface(Device & dev, Core & core);
25 ~DebugInterface();
27 public:
28 byte reg(int reg) const;
29 byte status() const;
30 word stackPointer() const;
31 dword programCounter() const;
33 public:
34 void setReg(int reg, byte val);
35 void setStatus(byte val);
36 void setStackPointer(word val);
37 void setProgramCounter(dword val);
39 public:
40 void reset();
41 void step();
42 bool stepDone() const;
44 public:
45 bool checkBreak(dword addr);
46 bool hasBreaked() const { return breaked; }
47 void insertBreak(dword addr);
48 void removeBreak(dword addr);
49 void deleteAllBreakpoints();
51 public:
52 const std::string & registerName(byte addr) const;
53 void trace(std::ostream & ostr, dword addr);
55 public:
56 bool isRegister(unsigned int offset) const;
57 byte readRegister(unsigned int offset) const;
58 const unsigned char *readRam(unsigned int offset, unsigned int size) const;
59 void writeRam(unsigned char *data, unsigned int offset, unsigned int size);
60 const unsigned char *readFlash(unsigned int offset, unsigned int size) const;
61 void writeFlash(unsigned char *data, unsigned int offset, unsigned int size);
62 const unsigned char *readEeprom(unsigned int offset, unsigned int size) const;
63 void writeEeprom(unsigned char *data, unsigned int offset, unsigned int size);
65 private:
66 Device & dev;
67 Core & core;
69 private:
70 typedef std::vector<dword> Breakpoints;
71 Breakpoints breakPoints;
72 bool breaked;
75 inline void DebugInterface::step() {
76 dev.step();
79 inline void DebugInterface::reset() {
80 dev.reset( SIM_RESET );
85 #endif /*AVR_DEBUGINTERFACE_H*/