aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@etherboot.org>2007-06-30 22:43:31 +0100
committerMichael Brown <mcb30@etherboot.org>2007-06-30 22:43:31 +0100
commit8f6a4e81406c384cb3e8bdd0e9386581d6d2f11e (patch)
treebd7b2cde7f1c89124a9207177ba4f42e455acd22
parente1646b40809b7e27aa275d7a62eb9a8dd814b1c3 (diff)
downloadipxe-8f6a4e81406c384cb3e8bdd0e9386581d6d2f11e.zip
ipxe-8f6a4e81406c384cb3e8bdd0e9386581d6d2f11e.tar.gz
ipxe-8f6a4e81406c384cb3e8bdd0e9386581d6d2f11e.tar.bz2
Add gdbsym.c object to help with running gdb-to-qemu
-rw-r--r--src/arch/i386/core/gdbsym.c28
-rw-r--r--src/config.h1
-rw-r--r--src/core/config.c5
-rw-r--r--src/include/gpxe/init.h5
4 files changed, 36 insertions, 3 deletions
diff --git a/src/arch/i386/core/gdbsym.c b/src/arch/i386/core/gdbsym.c
new file mode 100644
index 0000000..51f48ed
--- /dev/null
+++ b/src/arch/i386/core/gdbsym.c
@@ -0,0 +1,28 @@
+#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 ( "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" );
+ getkey();
+}
+
+INIT_FN ( INIT_GDBSYM, gdb_symbol_line, NULL, NULL );
diff --git a/src/config.h b/src/config.h
index 463d091..bacf904 100644
--- a/src/config.h
+++ b/src/config.h
@@ -143,5 +143,6 @@
#undef BUILD_ID /* Include a custom build ID string,
* e.g "test-foo" */
#undef NULL_TRAP /* Attempt to catch NULL function calls */
+#define DUMP_GDBSYM /* Dump GDB symbol table information */
/* @END general.h */
diff --git a/src/core/config.c b/src/core/config.c
index 71f8777..a65d0a9 100644
--- a/src/core/config.c
+++ b/src/core/config.c
@@ -184,6 +184,9 @@ REQUIRE_OBJECT ( dhcp_cmd );
* Drag in miscellaneous objects
*
*/
-#ifdef NULL_TRAP
+#ifdef NULL_TRAP
REQUIRE_OBJECT ( nulltrap );
#endif
+#ifdef DUMP_GDBSYM
+REQUIRE_OBJECT ( gdbsym );
+#endif
diff --git a/src/include/gpxe/init.h b/src/include/gpxe/init.h
index 0a2eb0b..bd4cd97 100644
--- a/src/include/gpxe/init.h
+++ b/src/include/gpxe/init.h
@@ -36,8 +36,9 @@ struct init_fn {
/* Use double digits to avoid problems with "10" < "9" on alphabetic sort */
#define INIT_CONSOLE 02
-#define INIT_CPU 03
-#define INIT_TIMERS 04
+#define INIT_GDBSYM 03
+#define INIT_CPU 04
+#define INIT_TIMERS 05
#define INIT_LOADBUF 08
#define INIT_PCMCIA 09
#define INIT_RPC 11