1 #ifndef AVR_GDBSERVER_H
2 #define AVR_GDBSERVER_H
12 class SimulationClock
;
17 * @brief gdb communication error
19 * Thrown when something goes wrong with the gdb communication.
21 class GdbException
: public util::Exception
{
23 GdbException() : Exception("Gdb Exception") {}
24 GdbException(const char * msg
) : Exception(msg
) {}
25 GdbException(const std::string
& msg
) : Exception(msg
) {}
31 * @brief Gnu debugger interfacing server
33 * This server can speak the gnu debugger remote debugging language
34 * and is used for remote debugging of the avr chip.
36 * This is largely based on code from simulavr.
38 * TODO rewrite, cleanup
39 * TODO implement trace points
43 GdbServer(SimulationClock
& clock
, int port
= 1234);
47 void add(Device
*dev
);
51 void openSocket(int port
);
57 int preParsePacket(bool blocking
= false);
58 int parsePacket( char *pkt
);
59 void setBlockingMode( bool blocking
);
62 void sendPosition(int signo
);
64 void write( const void *buf
, size_t count
);
66 void sendReply( char *reply
);
67 void saveLastReply( char *reply
);
70 void queryPacket( char *pkt
);
72 void writeRegisters( char *pkt
);
73 void readRegister( char *pkt
);
74 void writeRegister( char *pkt
);
75 void readMemory( char *pkt
);
76 void writeMemory( char *pkt
);
77 int getSignal( char *pkt
);
78 void breakPoint( char *pkt
);
81 SimulationClock
& clock
;
82 std::vector
<DebugInterface
*> devices
;
86 /* A buffer containing a agent expression. */
88 std::vector
<unsigned char> buf
;
95 /* Number of times this tracepoint should single-step
96 and collect additional data. */
99 /* Number of times this tracepoint should be hit before
103 /* Count of the number of times this tracepoint was taken, dumped
104 with the info, but not used for anything else. Useful for
105 seeing how many times you hit a tracepoint prior to the program
106 aborting, so you can back up to just before the abort. */
109 std::vector
<Tracepoint
> tracePoints
;
120 #endif /*AVR_GDBSERVER_H*/