Skip to content

Commit

Permalink
Merge pull request #75 from rellermeyer/improved-vscode-config
Browse files Browse the repository at this point in the history
Improves VSCode Launch Configuration
  • Loading branch information
Zohar Cochavi authored Mar 5, 2021
2 parents 6f36684 + 46ce3af commit ca9e606
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Build files
/build
src/kernel/kernel.bin
src/kernel/flash.bin
src/kernel/boot-commands
Expand Down Expand Up @@ -31,6 +32,8 @@ src/course_os_docs.pdf
/.idea/
!/.idea/runConfigurations
/.vscode/
!/.vscode/launch.json
!/.vscode/tasks.json
*~
*.swp
[._]*.s[a-w][a-z]
Expand Down
31 changes: 26 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,37 @@
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Attach - C/C++",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/src/kernel/build/kernel.sym",
"cwd": "${workspaceFolder}/src/kernel/",
"miDebuggerPath": "${workspaceFolder}/src/toolchain/arm-none-eabi/bin/arm-none-eabi-gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true,
}
],
"linux": {
"MIMode": "gdb",
},
"miDebuggerServerAddress": "localhost:1234",
"preLaunchTask": "run_debug",
},
{
"name": "(gdb) Attach - Native",
"type": "gdb",
"request": "attach",
"gdbpath": "${workspaceFolder}/toolchain/arm-none-eabi/bin/arm-none-eabi-gdb",
"name": "Debug",
"executable": "${workspaceFolder}/kernel/build/kernel.sym",
"gdbpath": "${workspaceFolder}/src/toolchain/arm-none-eabi/bin/arm-none-eabi-gdb",
"executable": "${workspaceFolder}/src/kernel/build/kernel.sym",
"target": ":1234",
"remote": true,
"cwd": "${workspaceRoot}",
// "preLaunchTask": "run_debug",
"valuesFormatting": "prettyPrinters"
"valuesFormatting": "prettyPrinters",
"preLaunchTask": "run_debug",
"postDebugTask": "stop_debug",
},
]
}
39 changes: 36 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Set gdb_path",
"detail": "Adds generated toolchain to PATH variable. Will first load system and package binaries if available",
"type": "shell",
"command": "if [[ $(which arm-none-eabi-gdb) == *\"not\"* ]]; then export GDB_PATH=\"$(which arm-none-eabi-gdb)\"; else export GDB_PATH=\"${PWD}/src/arm-none-eabi/bin/\"; fi"
},
{
"label": "make test",
"detail": "Runs the course_os test suite",
"dependsOn": "set gdb_path",
"type": "shell",
"command": "make test",
"problemMatcher": "$gcc",
Expand All @@ -16,9 +23,35 @@
},
{
"label": "run_debug",
"detail": "Runs qemu with gdbserver",
"detail": "Runs qemu with gdbserver in the background",
"dependsOn": "set gdb_path",
"type": "shell",
"command": "cd ${workspaceFolder}/src/kernel && make debug",
"isBackground": true,
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": false
},
"problemMatcher": {
"pattern": {
"regexp": "^.*$",
},
"background": {
"activeOnStart": true,
"beginsPattern": "make debug",
"endsPattern": "Configuring tools"
}
}
},
{
"label": "stop_debug",
"detail": "Stops the qemu emulator at port 1234",
"type": "shell",
"command": "make -C kernel debug",
"command": "kill $(sudo lsof -t -i:1234)",
}
]
}
}

0 comments on commit ca9e606

Please sign in to comment.