Skip to content

Instantly share code, notes, and snippets.

@yifeiyin
Last active February 16, 2021 01:52
Show Gist options
  • Save yifeiyin/0299f580da2339e68e2106513e8608a2 to your computer and use it in GitHub Desktop.
Save yifeiyin/0299f580da2339e68e2106513e8608a2 to your computer and use it in GitHub Desktop.
Debug pintos with VSCode
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.122.1/containers/docker-existing-dockerfile
{
"name": "Existing Dockerfile",
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerFile": "../Dockerfile",
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": null
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": ["webfreak.debug", "ms-vscode.cpptools", "wangweixuan.yithemes"]
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Uncomment the next line to run commands after the container is created - for example installing curl.
// "postCreateCommand": "apt-get update && apt-get install -y curl",
// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
}
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Start Debugging",
"type": "gdb",
"request": "attach",
"remote": true,
"target": ":1234",
"env": {
"GDBMACROS": "/pintos/src/misc/gdb-macros"
},
"debugger_args": ["-x", "/pintos/src/misc/gdb-macros"],
"executable": "/pintos/src/filesys/build/kernel.o",
// "cwd": "${workspaceRoot}",
"cwd": "/pintos/src/filesys/build",
"valuesFormatting": "parseText",
"autorun": [
"loadusersymbols tests/userprog/args-none",
// "loadusersymbols tests/filesys/extended/dir-empty-name",
"b src/lib/kernel/debug.c:debug_panic",
"b kill"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment