From 568bbae801dcde879a3738d482ed2b0570875c6c Mon Sep 17 00:00:00 2001 From: Silas Boyd-Wickizer Date: Tue, 15 Sep 2009 17:15:36 -0400 Subject: qemu-gdb target and script --- .gdbinit.tmpl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .gdbinit.tmpl (limited to '.gdbinit.tmpl') diff --git a/.gdbinit.tmpl b/.gdbinit.tmpl new file mode 100644 index 0000000..4c4e734 --- /dev/null +++ b/.gdbinit.tmpl @@ -0,0 +1,28 @@ +set $lastcs = -1 + +# This fails on Darwin because the default gdb has no ELF support +# echo + symbol-file obj/kern/kernel\n +# symbol-file obj/kern/kernel + +define hook-stop + # There doesn't seem to be a good way to detect if we're in 16- or + # 32-bit mode, but in 32-bit mode we always run with CS == 8 in the + # kernel and CS == 35 in user space + if $cs == 8 || $cs == 35 + if $lastcs != 8 && $lastcs != 35 + set architecture i386 + end + x/i $pc + else + if $lastcs == -1 || $lastcs == 8 || $lastcs == 35 + set architecture i8086 + end + # Translate the segment:offset into a physical address + printf "[%4x:%4x] ", $cs, $eip + x/i $cs*16+$eip + end + set $lastcs = $cs +end + +echo + target remote localhost:1234\n +target remote localhost:1234 -- cgit v1.2.3