From 58115dc00010269322dc8c62ca7172fa06280e2c Mon Sep 17 00:00:00 2001 From: Jacek Galowicz Date: Mon, 16 May 2011 13:26:49 +0200 Subject: [PATCH] New Makefile target: qemudbg This target starts qemu in Debug-Mode and GDB. There is a GDB-Script file script.gdb which is extensible to match your debugging needs. --- Makefile.example | 9 +++++++++ script.gdb | 7 +++++++ 2 files changed, 16 insertions(+) create mode 100644 script.gdb diff --git a/Makefile.example b/Makefile.example index 1614b2ff..554c241d 100644 --- a/Makefile.example +++ b/Makefile.example @@ -19,6 +19,8 @@ RANLIB_FOR_TARGET=ranlib STRIP_FOR_TARGET=strip READELF_FOR_TARGET=readelf NASM = nasm +EMU=qemu +GDB=gdb MAKE = make NASMFLAGS = -felf32 -g @@ -71,6 +73,13 @@ $(NAME).elf: qemu: newlib tools $(NAME).elf qemu -smp 2 -net nic,model=rtl8139 -net user,hostfwd=tcp::12345-:7 -net dump -kernel metalsvm.elf -initrd tools/initrd.img +qemudbg: newlib tools $(NAME).elf + qemu -S -s -smp 2 -net nic,model=rtl8139 -net user,hostfwd=tcp::12345-:7 -net dump -kernel metalsvm.elf -initrd tools/initrd.img + +gdb: $(NAME).elf + make qemudbg > /dev/null & + $(GDB) -x script.gdb + clean: $Q$(RM) $(NAME).elf $(NAME).sym *~ $Q$(MAKE) -C tools clean diff --git a/script.gdb b/script.gdb new file mode 100644 index 00000000..644bde95 --- /dev/null +++ b/script.gdb @@ -0,0 +1,7 @@ +# Constant part of the script +symbol-file metalsvm.sym +target remote localhost:1234 + +# Configure breakpoints and everything as you wish here. +break main +continue