gdbserver.h

来自「Source Code of jlinkserver for Segger JL」· C头文件 代码 · 共 76 行

H
76
字号
/** GDB server class that handles communications between the gdb debugger and the
	target hardware
*/
class GdbServer {
public:
	GdbServer(SOCKET socket, JTAG* jtag);

	void Run();

private:
	static const int NUM_HARD_BREAKPOINTS = 2;
	static const int NUM_SOFT_BREAKPOINTS = 100;

	SOCKET socket;
	JTAG* jtag;
	char buffer[3000];
	char nbuf[200];
	int npos;
	int nlen;
	unsigned char* memory;
	unsigned int mlen;
	unsigned int packetid;
	unsigned int hardBreakpoints[NUM_HARD_BREAKPOINTS];
	unsigned int numHardBreakpoints;
	unsigned int softBreakpoints[NUM_SOFT_BREAKPOINTS];
	unsigned int numSoftBreakpoints;

	/** This is set when the server writes to location 0. It causes a reflash to take place
	and is cleared when the application is run for the first time
	*/
	int flashing;


	/** Read the packet, returning -1 on error or the length when ok
	*/
	int ReadPacket();
	int WritePacket();

	int ReadCharacter();
	int DataAvailable();
	inline int WriteCharacters(const char* msg) {
		return WriteCharacters(msg, (int)strlen(msg));
	}

	int WriteCharacters(const char* msg, int length);

	int ReadHex(int ch);
	char WriteHex(int value);

	void MakeStopReply(char state, int signal);
	void MakePacket(const char* packet);
	void ReadRegisters();
	void ReadRegister();
	void WriteRegister();
	void Step();
	void Go();
	void Halt();
	void Continue();
	void Reset();

	void RetrieveMemory();
	void SetHardBreakpoint();
	void ClearHardBreakpoint();
	void SetSoftBreakpoint();
	void ClearSoftBreakpoint();
	void ModifyMemory();
	void RunUsingHardBreakpoints();

	void ModifyMemory(unsigned int address, unsigned int length, char* pointer);

	char* WriteHex(unsigned int value, int bytes, char* pointer);	int* RegisterMap();

};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?