blob: 668de660004d840dbf1e21c73863dc95539a3027 [file] [log] [blame]
bellard1fddef42005-04-17 19:16:13 +00001#ifndef GDBSTUB_H
2#define GDBSTUB_H
3
pbrookcfc34752007-02-22 01:48:01 +00004#define DEFAULT_GDBSTUB_PORT "1234"
bellard1fddef42005-04-17 19:16:13 +00005
aliguorie22a25c2009-03-12 20:12:48 +00006/* 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 Swirl1c14f162010-03-29 19:23:47 +000013#ifdef NEED_CPU_H
Andreas Färber9349b4f2012-03-14 01:38:32 +010014typedef void (*gdb_syscall_complete_cb)(CPUArchState *env,
pbrooka2d1eba2007-01-28 03:10:55 +000015 target_ulong ret, target_ulong err);
16
blueswir17ccfb2e2008-09-14 06:45:34 +000017void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...);
pbrooka2d1eba2007-01-28 03:10:55 +000018int use_gdb_syscalls(void);
Andreas Färber9349b4f2012-03-14 01:38:32 +010019void gdb_set_stop_cpu(CPUArchState *env);
20void gdb_exit(CPUArchState *, int);
bellard1fddef42005-04-17 19:16:13 +000021#ifdef CONFIG_USER_ONLY
aurel32ca587a82008-12-18 22:44:13 +000022int gdb_queuesig (void);
Andreas Färber9349b4f2012-03-14 01:38:32 +010023int gdb_handlesig (CPUArchState *, int);
24void gdb_signalled(CPUArchState *, int);
25void gdbserver_fork(CPUArchState *);
pbrook4046d912007-01-28 01:53:16 +000026#endif
pbrook56aebc82008-10-11 17:55:29 +000027/* Get or set a register. Returns the size of the register. */
Andreas Färber9349b4f2012-03-14 01:38:32 +010028typedef int (*gdb_reg_cb)(CPUArchState *env, uint8_t *buf, int reg);
29void gdb_register_coprocessor(CPUArchState *env,
pbrook56aebc82008-10-11 17:55:29 +000030 gdb_reg_cb get_reg, gdb_reg_cb set_reg,
31 int num_regs, const char *xml, int g_pos);
bellard1fddef42005-04-17 19:16:13 +000032
Wen Congyang68f47302012-05-07 12:10:05 +080033static 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
bellard1fddef42005-04-17 19:16:13 +000042#endif
Blue Swirl1c14f162010-03-29 19:23:47 +000043
44#ifdef CONFIG_USER_ONLY
45int gdbserver_start(int);
46#else
47int gdbserver_start(const char *port);
48#endif
49
Blue Swirl4c3b5a42011-01-20 20:54:21 +000050/* in gdbstub-xml.c, generated by scripts/feature_to_c.sh */
Blue Swirl0b65b9e2010-09-18 07:02:16 +000051extern const char *const xml_builtin[][2];
52
Blue Swirl1c14f162010-03-29 19:23:47 +000053#endif