调试引导程序与QEMU GDB [英] Debugging bootloader with gdb in qemu

查看:519
本文介绍了调试引导程序与QEMU GDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有似乎与FREEDOS引导程序中的问题。 (看来,引导code找不到在某些情况下的内核。)

There seems to be a problem with the Freedos bootloader. (It appears that the bootcode can't find the kernel in certain circumstances.)

所以我想使用gdb调试bootloader的QEMU。以下几个wiki和免费提供的在线课程材料中的说明,我运行QEMU这样

So I'm trying to debug the bootloader in qemu with gdb. Following the instructions found on several wiki and freely available online course materials, I run qemu like this

qemu-system-i386 -fda fdboot.img -boot a -s -S

然后连接GDB这样

And then connect gdb like this

$ gdb
(gdb) target remote localhost:1234

我可以通过第10步 - 12说明书与 SI 我以为是SeaBIOS

I can step through the first 10 - 12 instructions with si which I assume is the SeaBIOS.

但过去,当我尝试步入引导程序code,它继续执行不破,全部达到了FreeDOS的菜单提示的方式。这完全跳过引导程序code这因为它是执行,我想检查一步一步来。

But past that, when I try to step into bootloader code, it continues execution without breaking, all the way up to the FreeDos menu prompt. This totally skips the bootloader code which I would like to examine step by step as it is executed.

什么是我需要做的,这样我可以一步虽然引导程序?

What do I need to do so that I can step though the bootloader?

[您可以从项目网站下载FreeDOS的软盘镜像,如果你想尝试自己。]

[You can download the freedos floppy images from the project website if you want to try yourself.]

推荐答案

做工精细用在这里QEMU 1.3和gdb 7.3.50.20111117(你没有说你使用什么版本)。
我能够单步吨指令,直到我觉得无聊,并放置一个断点赶引导程序:

Works fine here using qemu 1.3 and gdb 7.3.50.20111117 (you didn't say what versions you used). I was able to single step tons of instructions until I got bored and placed a breakpoint to catch the bootloader:

(gdb) br *0x7c00
Breakpoint 1 at 0x7c00
(gdb) c
Continuing.

Breakpoint 1, 0x00007c00 in ?? ()
(gdb) x/i $eip
=> 0x7c00:      jmp    0x7c3e

请注意,我已经设置GDB以16位模式下首先使用集架构i8086

Note that I have set gdb to 16 bit mode first using set architecture i8086.

这篇关于调试引导程序与QEMU GDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆