running and debugging xv6

part 1: running xv6

step 1: Fetch and un-tar the xv6 source:

step 2: Build xv6:

step 3: install qemu

$sudo apt-get install qemu
$qemu-system-i386                                    // run qemu for testing                    

step 4: Test Your Compiler Toolchain

Modern Linux and BSD UNIX distributions already provide a toolchain suitable for 6.828. To test your distribution, try the following commands:

% objdump -i

The second line should say elf32-i386.

% gcc -m32 -print-libgcc-file-name

The command should print something like /usr/lib/gcc/i486-linux-gnu/version/libgcc.a or/usr/lib/gcc/x86_64-linux-gnu/version/32/libgcc.a

If both these commands succeed, you're all set, and don't need to compile your own toolchain.


Part 2: debugging

step 1:

cd to xv6 folder

$ make qemu-gdb


step 2:

1. open anther terminal

2. cd to xv6 folder

3.

$ gdb kernel

note:
 if it has warning of : File "**/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load"
solution:
1. $ source  .gdbinit.  
or 2.  add
    add-auto-load-safe-path **/.gdbinit
line to your configuration file "**/.gdbinit" 

at this point ,you can begin debugging xv6


reference:

1. http://zoo.cs.yale.edu/classes/cs422/2011/lec/l2-hw

2. https://pdos.csail.mit.edu/6.828/2016/tools.html

3. https://pdos.csail.mit.edu/6.828/2016/homework/xv6-boot.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值