如何在freedos中调试程序

47 views
Skip to first unread message

zhuzhu config

unread,
Apr 11, 2011, 10:32:11 AM4/11/11
to osfrom...@googlegroups.com
我想在freedos中使用DOS的debug命令,却发现不得,提示没有这个命令,我翻了很多资料都没有提到freedos中的调试命令。请问大侠,如何在freedos中调试程序?

zhiquan wang

unread,
Apr 11, 2011, 9:30:58 PM4/11/11
to osfrom...@googlegroups.com
-------在bochs下freedos的Debug

在想调试的程序处添加一句xchg bx,bx,然后在Bochsrc.bxrc文件里添加一句magic_break:
enabled=1,然后选择调试启动Bochs虚拟机,当执行到xchg bx,bx指令时就会自动断到Bochsdbg里。

这种方法在Bochsrc_sample.txt文件里有介绍,但我想很多人都跟我一样没仔细看:-)

u /45 disassemble 反汇编45条指令

x /32xb es:edi - 16 <---查看es:di 前后的内容

x /13xcb es:ei - 11 <---显示字符

2011/4/11 zhuzhu config <confi...@gmail.com>:


> 我想在freedos中使用DOS的debug命令,却发现不得,提示没有这个命令,我翻了很多资料都没有提到freedos中的调试命令。请问大侠,如何在freedos中调试程序?
>

> --
> You received this message because you are subscribed to the Google
> Groups "自己动手写操作系统" group.
> To post to this group, send email to osfrom...@googlegroups.com
> To unsubscribe from this group, send email to
> osfromscratc...@googlegroups.com
> For more options, visit this group at
> https://groups.google.com/group/osfromscratch?hl=en
>

zhuzhu config

unread,
Apr 12, 2011, 9:38:30 AM4/12/11
to osfrom...@googlegroups.com
我还是不太明白:
问题1:我在bochsrc_sample.txt中找到了你提到的这一段:
#=======================================================================
# other stuff
#=======================================================================
#magic_break: enabled=1
#load32bitOSImage: os=nullkernel, path=../kernel.img, iolog=../vga_io.log
#load32bitOSImage: os=linux, path=../linux.img, iolog=../vga_io.log, initrd=../initrd.img
#text_snapshot_check: enable
但我没看出来它和bochsdbg的关系,我尝试在pmtest2.asm中的一段:
 call DispReturn
 xchg  bx,bx
 call TestRead
 call TestWrite
 call TestRead
 
加入xchg bx,bx
然后我执行的命令如下:见附件
结果我还是没法在freedos中调试
4.jpg

xiilin

unread,
Apr 17, 2011, 10:28:28 AM4/17/11
to osfromscratch
 
怎么会呢?在我的Bochs2.4.2里面可以看到:
#=======================================================================
# MAGIC_BREAK:
# This enables the "magic breakpoint" feature when using the debugger.
# The useless cpu instruction XCHG BX, BX causes Bochs to enter the
# debugger mode. This might be useful for software development.
#
# Example:
#   magic_break: enabled=1
#=======================================================================
#magic_break: enabled=1
 
2011-04-17

xiilin

发件人: zhuzhu config
发送时间: 2011-04-12  21:38:32
收件人: osfromscratch
抄送:
主题: Re: [OSFS:2838] 如何在freedos中调试程序

beiju

unread,
Apr 17, 2011, 10:39:56 AM4/17/11
to osfromscratch
书上第三章中
说要将pmtset.com文件写入 pm.img 再和dos一起运行
如何将。com文件复制到.im文件中
用floppywrite不行啊

蒋建勇

unread,
Apr 17, 2011, 10:54:38 PM4/17/11
to osfrom...@googlegroups.com
windows 下可以用winimage, liunx 下书上已经写了。看样子你还是在windows下,如果你是学生,建议你还是彻定用liunx,别怕麻烦,所有的问题都可以google

--

Feiran Zheng

unread,
Apr 17, 2011, 10:56:17 PM4/17/11
to osfrom...@googlegroups.com
对,长久来说用windows更麻烦,还是linux方便太多。

2011/4/18 蒋建勇 <jiangjia...@gmail.com>:

--
Best regards!
Fam Zheng

xiilin

unread,
Apr 20, 2011, 1:01:05 AM4/20/11
to osfromscratch
如果不能用magic_break常见的有两个原因,一是你在bochsrc.bxrc中写magic_break时没去掉前面的'#'导致注释掉了这一行,二是你没有选择调试启动bochs,从你的截图来看应该属于第一种情况,如果是加上了magic_break而直接选择运行的话bochs是会panic的。
 
 
2011-04-20

xiilin

发件人: xiilin
发送时间: 2011-04-17  22:28:02
收件人: osfromscratch
抄送:
主题: Re: Re: [OSFS:2872] 如何在freedos中调试程序
 
怎么会呢?在我的Bochs2.4.2里面可以看到:
#=======================================================================
# MAGIC_BREAK:
# This enables the "magic breakpoint" feature when using the debugger.
# The useless cpu instruction XCHG BX, BX causes Bochs to enter the
# debugger mode. This might be useful for software development.
#
# Example:
#   magic_break: enabled=1
#=======================================================================
#magic_break: enabled=1
 
2011-04-17

xiilin

发件人: zhuzhu config
发送时间: 2011-04-12  21:38:32
收件人: osfromscratch
抄送:
主题: Re: [OSFS:2838] 如何在freedos中调试程序
Reply all
Reply to author
Forward
0 new messages