|
|
|
|
|
|
|
《软件调试》答疑
帖子发起人: Landy 发起时间: 2010-03-08 21:32 下午 回复: 2
|
帖子排序:
|
|
|
|
2010-03-08, 21:32 下午
|
Landy
注册: 2010-03-04
发 贴: 2
|
|
|
P71页清单3-1 演示错误类异常的Fault小程序
在我的Visual Studio 2008的环境里,运行这个程序,进入无限循环。输出结果是
Before div in __try block:nDividend=22, nDivisor=0, nResult=100 In __except block: nDividend=22, nDivisor=0, nResult=100 Divided by zero detected: nDividend=22, nDivisor=1, nResult=100 In __except block: nDividend=22, nDivisor=1, nResult=100 Divided by zero detected: nDividend=22, nDivisor=1, nResult=100 In __except block: nDividend=22, nDivisor=1, nResult=100 Divided by zero detected: nDividend=22, nDivisor=1, nResult=100 In __except block: nDividend=22, nDivisor=1, nResult=100 Divided by zero detected: nDividend=22, nDivisor=1, nResult=100 In __except block: nDividend=22, nDivisor=1, nResult=100 Divided by zero detected: nDividend=22, nDivisor=1, nResult=100 In __except block: nDividend=22, nDivisor=1, nResult=100 //Ctrl+C..
从输出看,nDivisor已经是1了,为什么还在不断触发DIVIDE_BY_ZERO异常?
谢谢!
|
|
|
IP 地址: 已记录
|
报告
|
|
|
|
2010-03-09, 12:44 下午
|
格蠹老雷
注册: 2005-12-19
发 贴: 1,303
|
|
|
因为VS2K8产生的除法指令是用寄存器做除数,请参考下面这个帖子来解决这个问题:
http://advdbg.com/forums/1292/ShowPost.aspx
|
|
|
IP 地址: 已记录
|
报告
|
|
|
|
2010-03-09, 21:31 下午
|
Landy
注册: 2010-03-04
发 贴: 2
|
|
|
|
|
IP 地址: 已记录
|
报告
|
|
|
|
高端调试 » 图书 » 《软件调试》答疑 » Re: 请教P71页的小程序
|
|
|
|
|
|