VSCode Development Setup (by Mustafa Quraish)

Docker-Compose file

version: '3.4'
services:
    dev:
        image: thierrysans/pintos
        container_name: pintos
        volumes:
            - .:/pintos
        working_dir: /pintos
        hostname: pintos
        tty: true
        entrypoint: bash

docker-compose.yml file contents

How to set up working environment:

$> ls
docker-compose.yml
$> docker-compose up -d
Creating network "pintos_default" with the default driver
Creating pintos ... done
$>

media/Screen_Shot_2021-04-22_at_12.21.11_AM.png

Attaching VSCode to container

media/Untitled.png

Successfully connected!


How to debug:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "gdb",
            "request": "attach",
            "name": "Attach to Pintos",
            "executable": "${workspaceFolder}/src/threads/build/kernel.o",
            "target": ":1234",
            "remote": true,
            "cwd": "${workspaceRoot}", 
            "gdbpath": "/pintos/src/utils/pintos-gdb"
        }
    ]
}

launch.json file with configuration

pintos --gdb -v -k -T 60 --bochs -- -q run alarm-single

media/Untitled%201.png

What setting a breakpoint looks like in VSCode

media/Untitled%202.png

Start GDB

Some helpful VSCode keybindings

Here’s some of the things you can look for and remember / customize shortcuts for in the Keyboard Shortcuts menu (in preferences). On Windows/Linux, replace Cmd with Ctrl