From c96973cf0372ba9cba46f9c1a924f026be76db81 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 28 Nov 2014 01:49:03 +0100 Subject: [PATCH] improved some targets of the Makefiles used for debugging and testing --- Makefile.example | 20 +++++++++++++++----- debug.gdb | 7 +++++++ 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 debug.gdb diff --git a/Makefile.example b/Makefile.example index dd4ead8..cddd314 100644 --- a/Makefile.example +++ b/Makefile.example @@ -20,9 +20,18 @@ OBJCOPY_FOR_TARGET = $(CROSSCOMPREFIX)objcopy RANLIB_FOR_TARGET = $(CROSSCOMPREFIX)ranlib STRIP_FOR_TARGET = $(CROSSCOMPREFIX)strip READELF_FOR_TARGET = $(CROSSCOMPREFIX)readelf + NASM = nasm +GDB = gdb +QEMU = qemu-system-i386 NASMFLAGS = -felf32 -g -i$(TOPDIR)/include/eduos/ +GDBFLAGS = -x debug.gdb +QEMUFLAGS = -smp 2 -monitor stdio \ + -net nic,model=rtl8139 \ + -net user,hostfwd=tcp::12345-:7 \ + -serial tcp::12346,server,nowait + INCLUDE = -I$(TOPDIR)/include -I$(TOPDIR)/arch/$(ARCH)/include # Compiler options for final code CFLAGS = -g -m32 -march=i586 -Wall -O2 -fno-builtin -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc $(INCLUDE) -fno-stack-protector @@ -62,14 +71,15 @@ veryclean: clean @echo Very cleaned qemu: $(NAME).elf - qemu-system-i386 -monitor stdio -smp 2 -net nic,model=rtl8139 -net user,hostfwd=tcp::12345-:7 -net dump -kernel $(NAME).elf + $(QEMU) $(QEMUFLAGS) -kernel $(NAME).elf -qemu-dbg: $(NAME).elf - qemu-system-i386 -monitor stdio -s -S -smp 2 -net nic,model=rtl8139 -net user,hostfwd=tcp::12345-:7 -net dump -kernel $(NAME).elf +debug: $(NAME).elf + $(TERM) -e $(GDB) $(GDBFLAGS) & + $(QEMU) $(QEMUFLAGS) -s -S -kernel $(NAME).elf doc: - @doxygen @echo Create documentation... + @doxygen %.o : %.c @echo [CC] $@ @@ -91,5 +101,5 @@ include/eduos/config.inc: include/eduos/config.h $Q$(CC_FOR_TARGET) $(CFLAGS) -c -o $@ $< .PHONY: default all clean emu gdb newlib tools - + include $(addsuffix /Makefile,$(SUBDIRS)) diff --git a/debug.gdb b/debug.gdb new file mode 100644 index 0000000..f1c08c0 --- /dev/null +++ b/debug.gdb @@ -0,0 +1,7 @@ +# Constant part of the script +symbol-file eduos.sym +target remote localhost:1234 + +set architecture i386 +break main +continue