<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

文章分类

导航

订阅

[WinDBG]新闻组拮趣之私有符号

在Windows底层开发圈里,OSR的几个邮件新闻组很是有名。具体来说就是讨论调试的windbg,讨论一般驱动开发问题的ntdev和讨论文件系统有关问题的ntfsd。

浏览这些新闻组的邮件是我闲暇时的一件乐事。除了可以了解信息、学到一些知识和技巧外,还可以提高英文,领略地道的美式幽默,或者看如何用英文“发牢骚”和“斗嘴”。

很早就想把阅读这些新闻组的收获写成短文与大家分享,但是都没有真正实施。今天算做这个系列的正式开始吧!

首先,一位名为Joe的先生发出信息求助,遇到的问题是找不到可以用于Server 2003的扩展模块fltkd。

在EMAIL中,Joe还给出了WinDBG失败现场的信息:

0: kd> .load fltkd
0: kd> !frames

*** Extension DLL(6526 Free) does not match target system(3790 Free)

在信的末尾,JOE述说他心中的怨闷:

I have spent hours searching the internet, microsoft and OSRonline and have
been able to find a version of this extension that will work with W2k3 sp1.

找了几个小时呀,该找的地方都找了!于是他怀疑要找的目标是不是存在:

Does this version of the extension even exist?  If so, where can I find it?

如果有,在哪里?

OSR的新闻组之所以精彩,是因为上面有很多高手!但是高手的回复可能不是那么快。过了几天后,经常在WinDBG新闻组出现的Rob先生回复了,但不是走向成功的喜讯,而是让人绝望的判决:

Sadly, this is pretty common.  In my experience it is always the extension
that you think would be incredibly helpful which is broken.

很精炼的语言,导出了很多人心中的苦闷。“根据我的经验,总是那些你以为会特别有用的扩展不好用了。”是啊,今年年初,我也有同样的经历,提示信息中建议使用一个扩展模块来调试,但是无论如何,你也找补到它:-(

而本案是找到了扩展模块,但是它不工作。提示的信息是“版本不匹配”。事实上,这样的错误提示“经常是”项庄舞剑,所云非所是。因此Rob先生写到:

Often that warning can be ignored

“很多时候,那个警告信息是可以忽略的”。那到底是什么原因呢?

however the extensions very often require
the private symbols which are only available inside microsoft.  I have
*never* been able to get fltkd to work and it has usually been because of
symbols.

更多时候,不工作的原因是需要私有符号,仅有微软内部才有的私有符号。“我从来没有能让fltkd工作,通常都是因为符号。”

这里Rob依然表现出了一个技术高手的审慎精神,使用very often,usually这样的副词,没有绝对化。事实上,这里基本是都可以用always的。

我特意在自己的系统上做了个实验:

lkd> .load fltkd          && 加载成功
lkd> !frames

*** Extension DLL(6526 Free) does not match target system(2600 Free)

错误信息的第一行与Joe的一模一样。但是后面还有更多信息:

*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: fltmgr!_GLOBALS                               ***
***                                                                   ***
*************************************************************************

Could not read offset of field "FrameList.rList" from type fltmgr!_GLOBALS

看到上面的信息就可以确认问题是出在符号上了。!frames命令需要找到内核模块fltmgr中的全局变量_GLOBALS,但是要找到这个全局变量,不能依靠hard code的地址偏移,需要靠符号文件的帮助。但通常只有私有符号文件中才包含变量名称、类型这样的符号。

微软符号服务器上公开的都是公共符号文件,已经剥离了变量、类型等私有信息。

至此,问题阐释清楚了,但EMAIL没有完,Rob无奈的感慨道:

I have often wondered which is the more frustrating, not having the tool you
need or knowing that the tools exists but that you cannot use it.

我不知道哪一个更令人沮丧,是压根不知道有需要的工具存在还是知道它存在但是不能用。

又过了一天,另一位经常在WinDBG新闻组上发言的Pavel先生给Rob上面的话加了一个无奈的评注:

Wish this be the most frustrating thing you'll know...

 

posted on 2008年9月24日 22:16 由 Raymond

# re: [WinDBG]新闻组拮趣之私有符号 @ 2010年2月2日 17:44

有技术含量的人,开起玩笑来也同样有技术含量!!!

yuhongweidebug

Powered by Community Server Powered by CnForums.Net