bellard | 1fddef4 | 2005-04-17 19:16:13 +0000 | [diff] [blame] | 1 | #ifndef GDBSTUB_H |
| 2 | #define GDBSTUB_H |
| 3 | |
pbrook | cfc3475 | 2007-02-22 01:48:01 +0000 | [diff] [blame] | 4 | #define DEFAULT_GDBSTUB_PORT "1234" |
bellard | 1fddef4 | 2005-04-17 19:16:13 +0000 | [diff] [blame] | 5 | |
aliguori | e22a25c | 2009-03-12 20:12:48 +0000 | [diff] [blame] | 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 | |
Blue Swirl | 1c14f16 | 2010-03-29 19:23:47 +0000 | [diff] [blame] | 13 | #ifdef NEED_CPU_H |
Andreas Färber | 9349b4f | 2012-03-14 01:38:32 +0100 | [diff] [blame] | 14 | typedef void (*gdb_syscall_complete_cb)(CPUArchState *env, |
pbrook | a2d1eba | 2007-01-28 03:10:55 +0000 | [diff] [blame] | 15 | target_ulong ret, target_ulong err); |
| 16 | |
blueswir1 | 7ccfb2e | 2008-09-14 06:45:34 +0000 | [diff] [blame] | 17 | void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...); |
pbrook | a2d1eba | 2007-01-28 03:10:55 +0000 | [diff] [blame] | 18 | int use_gdb_syscalls(void); |
Andreas Färber | 9349b4f | 2012-03-14 01:38:32 +0100 | [diff] [blame] | 19 | void gdb_set_stop_cpu(CPUArchState *env); |
| 20 | void gdb_exit(CPUArchState *, int); |
bellard | 1fddef4 | 2005-04-17 19:16:13 +0000 | [diff] [blame] | 21 | #ifdef CONFIG_USER_ONLY |
aurel32 | ca587a8 | 2008-12-18 22:44:13 +0000 | [diff] [blame] | 22 | int gdb_queuesig (void); |
Andreas Färber | 9349b4f | 2012-03-14 01:38:32 +0100 | [diff] [blame] | 23 | int gdb_handlesig (CPUArchState *, int); |
| 24 | void gdb_signalled(CPUArchState *, int); |
| 25 | void gdbserver_fork(CPUArchState *); |
pbrook | 4046d91 | 2007-01-28 01:53:16 +0000 | [diff] [blame] | 26 | #endif |
pbrook | 56aebc8 | 2008-10-11 17:55:29 +0000 | [diff] [blame] | 27 | /* Get or set a register. Returns the size of the register. */ |
Andreas Färber | 9349b4f | 2012-03-14 01:38:32 +0100 | [diff] [blame] | 28 | typedef int (*gdb_reg_cb)(CPUArchState *env, uint8_t *buf, int reg); |
| 29 | void gdb_register_coprocessor(CPUArchState *env, |
pbrook | 56aebc8 | 2008-10-11 17:55:29 +0000 | [diff] [blame] | 30 | gdb_reg_cb get_reg, gdb_reg_cb set_reg, |
| 31 | int num_regs, const char *xml, int g_pos); |
bellard | 1fddef4 | 2005-04-17 19:16:13 +0000 | [diff] [blame] | 32 | |
Wen Congyang | 68f4730 | 2012-05-07 12:10:05 +0800 | [diff] [blame] | 33 | static inline int cpu_index(CPUArchState *env) |
| 34 | { |
| 35 | #if defined(CONFIG_USER_ONLY) && defined(CONFIG_USE_NPTL) |
| 36 | return env->host_tid; |
| 37 | #else |
| 38 | return env->cpu_index + 1; |
| 39 | #endif |
| 40 | } |
| 41 | |
bellard | 1fddef4 | 2005-04-17 19:16:13 +0000 | [diff] [blame] | 42 | #endif |
Blue Swirl | 1c14f16 | 2010-03-29 19:23:47 +0000 | [diff] [blame] | 43 | |
| 44 | #ifdef CONFIG_USER_ONLY |
| 45 | int gdbserver_start(int); |
| 46 | #else |
| 47 | int gdbserver_start(const char *port); |
| 48 | #endif |
| 49 | |
Blue Swirl | 4c3b5a4 | 2011-01-20 20:54:21 +0000 | [diff] [blame] | 50 | /* in gdbstub-xml.c, generated by scripts/feature_to_c.sh */ |
Blue Swirl | 0b65b9e | 2010-09-18 07:02:16 +0000 | [diff] [blame] | 51 | extern const char *const xml_builtin[][2]; |
| 52 | |
Blue Swirl | 1c14f16 | 2010-03-29 19:23:47 +0000 | [diff] [blame] | 53 | #endif |