Skip to content

Latest commit

 

History

History
129 lines (82 loc) · 2.65 KB

实验环境.md

File metadata and controls

129 lines (82 loc) · 2.65 KB

Tools Used in 6.S081

wsl2 + Ubuntu20.04

Installing on Windows

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install git build-essential gdb-multiarch qemu-system-misc gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu

Testing Installation

To test your installation, you should be able to compile and run xv6 ( to quit qemu type Ctrl-a x) :

# in the xv6 directory
$ make qemu
# ... lots of output ...
init: starting sh

DEBUG教程

(1)第一个shell,以debug模式打开qemu

# in the xv6 directory
$ make qemu-gdb

image-20230513014738961

(2)打开第二个窗口(我电脑是这样分屏的)

image-20230513022639221

(3)第二个shell,调试

# in the xv6 directory
$ gdb-multiarch

image-20230513022242342

就成功了

Q & A

如果出现下面这个问题

The target architecture is assumed to be riscv:rv64
.gdbinit:3: Error in sourced command file:
127.0.0.1:26000: 连接超时.
(gdb)

解决方案:

# in the xv6 directory
$ gdb-multiarch

出现下图:

image-20230512235939745

复制图中的 add-auto-load-safe-path /mnt/d/mit6s081/xv6-labs-2021/.gdbinit

(在这个位置的,可能不一样,不要直接复制我的)

关闭,重新打开一个窗口

  • 修改自己home目录下的.gdbinit文件,允许gdb在xv6-labs-2021这个目录启动的时候,加载该文件夹下的.gdbinit文件。再启动gdb-multiarch
# in the xv6 directory
$ echo "add-auto-load-safe-path /mnt/d/mit6s081/xv6-labs-2021/.gdbinit " >> ~/.gdbinit
$ gdb-multiarch

image-20230513020503260

PS:

gdb-multiarch是根据.gdbinit文件配置的,.gdbinit.tmpl-riscv 和 .gdbinit 要保持一致

image-20230513023904365

分屏

sudo apt-get install tmux

1、输入命令tmux使用工具

2、上下分屏:ctrl + b 再按 "

3、左右分屏:ctrl + b 再按 %

4、切换屏幕:ctrl + b 再按 o

5、关闭一个终端: ctrl + b 再按 x

6、上下分屏与左右分屏切换: ctrl + b 再按空格键