Debug Pintos in VS Code (by Darren Liu)
Basically dpin
starts Pintos and expose the port 1234
so it can be accessible at localhost:1234
on the host machine. Since it is accessible, we can now hook up VS Code’s debugger (or any other debugger)
Installation
- Install this:
Name: C/C++ Id: ms-vscode.cpptools Description: C/C++ IntelliSense, debugging, and code browsing. Version: 1.0.1 Publisher: Microsoft VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
- Make a symlink from your source code and
/pintos
by doingsudo ln -s $PINTOS_PATH /
- This is needed or you’ll get some error because you need the file paths to be the same or it gives you an error like
Unable to open 'init.c': Unable to read file '/pintos/src/threads/init.c' (Error: Unable to resolve non-existing file '/pintos/src/threads/init.c').
- This is needed or you’ll get some error because you need the file paths to be the same or it gives you an error like
Usage
- Run
dpin
on your host machine - Run
pintos
in the container with--gdb --
- In VS Code,
CTRL+P
- Select
>Debug: Start Debugging
- Note Pintos GDB macros (
dumplist
and friends) can be run using-exec XXX
(Example:-exec dumplist &all_list thread allelem
)