简体   繁体   English

如何在Visual Studio中调试“发布”转储?

[英]How to debug a 'release' dump in Visual Studio?

I'm trying to debug a dump file in Visual Studio of a 'release' deployment of an w3wp process. 我正在尝试在w3wp进程的“发布”部署的Visual Studio中调试转储文件。

When I try to step into the code, it says that 'PDB does not match image.', even though it worked in the past (I rebuilt the exact commit on my machine and pointed to those generated PDBs). 当我尝试进入代码时,它说“ PDB与映像不匹配。”,即使它在过去有效(我在机器上重建了确切的提交,并指向了那些生成的PDB)。

Any clue how I can debug this dump / ensure that I can debug future dumps? 有什么线索可以调试此转储/确保可以调试将来的转储吗?

Thanks 谢谢

You can't generally use pdbs generated for a different build, even if the source code is identical -- debugger places a guid and age (a counter) that get changed every build. 即使源代码相同,通常也不能使用为不同版本生成的pdbs-调试器放置一个GUID和age(计数器),每个版本都会更改。 Those 2 values must match before debugger even tries to use the pdb. 在调试器尝试使用pdb之前,这两个值必须匹配。

Having said that, you could try forcing that with chkmatch . 话虽如此,您可以尝试使用chkmatch强制执行该操作 If you are lucky your new build will have sufficiently similar layout to released one. 如果幸运的话,您的新版本将具有与已发布版本足够相似的布局。 To up your chances make sure you build environment is as similar as possible -- including source code location (length of the absolute path to source files might affect internal layout in the binary). 为了确保您的构建环境尽可能相近,包括源代码位置(源文件的绝对路径的长度可能会影响二进制文件的内部布局)。

If you didn't have debug information in original build at all that won't work. 如果您没有原始版本中的调试信息,那将是行不通的。

To make sure you don't have those problems in the future, always build release with debug information and then save those pdbs for released builds. 为了确保将来不会出现这些问题,请始终使用调试信息来构建发行版,然后将这些pdbs保存为已发行的构建。

EDIT: 编辑:

For C# projects, pdbs are controlled in Project Properties -> Build -> Advanced Build Settings -> Debug Info. 对于C#项目,在项目属性->构建->高级构建设置->调试信息中控制pdb。 Set it to "pdb-only" on release builds and "full" on debug (should be default). 在发行版中将其设置为“仅pdb”,在调试时将其设置为“完整”(应为默认)。 Pdb-only will not impact performance of release builds. 仅Pdb不会影响发行版本的性能。

If you control deployment environment, pdbs can be deployed right with release binaries -- might improve dumps (not sure). 如果您控制部署环境,则可以使用发行版二进制文件正确部署pdb-可能会改善转储(不确定)。

If you give the binaries to an end user, generally it is better to keep pdbs to yourself, if you want to limit reverse engineering. 如果将二进制文件提供给最终用户,通常最好将pdbs保留给自己,如果您想限制逆向工程。

If any case keep them for as long as you care about that particular version of your binary. 如果有任何情况,请保留它们,直到您关心二进制文件的特定版本为止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio - 调试与发布 - Visual Studio - Debug vs Release 如何在 Visual Studio 中以编程方式在调试和发布之间进行更改 - how to change Between Debug and Release programatically in visual studio Visual Studio 2015调试和发布无法正常工作 - Visual Studio 2015 Debug and Release not working Visual Studio C#调试与发布和编译debug =“ false” - Visual Studio C# Debug vs Release and Compilation debug=“false” 如何在 Visual Studio 构建前/构建后命令行中检测调试/发布? - How to detect debug/release in visual studio pre/post-build command line? 如何在 Visual Studio 2019 .net5.0 上允许发布和调试不安全代码 - How to allow unsafe code for Release and Debug on visual studio 2019 .net5.0 Microsoft Visual Studio:如何在不离开调试模式的情况下进行一键式发布构建? - Microsoft Visual Studio: how to make one-click release builds without leaving debug mode? 如何在发布模式下处于活动状态时以调试模式关闭Visual Studio中的DocFX? - How to switch off DocFX in visual studio in debug mode while active in release mode? 在Visual Studio扩展中,确定解决方案是在发行版中还是在调试中打开 - In a visual studio extension identifying if the solution is opened in release or debug visual studio 2010 - 使用“发布”web.config转换进行调试? - visual studio 2010 - debug using “release” web.config transform?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM