回 帖 发 新 帖 刷新版面

主题:关于程序调试的问题

各位大侠,我有个调试的疑惑,现在我能会用单步调试,但我的程序里面有很多循环,单步调试的话太繁琐,所以想问一下,能不能这样设置,就是当循环数达到我设定的整数值时,执行暂停,相当于断点。不知道说清楚了没有,还望高手指点迷津,多谢!

回复列表 (共6个回复)

沙发

直接加一段代码进去, write你想要的东西出来不就可以了?

板凳


这个我也想到了,只不过现在就是想挖掘一下编译器的调试功能,呵呵

3 楼

条件调试,一般调试器都有这个功能

4 楼


恩,我也觉得会有的,特别是像CVF这样比较成熟的编译器,但是就是不知道怎样实现。

5 楼

你应该去看cvf/vc的调试器帮助,找能设置条件断点的地方

gdb的话直接
b 7 if (i.eq.5)
即可

6 楼

多谢啊,刚才查了一下CVF编译器的帮助文档,真的很有用,下面是针对我问题的答案,
Using Breakpoints in the Debugger

To set a location condition breakpoint:

In a text editor window (or in the Call Stack or Disassembly window), click the line at which you want to enable a location condition breakpoint. 
Do the following: 
In the Edit menu, select Breakpoints. 
In the Location tab, click the arrow to the right of the Break At field. 
Click the displayed line number. 
Click the Condition button to display the Condition Breakpoint dialog box. 
Type the desired condition, such as: 
A(1) .gt. 0
Click OK to dismiss the Condition Breakpoint dialog. 
Click OK 


再次感谢!

我来回复

您尚未登录,请登录后再回复。点此登录或注册