Course Website: https://pdos.csail.mit.edu/6.828/2022/schedule.html
I use WSL(Ubuntu-22.04) + docker to run xv6, this is how I set up the environment:
docker run -it -v $PWD:/xv6-riscv -p 127.0.0.1:8080:25000 jjolly/xv6
You will need to map the default gdb port to localhost by above command.
Since the grading script was written in python, you have to install python inside docker container.
apt-get update
apt-get install -y python3
Note that if you use windows you have to set Line Separator to LF
, otherwise the grade-lab script will fail to run.
To use the integrated GUI debugger in VS code:
- Install this vscode extension: Native Debug
This extension allow you to attach to remote gdbserver within your docker container. - Install gdb-multiarch on your wsl.
apt install gdb-multiarch
- Add the following configuration to your
launch.json
file.{ "type": "gdb", "request": "attach", "name": "Attach to gdbserver", "gdbpath": "/usr/bin/gdb-multiarch", "executable": "kernel/kernel", "target": "127.0.0.1:8080", "remote": true, "printCalls": true, "cwd": "${workspaceRoot}", "valuesFormatting": "parseText" }
- Start gdbserver:
Now you can click the debug button "Attach to gdbserver" and add some breakpoint to debug the program.
make qemu-gdb