From 19f871579d9ca298d676803db91249524b50189c Mon Sep 17 00:00:00 2001 From: daniel-k Date: Fri, 12 Dec 2014 18:32:07 +0100 Subject: [PATCH] Don't strip debug symbols of elf to use as symbol-file in gdb (fix crashing gdb 7.7.1 on Ubuntu). Add debug-eclipse target and use target-specific CFLAGS for debug targets. --- Makefile.example | 15 +++++++++++---- debug.gdb | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Makefile.example b/Makefile.example index 4978e0c..66d932c 100644 --- a/Makefile.example +++ b/Makefile.example @@ -30,12 +30,15 @@ QEMU = qemu-system-i386 QEMUFLAGS = -smp 2 -monitor stdio \ -net nic,model=rtl8139 \ -net user,hostfwd=tcp::12345-:7 +QEMUDEBUGFLAGS = -monitor none -daemonize \ + -net nic,model=rtl8139 \ + -net user,hostfwd=tcp::12345-:7 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 # Compiler options for debugging -#CFLAGS = -g -O -m32 -march=i586 -Wall -fno-builtin -DWITH_FRAME_POINTER -nostdinc $(INCLUDE) -fno-stack-protector +debug debug-eclipse : CFLAGS = -g -O0 -m32 -march=i586 -Wall -fno-builtin -DWITH_FRAME_POINTER -nostdinc $(INCLUDE) -fno-stack-protector AR = ar ARFLAGS = rsv RM = rm -rf @@ -58,8 +61,8 @@ $(NAME).elf: $Q$(LD_FOR_TARGET) $(LDFLAGS) -o $(NAME).elf $^ @echo [OBJCOPY] $(NAME).sym $Q$(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $(NAME).elf $(NAME).sym - @echo [OBJCOPY] $(NAME).elf - $Q$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $(NAME).elf + #@echo [OBJCOPY] $(NAME).elf + #$Q$(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $(NAME).elf clean: $Q$(RM) $(NAME).elf $(NAME).sym *~ @@ -77,7 +80,11 @@ uart: $(NAME).elf debug: $(NAME).elf $(TERM) -e $(GDB) $(GDBFLAGS) & - $(QEMU) $(QEMUFLAGS) -s -S -kernel $(NAME).elf + $(QEMU) $(QEMUDEBUGFLAGS) -s -S -kernel $(NAME).elf + +debug-eclipse: $(NAME).elf + killall $(QEMU) & + ( ( $(QEMU) $(QEMUDEBUGFLAGS) -s -S -kernel $(NAME).elf & ) & ) doc: @echo Create documentation... diff --git a/debug.gdb b/debug.gdb index f1c08c0..e740d62 100644 --- a/debug.gdb +++ b/debug.gdb @@ -1,5 +1,5 @@ # Constant part of the script -symbol-file eduos.sym +symbol-file eduos.elf target remote localhost:1234 set architecture i386