Browse Source

Add gdbsym.c object to help with running gdb-to-qemu

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
8f6a4e8140
4 changed files with 36 additions and 3 deletions
  1. 28
    0
      src/arch/i386/core/gdbsym.c
  2. 1
    0
      src/config.h
  3. 4
    1
      src/core/config.c
  4. 3
    2
      src/include/gpxe/init.h

+ 28
- 0
src/arch/i386/core/gdbsym.c View File

@@ -0,0 +1,28 @@
1
+#include <stdio.h>
2
+#include <gpxe/init.h>
3
+#include <console.h>
4
+#include <realmode.h>
5
+
6
+extern char __text[];
7
+extern char __rodata[];
8
+extern char __data[];
9
+extern char __bss[];
10
+extern char __text16[];
11
+extern char __data16[];
12
+
13
+
14
+static void gdb_symbol_line ( void ) {
15
+	printf ( "Commands to start up gdb:\n\n" );
16
+	printf ( "gdb\n" );
17
+	printf ( "target remote localhost:1234\n" );
18
+	printf ( "add-symbol-file symbols %#lx", virt_to_phys ( __text ) );
19
+	printf ( " -s .rodata %#lx", virt_to_phys ( __rodata ) );
20
+	printf ( " -s .data %#lx", virt_to_phys ( __data ) );
21
+	printf ( " -s .bss %#lx", virt_to_phys ( __bss ) );
22
+	printf ( " -s .text16 %#x", ( ( rm_cs << 4 ) + (int)__text16 ) );
23
+	printf ( " -s .data16 %#x", ( ( rm_ds << 4 ) + (int)__data16 ) );
24
+	printf ( "\n" );
25
+	getkey();
26
+}
27
+
28
+INIT_FN ( INIT_GDBSYM, gdb_symbol_line, NULL, NULL );

+ 1
- 0
src/config.h View File

@@ -143,5 +143,6 @@
143 143
 #undef	BUILD_ID		/* Include a custom build ID string,
144 144
 				 * e.g "test-foo" */
145 145
 #undef	NULL_TRAP		/* Attempt to catch NULL function calls */
146
+#define DUMP_GDBSYM		/* Dump GDB symbol table information */
146 147
 
147 148
 /* @END general.h */

+ 4
- 1
src/core/config.c View File

@@ -184,6 +184,9 @@ REQUIRE_OBJECT ( dhcp_cmd );
184 184
  * Drag in miscellaneous objects
185 185
  *
186 186
  */
187
-#ifdef	NULL_TRAP
187
+#ifdef NULL_TRAP
188 188
 REQUIRE_OBJECT ( nulltrap );
189 189
 #endif
190
+#ifdef DUMP_GDBSYM
191
+REQUIRE_OBJECT ( gdbsym );
192
+#endif

+ 3
- 2
src/include/gpxe/init.h View File

@@ -36,8 +36,9 @@ struct init_fn {
36 36
 
37 37
 /* Use double digits to avoid problems with "10" < "9" on alphabetic sort */
38 38
 #define	INIT_CONSOLE	02
39
-#define	INIT_CPU	03
40
-#define	INIT_TIMERS	04
39
+#define	INIT_GDBSYM	03
40
+#define	INIT_CPU	04
41
+#define	INIT_TIMERS	05
41 42
 #define	INIT_LOADBUF	08
42 43
 #define	INIT_PCMCIA	09
43 44
 #define	INIT_RPC	11

Loading…
Cancel
Save