如何更改年龄不匹配的PDB以正确匹配? [英] How can you change an age-mismatched PDB to match properly?

查看:259
本文介绍了如何更改年龄不匹配的PDB以正确匹配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的夜间构建过程被破坏了很长时间,以至于它生成的PDB文件与相应的图像文件相比,存在几小时的时间差异.此后,我已经解决了这个问题.

Our nightly build process was broken for a long time, such that it generated PDB files that were a few hours different in age than the corresponding image files. I have since fixed the problem.

但是,我想开始使用符号服务器,但是由于必须使用这些年龄不匹配的pdb文件而无法使用.我通过在windbg中使用.symopt + 0x40方法来解决此问题.这意味着我必须手动整理我的所有pdb文件,并且经过多年的发布,这加起来了.

However, I would like to start using a symbol server, but cannot due to having to use these age-mismatched pdb files. I work around this issue by using the .symopt +0x40 method in windbg. That means I have to organize all my pdb files by hand, and after years upon years of releases, that adds up.

我正在寻找一种方法来修改windbg用于标记pdb年龄的机制,并强制其与我的图像文件匹配.实用程序 ChkMatch 具有类似的功能,但适用于pdb签名.开发人员在页面上指出:"ChkMatch能够使可执行文件和PDB文件具有相同的签名,但使用期限相同(请参阅本文以获取有关PDB签名和使用期限的更多信息).如果使用的年龄不同,则该工具将无法执行文件匹配."

I am looking for a way to modify the mechanism that windbg uses to mark a pdb's age, and force it to match my image file. The utility ChkMatch does something similar, but for pdb signatures. The developer states on the page "ChkMatch is capable of making an executable and PDB file match if they have different signatures but the same age (see this article for more information about PDB signature and age). If the age differs, the tool cannot make the files match."

我看了一个六边形编辑器,甚至发现了与年龄相对应的位,但是它必须在内部增加一些技巧,导致我无法使用它.

I took a look inside a hexeditor, and even found what looked like the bits corresponding to the age, but it must pull some more tricks internally, cause I couldn't get it to work.

有什么想法吗?

编辑: 我不知道这是否有帮助,但是在我的特定情况下,年龄差异是由不必要地重新链接dll引起的,该链接也会重新创建PDB文件.但是,我们的构建过程是存储原始dll(在重新链接之前),并在重新链接之后存储pdb.我想到了以某种方式手工重建这种情况.意思是,强制在DLL上进行重新链接,但在两种情况下都保存了pdb.然后,我可以对两个文件进行二进制比较,以了解它们的变化.也许运行某种可以自动执行此操作的修补软件?通过查看控制案例中发生的确切变化,也许我可以对公司构建过程中保存的DLL和PDB进行相同的处理?

EDIT: I don't know if this helps, but in my particular case the age difference was caused by unnecessarily relinking dll's, which would recreate the PDB files as well. However, our build process was storing the original dlls (before the relink), and the pdb after the relink. I thought about somehow recreating such a situation by hand. Meaning, forcing a relink on a DLL, but saving off the pdb in both cases. Then I could do a binary compare of the two files to see how they changed. Perhaps run some sort of patching software that does this automatically? By seeing what exactly changed in my control case, perhaps I could do the same to the DLLs and PDBs saved in my companies build process?

编辑: 我想到了!!!!感谢对第一个答案的评论之一,我签出了指向未公开的Windows 2000秘密:程序员食谱"一书的pdf的链接.作者还详细介绍了pdb文件格式.如前所述,我已经将pdb加载到了十六进制编辑器中,并在出现年龄/签名匹配的情况下进行了一些翻转,但这是行不通的.好了,在使用W2k秘密书中的实用程序将pdb分解"到包含的流中之后,我发现它们隐藏了流3中另一个关于年龄的引用!!!!一旦我也翻转了那个,它在windbg中就匹配了.这是巨大的!非常感谢....符号服务器,我来了!

EDIT: I FIGURED IT OUT!!!! Thanks to one of the comments on the first answer, I checked out a link to the pdfs of the book "Undocumented Windows 2000 Secrets: A Programmers Cookbook". And the author goes into great detail about the pdb file format. As I said before, I had already loaded the pdb into a hex editor and flipped some bits around appearing that I made the age/signature match, but it didn't work. Well, after using the utility from the W2k secrets book to "explode" the pdb into the included streams, I found out that they hide another reference to the age in stream 3!!!!!!! Once I flipped that one as well, it matched up in windbg. THIS IS HUGE!!!! Thank you so much....symbol server HERE I COME!

推荐答案

windbg不会修改pdb的使用期限-只会查找它以匹配可执行文件的使用期限-编译器在(重新)生成可执行文件和调试文件时会这样做.

现在,根据debuginfo.com的文章,到达正确的调试目录(codeview类型),将其与PDB7签名进行匹配并在可执行文件中对age或GUID进行修改并不是很困难.为什么那不是一个选择?

我想,您想更新pdb吗?恐怕pdb是专有格式.有多个只读API(dbghelp.dll和dia sdk),但是就修改而言,您需要猜测细节才能修改.

the windbg will not modify pdb's age - it only looks it up to match that of executable - the compiler does when it (re)generates executable and debug files.

now, based on the debuginfo.com article, it is not too difficult to arrive at the proper debug directory (of type codeview), match it against PDB7 signature and make modifications to either age or GUID inside an executable. why is that not an option?

i guess, you want to update pdb instead? i'm afraid, pdb is a proprietary format. there're multiple read-only APIs (dbghelp.dll and dia sdk), but as far as modifications go, you need to guess the details to be able to modify.

这篇关于如何更改年龄不匹配的PDB以正确匹配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆