summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/core/gdbsym.c
blob: ebe5893bd90b162e9d6958616bd97c6bab3649fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#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();
}

INIT_FN ( INIT_GDBSYM, gdb_symbol_line, NULL, NULL );