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.
This commit is contained in:
daniel-k 2014-12-12 18:32:07 +01:00
parent 2df269eac0
commit 19f871579d
2 changed files with 12 additions and 5 deletions

View file

@ -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...

View file

@ -1,5 +1,5 @@
# Constant part of the script
symbol-file eduos.sym
symbol-file eduos.elf
target remote localhost:1234
set architecture i386