From 804d0ad641e50ef4133ba266a6107b95b6a337d2 Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Sat, 2 Dec 2017 19:33:16 +0000 Subject: [PATCH] Keep debug info in a .sym file - Compile time changes - Compile libkernel.a with debug info - Copy debug info to kernel.sym - Strip the kernel of debug symbols - Workflow changes - Add `debug` option to `make qemu` --- kernel | 2 +- mk/kernel.mk | 6 ++++-- mk/qemu.mk | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/kernel b/kernel index 578c57840..45e8effa8 160000 --- a/kernel +++ b/kernel @@ -1 +1 @@ -Subproject commit 578c57840afd1fc32559bfa2372509f2b5910581 +Subproject commit 45e8effa8a03fa4abc427a1fafadae25b589e465 diff --git a/mk/kernel.mk b/mk/kernel.mk index a372c3f23..4738f5510 100644 --- a/mk/kernel.mk +++ b/mk/kernel.mk @@ -1,9 +1,9 @@ build/libkernel.a: kernel/Cargo.toml kernel/src/* kernel/src/*/* kernel/src/*/*/* build/initfs.tag # Temporary fix for https://github.com/redox-os/redox/issues/963 allowing to build on macOS ifeq ($(UNAME),Darwin) - cd kernel && CC=$(ARCH)-elf-gcc AR=$(ARCH)-elf-ar CFLAGS=-ffreestanding INITFS_FOLDER=$(ROOT)/build/initfs xargo rustc --lib --target $(KTARGET) --release -- -C soft-float --emit link=../$@ + cd kernel && CC=$(ARCH)-elf-gcc AR=$(ARCH)-elf-ar CFLAGS=-ffreestanding INITFS_FOLDER=$(ROOT)/build/initfs xargo rustc --lib --target $(KTARGET) --release -- -C soft-float -C debuginfo=2 --emit link=../$@ else - cd kernel && INITFS_FOLDER=$(ROOT)/build/initfs xargo rustc --lib --target $(KTARGET) --release -- -C soft-float --emit link=../$@ + cd kernel && INITFS_FOLDER=$(ROOT)/build/initfs xargo rustc --lib --target $(KTARGET) --release -- -C soft-float -C debuginfo=2 --emit link=../$@ endif build/libkernel_live.a: kernel/Cargo.toml kernel/src/* kernel/src/*/* kernel/src/*/*/* build/initfs_live.tag @@ -11,6 +11,8 @@ build/libkernel_live.a: kernel/Cargo.toml kernel/src/* kernel/src/*/* kernel/src build/kernel: kernel/linkers/$(ARCH).ld build/libkernel.a $(LD) --gc-sections -z max-page-size=0x1000 -T $< -o $@ build/libkernel.a + objcopy --only-keep-debug $@ $@.sym + objcopy --strip-debug $@ build/kernel_live: kernel/linkers/$(ARCH).ld build/libkernel_live.a build/live.o $(LD) --gc-sections -z max-page-size=0x1000 -T $< -o $@ build/libkernel_live.a build/live.o diff --git a/mk/qemu.mk b/mk/qemu.mk index f17203fb1..ccfb73405 100644 --- a/mk/qemu.mk +++ b/mk/qemu.mk @@ -27,6 +27,9 @@ endif ifneq ($(usb),no) QEMUFLAGS+=-device nec-usb-xhci,id=xhci -device usb-tablet,bus=xhci.0 endif +ifneq ($(gdb),yes) + QEMUFLAGS+=-s +endif ifeq ($(UNAME),Linux) ifneq ($(kvm),no) QEMUFLAGS+=-enable-kvm -cpu host