summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe/gdbstub.h
diff options
context:
space:
mode:
authorStefan Hajnoczi2008-06-11 13:12:46 +0200
committerMichael Brown2008-06-30 20:19:48 +0200
commit6e670b5f38903109a0369f81932cca16f8a6eddf (patch)
tree8dfad249c81406265725c7216e3d4098621c7981 /src/include/gpxe/gdbstub.h
parent[GDB] Atomic read/write for device memory (diff)
downloadipxe-6e670b5f38903109a0369f81932cca16f8a6eddf.tar.gz
ipxe-6e670b5f38903109a0369f81932cca16f8a6eddf.tar.xz
ipxe-6e670b5f38903109a0369f81932cca16f8a6eddf.zip
[GDB] Remote debugging over UDP
This commit implements GDB over UDP. Using UDP is more complex than serial and has required some restructuring. The GDB stub is now built using one or both of GDBSERIAL and GDBUDP config.h options. To enter the debugger, execute the gPXE shell command: gdbstub <transport> [<options>...] Where <transport> is "serial" or "udp". For "udp", the name of a configured network device is required: gdbstub udp net0 The GDB stub listens on UDP port 43770 by default.
Diffstat (limited to 'src/include/gpxe/gdbstub.h')
-rw-r--r--src/include/gpxe/gdbstub.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/include/gpxe/gdbstub.h b/src/include/gpxe/gdbstub.h
new file mode 100644
index 00000000..adc7e382
--- /dev/null
+++ b/src/include/gpxe/gdbstub.h
@@ -0,0 +1,64 @@
+#ifndef _GPXE_GDBSTUB_H
+#define _GPXE_GDBSTUB_H
+
+/** @file
+ *
+ * GDB remote debugging
+ *
+ */
+
+#include <stdint.h>
+#include <gpxe/tables.h>
+
+/**
+ * A transport mechanism for the GDB protocol
+ *
+ */
+struct gdb_transport {
+ /** Transport name */
+ const char *name;
+ /**
+ * Set up the transport given a list of arguments
+ *
+ * @v argc Number of arguments
+ * @v argv Argument list
+ * @ret Return status code
+ *
+ * Note that arguments start at argv[0].
+ */
+ int ( * init ) ( int argc, char **argv );
+ /**
+ * Perform a blocking read
+ *
+ * @v buf Buffer
+ * @v len Size of buffer
+ * @ret Number of bytes read into buffer
+ */
+ size_t ( * recv ) ( char *buf, size_t len );
+ /**
+ * Write, may block
+ *
+ * @v buf Buffer
+ * @v len Size of buffer
+ */
+ void ( * send ) ( const char *buf, size_t len );
+};
+
+#define __gdb_transport __table ( struct gdb_transport, gdb_transports, 01 )
+
+/**
+ * Look up GDB transport by name
+ *
+ * @v name Name of transport
+ * @ret GDB transport or NULL
+ */
+extern struct gdb_transport *find_gdb_transport ( const char *name );
+
+/**
+ * Break into the debugger using the given transport
+ *
+ * @v trans GDB transport
+ */
+extern void gdbstub_start ( struct gdb_transport *trans );
+
+#endif /* _GPXE_GDBSTUB_H */