⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gdbserver.h

📁 Source Code of jlinkserver for Segger JLink
💻 H
字号:
/** 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -