1 #ifndef AVR_GDBSERVER_H
2 #define AVR_GDBSERVER_H
20 * @brief gdb communication error
22 * Thrown when something goes wrong with the gdb communication.
24 class GdbException
: public util::Exception
{
26 GdbException() : Exception("Gdb Exception") {}
27 GdbException(const char * msg
) : Exception(msg
) {}
28 GdbException(const std::string
& msg
) : Exception(msg
) {}
34 * @brief Gnu debugger interfacing server
36 * This server can speak the gnu debugger remote debugging language
37 * and is used for remote debugging of the avr chip.
39 * This is largely based on code from simulavr.
41 * TODO rewrite, cleanup
42 * TODO implement trace points
46 GdbServer(sim::SimulationClock
& clock
, int port
= 1234);
50 void add(Device
*dev
);
54 void openSocket(int port
);
60 int preParsePacket(bool blocking
= false);
61 int parsePacket( char *pkt
);
62 void setBlockingMode( bool blocking
);
65 void sendPosition(int signo
);
67 void write( const void *buf
, size_t count
);
69 void sendReply( const char *reply
);
70 void saveLastReply( const char *reply
);
73 void queryPacket( char *pkt
);
75 void writeRegisters( char *pkt
);
76 void readRegister( char *pkt
);
77 void writeRegister( char *pkt
);
78 void readMemory( char *pkt
);
79 void writeMemory( char *pkt
);
80 int getSignal( char *pkt
);
81 void breakPoint( char *pkt
);
84 sim::SimulationClock
& clock
;
85 std::vector
<DebugInterface
*> devices
;
89 /* A buffer containing a agent expression. */
91 std::vector
<unsigned char> buf
;
98 /* Number of times this tracepoint should single-step
99 and collect additional data. */
102 /* Number of times this tracepoint should be hit before
106 /* Count of the number of times this tracepoint was taken, dumped
107 with the info, but not used for anything else. Useful for
108 seeing how many times you hit a tracepoint prior to the program
109 aborting, so you can back up to just before the abort. */
112 std::vector
<Tracepoint
> tracePoints
;
123 #endif /*AVR_GDBSERVER_H*/