1 #ifndef AVR_DEBUGINTERFACE_H
2 #define AVR_DEBUGINTERFACE_H
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
{
24 DebugInterface(Device
& dev
, Core
& core
);
28 byte
reg(int reg
) const;
30 word
stackPointer() const;
31 dword
programCounter() const;
34 void setReg(int reg
, byte val
);
35 void setStatus(byte val
);
36 void setStackPointer(word val
);
37 void setProgramCounter(dword val
);
42 bool stepDone() const;
45 bool checkBreak(dword addr
);
46 bool hasBreaked() const { return breaked
; }
47 void insertBreak(dword addr
);
48 void removeBreak(dword addr
);
49 void deleteAllBreakpoints();
52 const std::string
& registerName(byte addr
) const;
53 void trace(std::ostream
& ostr
, dword addr
);
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
);
70 typedef std::vector
<dword
> Breakpoints
;
71 Breakpoints breakPoints
;
75 inline void DebugInterface::step() {
79 inline void DebugInterface::reset() {
80 dev
.reset( SIM_RESET
);
85 #endif /*AVR_DEBUGINTERFACE_H*/