From 2ae6a312ecd3c94892066624b43c9a2b08f48cf9 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Sat, 7 Oct 2023 16:09:02 +0200 Subject: ide: add some debugging support --- .vscode/extensions.json | 1 + .vscode/launch.json | 14 ++++++++++++++ .vscode/tasks.json | 23 +++++++++++++++++++++++ source/CMakeLists.txt | 2 ++ source/kernel/arch/x86_64/CMakeLists.txt | 4 ++-- 5 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 8122897..42538eb 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -4,6 +4,7 @@ "ms-python.python", "ms-vscode.cmake-tools", "ms-vscode.cpptools", + "webfreak.debug", "zixuanwang.linkerscript" ] } \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..8c56401 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb) Attach to QEmu", + "request": "attach", + "type": "gdb", + "executable": "${workspaceFolder}/build/Debug/bin/kernel", + "target": "127.0.0.1:1234", + "remote": true, + "cwd": "${workspaceFolder}", + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..db94c63 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,23 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Boot in QEMU", + "command": "qemu-system-x86_64", + "type": "shell", + "args": [ + "-S", + "-s", + "-m", + "32M", + "-cdrom", + "${workspaceFolder}/build/Debug/teachos.iso" + ], + "presentation": { + "reveal": "always" + }, + "group": "none", + "problemMatcher": [] + } + ] +} \ No newline at end of file diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 0ae9e40..3fa076c 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -7,5 +7,7 @@ project("kernel" LANGUAGES ASM C CXX ) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") + add_subdirectory("boot") add_subdirectory("kernel") diff --git a/source/kernel/arch/x86_64/CMakeLists.txt b/source/kernel/arch/x86_64/CMakeLists.txt index 303ae1f..99fafe7 100644 --- a/source/kernel/arch/x86_64/CMakeLists.txt +++ b/source/kernel/arch/x86_64/CMakeLists.txt @@ -34,7 +34,7 @@ set_target_properties("kernel" PROPERTIES find_package("grub-mkrescue") if(grub-mkrescue_FOUND) - set(ISO_FILE "${PROJECT_BINARY_DIR}/teachos-${PROJECT_VERSION}.iso") + set(ISO_FILE "${PROJECT_BINARY_DIR}/teachos.iso") file(GENERATE OUTPUT "isofs/boot/grub/grub.cfg" @@ -48,7 +48,7 @@ if(grub-mkrescue_FOUND) "${CMAKE_CURRENT_BINARY_DIR}/isofs" "$" "2>/dev/null" - SOURCES + DEPENDS "$" "isofs/boot/grub/grub.cfg" BYPRODUCTS "${ISO_FILE}" -- cgit v1.2.3