From d0ec077c0958318ec76a540fb83caa2b311ae8dc Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 5 May 2023 17:08:36 +0300 Subject: [PATCH] Add gdb for init.elf --- .vscode/launch.json | 40 +++++++++++++++++++++++++++++++++++++++ apps/system/init/Makefile | 5 +++++ 2 files changed, 45 insertions(+) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5524bca --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,40 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "/system/init.elf", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceRoot}/out/system/init.elf", + "cwd": "${workspaceRoot}", + "args": [], + "targetArchitecture": "x64", + "MIMode": "gdb", + "miDebuggerPath": "/usr/bin/gdb", + "miDebuggerArgs": "", + "externalConsole": false, + "additionalSOLibSearchPath": "${workspaceRoot}", + "customLaunchSetupCommands": [ + { + "text": "target remote localhost:1234", + "description": "Connect to QEMU remote debugger" + } + ], + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "text": "set breakpoint pending on", + "description": "Make breakpoint pending on future shared library load." + }, + { + "text": "file ${workspaceRoot}/out/system/init.elf", + "description": "Load binary." + }, + ] + } + ] +} \ No newline at end of file diff --git a/apps/system/init/Makefile b/apps/system/init/Makefile index e06c896..f5d14ff 100644 --- a/apps/system/init/Makefile +++ b/apps/system/init/Makefile @@ -48,6 +48,11 @@ else ifeq ($(OSARCH), aarch64) CFLAGS += -pipe endif +ifeq ($(DEBUG), 1) + CFLAGS += -DDEBUG -ggdb3 -O0 -fdiagnostics-color=always -fverbose-asm + LDFLAGS += -ggdb3 -O0 +endif + build: $(FILENAME) $(OBJDUMP) -d $(FILENAME) > file_dump.map mv $(FILENAME) ../../../out/system/$(FILENAME)