首 页 网络编程
网页制作 图形图象 操作系统 冲浪宝典
软件教学 认证考试

网络安全 网络办公 行业资讯 评测对比
您当前位置:站长天空 -> 网络编程-> C#/CSHARP教程
Windows应用程序调试必备的--符号文件(Symbols)-.NET教程,评论及其它
作者:网友供稿 点击:208
推荐
西部数码-全国虚拟主机10强!20余项虚拟主机管理功能,全国领先!第6代双线路虚拟主机,南北访问畅通无阻!可在线rar解压,自动数据恢复设置虚拟目录等.免费赠送访问统计,企业邮局.Cn域名注册10元/年,自助建站480元起,免费试用7天,满意再付款!P4主机租用799元/月.月付免压金
站内搜索
文章页数:[1] 
symbol files hold a variety of data which are not actually needed when running the binaries(dll,exe...), but which could be very useful in the debugging process(its a good partner for vc6++ and windbg).
            通俗的说,symbol file是包含了相关二进制文件(exe,dll)调试信息的一种文件,它以.pdb为扩展名,比如winxp下有一个gdi32.dll,那么微软在编译该dll的时候会产生一个gdi32.pdb文件,程序员有了这个pdb文件愿意的话就可以用它来调试,跟踪到gdi32.dll的内部去!
             该文件和二进制文件的编译版本密切相关,比如你修改了dll的输出函数等,再编译该dll那么原先的pdb文件就过时了,不能再胜任调试的重担了,这时候你需要的是修改后编译产生的pdb文件.
             大家在用vc6编译的时候会发现pdb文件会存在于debug/release目录下(关于如何产生release版本的pdb请参看4.如何在vc6++中编译产生release版本的二进制文件的pdb文件?).
typically, symbol files might contain:
    1.全局变量(global variables)
    2.局部变量(local variables)
    3.函数名和它们的入口地址(function names and the addresses of their entry points)
    4.fpo data(frame pointer omission),frame pointer是一种用来在调用堆栈(call stack)中找到下一 个将要被调用的函数的数据结构源代码的行序号(source-line numbers)

2.如何得到symbol files?

       要安装symbol files请先确定你的os版本再到微软的网站上去下载相应的symbol files安装,安装没有什么特殊的要求,只需要随便安装到一个目录,然后在windows的环境变量中中设定这个path(也可以在vc6,windbg中设置,这样的话只有vc6或者是windbg自己能看到了…)然后windbg,ntsd,
drwatson之类的调试软件就可以找到了.
   安装symbol files就一个原则,请大家注意:
    "if you plan to install symbols manually, it is crucial that you remember this basic rule: the symbol files on the host computer are required to match the version of windows installed on the target computer"
   host computer     the host computer is the machine that runs the debugging session. in a typical two-system debugging  session, the host can be any computer which can be connected to the target computer
   target computer  the target computer is the machine that has experienced the failure of a software component, system service, an application, or of the operating system. this is the computer that needs to be debugged and is the focus of the debugging session. this can be a computer located within a few feet of the computer on which you run the debugging session, or it can be in a completely different location. sometimes referred to as the debuggee

3.如何在vc6中集成symbol files??   

     1.open your workspace in vc6++;
     2.open the options dialog box (tools->options);
     3.click the directoties tab;
     4.click executable files from the show directories for drop-down list;
     5.add the path of symbol-files  to path-list;
     6.click ok to finish.

4.如何在vc6++中编译产生release版本的二进制文件的pdb文件?

 
 这是microsoft的方法,实战中为了使得我们的代码被别人copy到其他地方也可以编译通过我一般用#pragma预编译开关来帮助我产生我需要的文件:
 
 

5.free build(retail build) and checked build(debug build)

   two different builds of each nt-based operating system exist:
   the free build (or retail build) of windows is the end-user version of the operating system. the system and drivers are built with full optimization, debugging asserts are disabled, and debugging information is stripped from the binaries. a free system and driver are smaller and faster, and it uses less memory.
the checked build (or debug build) of windows serves as a testing and debugging aid in the developing of the operating system and kernel-mode drivers. the checked build contains extra error checking, argument verification, and debugging information that is not available in the free build. a checked system or driver can help isolate and track down driver problems that can cause unpredictable behavior, result in memory leaks, or result in improper device configuration.
    although the checked build provides extra protection, it consumes more memory and disk space than the free build. system and driver performance is slower for the following reasons:
    the executables contain symbolic debugging information.
    additional code paths are executed due to parameter checking and output of diagnostic messages for debugging purposes.
 
6.如何更新symbols
          如果大家用上了windbg会发现符号文件(pdb)有多么的重要,可是这些文件都是和本地的os相关的比如说你的winxp打了sp补丁的话可能原来的符号文件就会出现不匹配的想象怎么办?网上更新!请在你们的windbg的symbols path里面输入下面一行:
        srv*d:\symbols\websymbols*http://msdl.microsoft.com/download/symbols
       (红色部分写上你们想保存的本地路径)
如果你不是通过代理上网,那么在你用windbg打开一个被调试程序后,输入symchk回车,windbg就会自动的连到微软的网站根据你的机器的情况更新新的pdb文件并保存在上面红色部分的本地路径里面,这样你就可以确保你的符号文件版本和你机器上的文件的版本一致(我指的是系统文件:dll,sys...).
 
如果你是通过代理上网那么你需要配置一下:
注意:http://home.lenovo/proxy.pac是我假设的代理配置脚本地址;10.99.20.26:8080是我假设的代理服务器地址和端口,实战中请根据你自己的情况设置.
1.配置好ie;

2.设置一个环境变量;
  
该环境变量为:_nt_symbol_path;像我这样填写就可以了


3.告诉windbg:以后可以去微软网站下载pdb文件了 


文章整理:站长天空 网址:http://www.z6688.com/
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

文章页数:[1] 


放大字体显示 缩小字体显示 打印文章 推荐给朋友
热门文章
·使用C#编写Windows Forms应用程序(转)-.NET教程,Windows开发
·C#学习杂记-.NET教程,C#语言
·将文本格式的文章转换为html/xml格式文本的功能封装到Javabean-JSP教程,Java技巧及代码
·用java小程序applet实现无限级树结构-JSP教程,Java技巧及代码
·《.net编程先锋C#》第一章 C#简介-.NET教程,C#语言
·企业人事信息管理系统1.0-ASP教程,数据库相关
·《.net编程先锋C#》第三章 第一个C#应用程序-.NET教程,C#语言
·《.net编程先锋C#》第二章 理论基础-公用语言 运行环境-.NET教程,C#语言
·Windows应用程序调试必备的--符号文件(Symbols)-.NET教程,评论及其它
·c#反编译微软msdn2003的帮助文档,并将反编译结果保存到一个sqlserver数据库中
最新文章
·vista的新特性:懒人的安全感_windows vista
·photoshop为情侣照片打造韩式梦幻相框_photoshop教程
·专访seobbs站长乐思蜀_站长访谈
·嘟嘟网络陈艺光:诚信是一种信仰_站长访谈
·俺自己黄修源:只问耕耘,不问收获_站长访谈
·李向华:如何提高论坛用户粘性_站长访谈
·给windows vista系统网络和共享中心“换脸”_windows vista
·胡宪东谈搜索优化的实战_站长心得
·网站快速成功的九个步骤_站长心得
·google pr数字背后的含意_google推广
相关主题
  • windows vista中如何用闪存保护资料_windows vista
  • windows vista sp1新增创建恢复盘功能_windows vista
  • windows vista为什么不允许两个用户同时登录_windows vista
  • windows网络安全其实我们只差五步_安全在线教程
  • windowsxp sp3 概览里面到底有什么?_windows xp
  • 西部数码虚拟主机

    友情链接
    CNNIC 西部数码
    万网 自助建站
    虚拟主机 asp空间
    域名注册 域名
    域名申请 主页空间
    论坛空间 网站空间
    国际域名 虚拟空间
    空间租用 DDOS防火墙
    成都主机托管 四川主机托管
    主机租用 服务器租用
    网站目录 自助建站
    虚拟主机 网址大全
    软件下载
    自助链接
    虚拟主机资讯 特价虚拟主机
    版权申明:本站文章均来自网络,如有侵权,请联系我们,我们收到后立即删除,谢谢!
    关于我们:站长天空:专业提供最新的站长资讯、在线教程、虚拟主机权威评测、虚拟主机性能对比、网站制作教程,开发教程,站长工具。包括网页制作教程、冲浪宝典、编程参考、操作系统、软件教学、行业动态等。
    特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有。
    发表评论 打印  刷新     关闭