mirror of
https://github.com/ipxe/ipxe
synced 2026-02-14 02:31:26 +03:00
Add gdbsym.c object to help with running gdb-to-qemu
This commit is contained in:
28
src/arch/i386/core/gdbsym.c
Normal file
28
src/arch/i386/core/gdbsym.c
Normal file
@@ -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 );
|
||||||
@@ -143,5 +143,6 @@
|
|||||||
#undef BUILD_ID /* Include a custom build ID string,
|
#undef BUILD_ID /* Include a custom build ID string,
|
||||||
* e.g "test-foo" */
|
* e.g "test-foo" */
|
||||||
#undef NULL_TRAP /* Attempt to catch NULL function calls */
|
#undef NULL_TRAP /* Attempt to catch NULL function calls */
|
||||||
|
#define DUMP_GDBSYM /* Dump GDB symbol table information */
|
||||||
|
|
||||||
/* @END general.h */
|
/* @END general.h */
|
||||||
|
|||||||
@@ -184,6 +184,9 @@ REQUIRE_OBJECT ( dhcp_cmd );
|
|||||||
* Drag in miscellaneous objects
|
* Drag in miscellaneous objects
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifdef NULL_TRAP
|
#ifdef NULL_TRAP
|
||||||
REQUIRE_OBJECT ( nulltrap );
|
REQUIRE_OBJECT ( nulltrap );
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef DUMP_GDBSYM
|
||||||
|
REQUIRE_OBJECT ( gdbsym );
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -36,8 +36,9 @@ struct init_fn {
|
|||||||
|
|
||||||
/* Use double digits to avoid problems with "10" < "9" on alphabetic sort */
|
/* Use double digits to avoid problems with "10" < "9" on alphabetic sort */
|
||||||
#define INIT_CONSOLE 02
|
#define INIT_CONSOLE 02
|
||||||
#define INIT_CPU 03
|
#define INIT_GDBSYM 03
|
||||||
#define INIT_TIMERS 04
|
#define INIT_CPU 04
|
||||||
|
#define INIT_TIMERS 05
|
||||||
#define INIT_LOADBUF 08
|
#define INIT_LOADBUF 08
|
||||||
#define INIT_PCMCIA 09
|
#define INIT_PCMCIA 09
|
||||||
#define INIT_RPC 11
|
#define INIT_RPC 11
|
||||||
|
|||||||
Reference in New Issue
Block a user