summaryrefslogtreecommitdiff
path: root/gpxe/src/arch/i386/core/gdbsym.c
diff options
context:
space:
mode:
Diffstat (limited to 'gpxe/src/arch/i386/core/gdbsym.c')
-rw-r--r--gpxe/src/arch/i386/core/gdbsym.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gpxe/src/arch/i386/core/gdbsym.c b/gpxe/src/arch/i386/core/gdbsym.c
new file mode 100644
index 00000000..2da1a1bd
--- /dev/null
+++ b/gpxe/src/arch/i386/core/gdbsym.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include <gpxe/init.h>
+#include <console.h>
+#include <realmode.h>
+
+extern char __text[];
+extern char __rodata[];
+extern char __data[];
+extern char __bss[];
+extern char __text16[];
+extern char __data16[];
+
+
+static void gdb_symbol_line ( void ) {
+ printf ( "Commands to start up gdb:\n\n" );
+ printf ( "gdb\n" );
+ printf ( "target remote localhost:1234\n" );
+ printf ( "set confirm off\n" );
+ printf ( "add-symbol-file symbols %#lx", virt_to_phys ( __text ) );
+ printf ( " -s .rodata %#lx", virt_to_phys ( __rodata ) );
+ printf ( " -s .data %#lx", virt_to_phys ( __data ) );
+ printf ( " -s .bss %#lx", virt_to_phys ( __bss ) );
+ printf ( " -s .text16 %#x", ( ( rm_cs << 4 ) + (int)__text16 ) );
+ printf ( " -s .data16 %#x", ( ( rm_ds << 4 ) + (int)__data16 ) );
+ printf ( "\n" );
+ printf ( "add-symbol-file symbols 0\n" );
+ printf ( "set confirm on\n" );
+ getkey();
+}
+
+struct startup_fn gdb_startup_fn __startup_fn ( STARTUP_NORMAL ) = {
+ .startup = gdb_symbol_line,
+};