See Orignal README.
- Use compiledb or bear to generate
compile_commands.json
- Add
#pragma once
macro to all header filesecho "#pragma once\n" > /tmp/head.txt for file in $(find . -name "*.h"); do cat /tmp/head.txt $file > $file.modified mv $file.modified $file done
- Add missing headers like
types.h
- Use
clang-format
to format source codesfind . -name "*.[c|h]" -exec clang-format -i {} \;
- Configure
launch.json
andtasks.json
for debugging - Change
CPUS
inMakefile
to 1 for debugging
Prerequisites:
- install required toolchains referring to Orignal README
- Change
CPUS
inMakefile
to 1 for debugging
- Run
make qemu-gdb
and you will see information belowed and.gdbinit
created*** Now run 'gdb' in another window. qemu-system-riscv64 -machine virt -bios none -kernel kernel/kernel -m 128M -smp 3 -nographic -drive file=fs.img,if=none,format=raw,id=x0 -device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0 -S -gdb tcp::25000
- Open another terminal and run
gdb-multiarch kernel/kernel
- Run
make qemu-gdb
and get.gdbinit
file in current directory - Configure
launch.json
andtasks.json
in.vscode
- You can refer these two files in this repo
- Replace
miDebuggerServerAddress
item with the specific value in.gdbinit
generated in the last step
- Click
F5
and commenttarget remote 127.0.0.1:<port>
with@REM remote 127.0.0.1:<port>
- NJU OS 2022 - learning š„³
- 6.S081 Fall 2021