gdb忽略Qemu引导程序中的断点 [英] gdb ignores breakpoint in Qemu bootloader

查看:219
本文介绍了gdb忽略Qemu引导程序中的断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试逐步完成本教程中显示的简单引导程序: http ://mikeos.berlios.de/write-your-own-os.html -因此,我可以使用Qemu监视器检查常规注册簿以进行教育.

I am trying to step through the simple bootloader shown in this tutorial: http://mikeos.berlios.de/write-your-own-os.html - so I can use the Qemu monitor to inspect the general registers for educational purposes.

虽然我能够连接Qemu和gdb,并将断点设置在引导加载程序(0x7c0)的开头,但在gdb上单击"c"后,代码将一直运行到最后.

Eventhough I am able to connect Qemu and gdb and the breakpoint is set at the beginning of the bootloader (0x7c0), after hitting "c" on gdb the code just runs all the way till the end.

我已阅读kvm可能会将gbd与虚拟内存地址混淆",因此我将其禁用.这没用.

I have read kvm may "confuse" gbd with virtual memory addresses, so I disabled it. This didn't work.

我还阅读了(在qemu中使用gdb调试引导加载程序)从HEAD编译gdb后调试Freedos引导时.我没有重新编译gdb,而是尝试调试Freedos引导-有效!

I also read (Debugging bootloader with gdb in qemu) things worked when debugging Freedos boot after compiling gdb from HEAD. Instead of recompiling gdb, I tried debugging the Freedos boot - It worked!

所以,我确实相信我的问题实际上是让教程的引导加载程序逐步执行.

So, I do believe my problem is actually getting the tutorial's bootloader to go through a step-by-step execution.

我尝试过的其他方法(都不起作用)

Other things I tried (none of them worked):

在插入断点之前使用数十个"si" 尝试不同的断点地址 在qemu上使用-singlestep键

Use dozens of "si" before inserting the breakpoint Try different breakpoint addresses Use the -singlestep key on qemu

这是我的qemu命令行:

Here is my qemu command line:

qemu-system-i386 -fda disquete.img-启动a -s -S -monitor stdio

qemu-system-i386 -fda disquete.img -boot a -s -S -monitor stdio

这是我在gdb中的命令序列:

Here is my command sequence inside gdb:

(gdb)目标远程本地主机:1234 (GDB)设置架构i8086 (gdb)br * 0x7c0

(gdb) target remote localhost:1234 (gdb) set architecture i8086 (gdb) br *0x7c0

然后我按"c"键,它就一直通过断点.

Then I hit "c" and it just passes the breakpoint all the way.

版本:

$ uname -a

$ uname -a

Linux Brod 3.8.0-30-generic#44-Ubuntu SMP Thu Aug 22 20:52:24 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Linux Brod 3.8.0-30-generic #44-Ubuntu SMP Thu Aug 22 20:52:24 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

$ gdb --version

$ gdb --version

GNU gdb(GDB)7.5.91.20130417-cvs-ubuntu

GNU gdb (GDB) 7.5.91.20130417-cvs-ubuntu

$ qemu --version

$ qemu --version

QEMU仿真器版本1.4.0(Debian 1.4.0 + dfsg-1expubuntu4),版权所有(c)2003-2008 Fabrice Bellard

QEMU emulator version 1.4.0 (Debian 1.4.0+dfsg-1expubuntu4), Copyright (c) 2003-2008 Fabrice Bellard

由于我能够逐步完成Freedos引导,因此我确实相信我的设置很好,并且在我对本文开头提到的bootloader教程的引导过程的概念性误解中,我一定会失败.

As I am able to step through the Freedos boot, I do believe my setup is fine and I must be failing within some conceptual misunderstanding of the boot process for the bootloader tutorial I mentioned in the beginning of this post.

欢迎所有帮助!

推荐答案

由于硬件虚拟化,可能有必要使用硬件断点:

Because of hardware virtualization, it may be necessary to use a hardware breakpoint:

(gdb) hbreak *0x7c00

即使在使用64位CPU(或kvm)时,也要注意gdb中的正确体系结构:由于CPU仍处于实模式,因此引导加载程序需要(gdb) set architecture i8086.

Also watch out for the correct architecture in gdb, even when using a 64-bit CPU (or kvm): The bootloader needs (gdb) set architecture i8086 as the CPU is still in real mode.

这篇关于gdb忽略Qemu引导程序中的断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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