-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
gdb_server.h
65 lines (47 loc) · 1.41 KB
/
gdb_server.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef __GDB_SERVER_H__
#define __GDB_SERVER_H__
#include "armv6m.h"
//-----------------------------------------------------------------
// GDB Server
//-----------------------------------------------------------------
class gdb_server
{
public:
gdb_server(Armv6m *cpu);
int start(int port);
static const int MAX_MEM_XFER = 8192;
protected:
void gdb_printf(const char *fmt, ...);
int gdb_read(bool blocking);
int gdb_peek(void);
int gdb_getc(void);
int gdb_flush(void);
int gdb_flush_ack(void);
void gdb_packet_start(void);
void gdb_packet_end(void);
int gdb_send(const char *msg);
uint32_t atoui(const char *str);
int read_registers(void);
int write_registers(char *buf);
int read_memory(char *text);
int write_memory(char *text);
int set_pc(char *buf);
int read_register(char *buf);
int send_status(int status);
int run(char *buf, int instructions);
int single_step(char *buf);
int set_breakpoint(int enable, char *buf);
int gdb_send_supported(void);
int gdb_send_offsets(void);
int process_gdb_command(char *buf, int len);
protected:
Armv6m *m_cpu;
int m_socket;
int m_error;
char m_rx_buf[MAX_MEM_XFER];
int m_rx_head;
int m_rx_tail;
char m_tx_buf[MAX_MEM_XFER * 2 + 64];
int m_tx_len;
};
#endif