aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2023-10-07 16:09:02 +0200
committerFelix Morgner <felix.morgner@ost.ch>2023-10-07 16:09:02 +0200
commit2ae6a312ecd3c94892066624b43c9a2b08f48cf9 (patch)
tree67418e744a58a90beda50bc767b7ee02cb33e275
parenta5a1c6c55aeb9db352d116806ab01477e6dec344 (diff)
downloadteachos-2ae6a312ecd3c94892066624b43c9a2b08f48cf9.tar.xz
teachos-2ae6a312ecd3c94892066624b43c9a2b08f48cf9.zip
ide: add some debugging support
-rw-r--r--.vscode/extensions.json1
-rw-r--r--.vscode/launch.json14
-rw-r--r--.vscode/tasks.json23
-rw-r--r--source/CMakeLists.txt2
-rw-r--r--source/kernel/arch/x86_64/CMakeLists.txt4
5 files changed, 42 insertions, 2 deletions
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"
"$<TARGET_FILE:kernel>"
"2>/dev/null"
- SOURCES
+ DEPENDS
"$<TARGET_FILE:kernel>"
"isofs/boot/grub/grub.cfg"
BYPRODUCTS "${ISO_FILE}"