发信人: zzy (一笑而过), 信区: CRC
标  题: 再说ODB与VC联合调试的问题 
发信站: 哈工大紫丁香 (2003年06月17日09:40:52 星期二), 站内信件

再说ODB与VC联合调试的问题 
有很多贴子都说了怎样设置,但为了方便我还是先重复一下设置的过程 
 1. Edit preference 
        在bind_shobj_flags 的值后面加上 /DEBUG 
        在comp_flags和comp_flags_cpp后面加上 /Zi /Od 
2. config simulation (advanced) 
        在Envirement files里面include两项:debug 和 force_compile 
3. 运行ODB 
        在Windows下面运行simulation就可以自动运行ODB 
        也可以在console下面运行op_runsim -net_name [NET_NAME] -debug 
4. 调试 
        在VC下面attach to process, 
        就可以利用ODB和VC提供的调试功能进行调试了:) 
为什么这样设? 
看了本版的一些贴子,感觉有一些站友存在某些误解,就多说一点。 
1. 大家都知道,要利用VC来进行调试,就必须在编译和连接的时候生成调试信息。 
        第一项设置就是完成这个功能的。 
        编译的时候产生调试信息的参数是 /Z7 或 /Zi,(注意:/Z8并不是合法的参数)
。 
        调试时还需要关闭编译器的优化功能,所以还要加上/Od。 
   目前还没找到任何资料说上面的两个参数有顺序问题,我自己试验的结果是没有影响 

。 
   连接的时候需要保留调试信息,所以在bind_shobj_flags后面要加上 /DEBUG。 
2. config simulation里面的debug,       目的是让op_runsim运行在debug模式下, 
效于console下面 
的 -debug。 
        force_compile的作用是每次编译时都重建所有的模块, 
        以使你在VC下面看到的源程序都是最新的。 
3. 没什么说的 
4. 有人反映在VC调试时,从断点后开始单步运行, 
        最后总会走到一个向汇编中的机器代码的地方。 
        odb那边也不能敲任何命令。 
        这很正常,那个汇编的地方就是OPNET的内核之类的东西。 
        不用管它,在VC里面再选run就行了。 
        程序会运行到VC的下一个断点,或者ODB重新可以敲命令了。 
        都没有?                 内存出错了吧。。。 
5.  附:VC help中关于编译连接参数的说明 
/Od 
Disable (Debug) Turns off all optimizations in the program and speeds compi 
lation. This option 
simplifies debugging because it suppresses code movement. 
/Z7 
C 7.0- Compatible Produces an .OBJ file and an .EXE file containing line nu 
mbers and full 
symbolic debugging information for use with the debugger.  The symbolic debu 
gging information 
includes the names and types of variable s, as well as functions and line nu 
mbers. 
/Zi 
Program Database Produces a program database (PDB) that contains type infor 
mation and symbolic 
debugging information for use with the debugger.  The symbolic debugging inf 
ormation includes the 
names and types of variable s, as well as functions and line numbers. 
  
  

--
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.228.213]
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.039毫秒