From 54cf703d13bddbe81e15858b1bfdb7111a3f56de Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 24 Sep 2024 22:45:00 +0200 Subject: Load debug symbols on the gdb target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Load the debug symbols into the gdb session by simply passing the executable file into gdb directly. Moreover, allow users of the gdb target to provide an extra variable so to pass extra flags to gdb. Moreover, this commit comes with other small cleanups on the Makefile, like a proper ABI specifier, Signed-off-by: Miquel Sabaté Solà --- Makefile | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 611ee48..df82342 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ## -# By default everything is silent. If you want to change this behavior, simply +# By default everything is silent. If you want to change this behavior simply # assign V=1 when calling make. V = @@ -21,14 +21,19 @@ CC = $(CROSS_COMPILE)gcc$(CC_SUFFIX) LD = $(CROSS_COMPILE)ld QEMU ?= qemu-system-riscv64 -ISA ?= rv64imafdc_zicntr_zicsr_zifencei_zihpm_zca_zcd_zba_zbb -CCFLAGS = -march=$(ISA) -Iinclude/ -mabi=lp64 -CCFLAGS += -Werror -Wpedantic -Wall -Wextra -Wcast-align -Wcast-qual -Winit-self \ - -Wmissing-include-dirs -Wredundant-decls -Wshadow -Wsign-conversion \ - -Wswitch-default -Wundef -Wunreachable-code -Wmissing-noreturn -LDFLAGS = -Iinclude/ -static -nostdlib -melf64lriscv -z noexecstack -QEMU_FLAGS ?= -QEMU_BIOS ?= +ISA ?= rv64imafdc_zicntr_zicsr_zifencei_zihpm_zca_zcd_zba_zbb +CCFLAGS = -march=$(ISA) -Iinclude/ -mabi=lp64d +CCFLAGS += -Werror -Wpedantic -Wall -Wextra -Wcast-align -Wcast-qual -Winit-self \ + -Wmissing-include-dirs -Wredundant-decls -Wshadow -Wsign-conversion \ + -Wswitch-default -Wundef -Wunreachable-code -Wmissing-noreturn +LDFLAGS = -Iinclude/ -static -nostdlib -melf64lriscv -z noexecstack + +## +# Optional parameters for QEMU and gdb. + +QEMU_FLAGS ?= +QEMU_BIOS ?= +GDB_EXTRA_FLAGS ?= ## # You can pass an optional `DEBUG` variable to manipulate the build type. This @@ -74,7 +79,7 @@ $(KRNL): $(OBJ) $(LINKER).S $(Q) $(CC) $(CCFLAGS) -c $< -o $@ .PHONY: qemu -qemu: +qemu: $(KRNL) ifeq ($(strip $(QEMU_BIOS)),) $(Q) $(QEMU) $(QEMU_FLAGS) -machine virt -kernel $(KRNL) -nographic else @@ -83,7 +88,7 @@ endif .PHONY: gdb gdb: - $(Q) gdb --command utils/init.gdb + $(Q) gdb --command utils/init.gdb $(GDB_EXTRA_FLAGS) $(KRNL) .PHONY: clean clean: -- cgit v1.2.3