Rename gpxe to .
[grub-extras.git] / src / include / gpxe / gdbstub.h
blob8f9b7c1da340697d5f00a226e780fb62ec92a598
1 #ifndef _GPXE_GDBSTUB_H
2 #define _GPXE_GDBSTUB_H
4 /** @file
6 * GDB remote debugging
8 */
10 FILE_LICENCE ( GPL2_OR_LATER );
12 #include <stdint.h>
13 #include <gpxe/tables.h>
14 #include <gdbmach.h>
16 /**
17 * A transport mechanism for the GDB protocol
20 struct gdb_transport {
21 /** Transport name */
22 const char *name;
23 /**
24 * Set up the transport given a list of arguments
26 * @v argc Number of arguments
27 * @v argv Argument list
28 * @ret Return status code
30 * Note that arguments start at argv[0].
32 int ( * init ) ( int argc, char **argv );
33 /**
34 * Perform a blocking read
36 * @v buf Buffer
37 * @v len Size of buffer
38 * @ret Number of bytes read into buffer
40 size_t ( * recv ) ( char *buf, size_t len );
41 /**
42 * Write, may block
44 * @v buf Buffer
45 * @v len Size of buffer
47 void ( * send ) ( const char *buf, size_t len );
50 #define GDB_TRANSPORTS __table ( struct gdb_transport, "gdb_transports" )
52 #define __gdb_transport __table_entry ( GDB_TRANSPORTS, 01 )
54 /**
55 * Look up GDB transport by name
57 * @v name Name of transport
58 * @ret GDB transport or NULL
60 extern struct gdb_transport *find_gdb_transport ( const char *name );
62 /**
63 * Break into the debugger using the given transport
65 * @v trans GDB transport
67 extern void gdbstub_start ( struct gdb_transport *trans );
69 /**
70 * Interrupt handler
72 * @signo POSIX signal number
73 * @regs CPU register snapshot
74 **/
75 extern void gdbstub_handler ( int signo, gdbreg_t *regs );
77 #endif /* _GPXE_GDBSTUB_H */