xref: /openbmc/qemu/include/exec/gdbstub.h (revision 5f88dd43)
1 #ifndef GDBSTUB_H
2 #define GDBSTUB_H
3 
4 #define DEFAULT_GDBSTUB_PORT "1234"
5 
6 /* GDB breakpoint/watchpoint types */
7 #define GDB_BREAKPOINT_SW        0
8 #define GDB_BREAKPOINT_HW        1
9 #define GDB_WATCHPOINT_WRITE     2
10 #define GDB_WATCHPOINT_READ      3
11 #define GDB_WATCHPOINT_ACCESS    4
12 
13 
14 /* Get or set a register.  Returns the size of the register.  */
15 typedef int (*gdb_get_reg_cb)(CPUArchState *env, GByteArray *buf, int reg);
16 typedef int (*gdb_set_reg_cb)(CPUArchState *env, uint8_t *buf, int reg);
17 
18 /**
19  * gdb_register_coprocessor() - register a supplemental set of registers
20  * @cpu - the CPU associated with registers
21  * @get_reg - get function (gdb reading)
22  * @set_reg - set function (gdb modifying)
23  * @num_regs - number of registers in set
24  * @xml - xml name of set
25  * @gpos - non-zero to append to "general" register set at @gpos
26  */
27 void gdb_register_coprocessor(CPUState *cpu,
28                               gdb_get_reg_cb get_reg, gdb_set_reg_cb set_reg,
29                               int num_regs, const char *xml, int g_pos);
30 
31 /**
32  * gdbserver_start: start the gdb server
33  * @port_or_device: connection spec for gdb
34  *
35  * For CONFIG_USER this is either a tcp port or a path to a fifo. For
36  * system emulation you can use a full chardev spec for your gdbserver
37  * port.
38  */
39 int gdbserver_start(const char *port_or_device);
40 
41 void gdb_set_stop_cpu(CPUState *cpu);
42 
43 /**
44  * gdb_has_xml() - report of gdb supports modern target descriptions
45  *
46  * This will report true if the gdb negotiated qXfer:features:read
47  * target descriptions.
48  */
49 bool gdb_has_xml(void);
50 
51 /* in gdbstub-xml.c, generated by scripts/feature_to_c.sh */
52 extern const char *const xml_builtin[][2];
53 
54 #endif
55