Visual Studio:使用源代码调试 Chrome?
我已成功在 Visual Studio 中设置 Google Chrome(开发通道)的下载符号。这对于理解反汇编很有帮助,但是当我进入函数时,我想查看C++源代码。 (它打开一个对话框,让我找到源文件,当然我没有。)
是否有服务器可以让 Visual Studio 自动查找 C++ 源文件的匹配版本?
I've managed to set up the download symbols for Google Chrome (Dev channel) in Visual Studio. This is helpful for understanding the disassembly, but when I step into a function, I want to see the C++ source code. (It opens up a dialog, letting me find the source file, which I of course don't have.)
Is there a server from which I can have Visual Studio automatically find the matching version of the C++ source file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用符号服务器(如 http://www.chromium.org/developers/how 中所述-tos/debugging) 足以获取 PDB,但其本身并不能获取源代码。要获取源代码需要启用源索引。
构建期间的源索引通过向 PDB 文件添加额外的数据(因此获取 PDB 文件是正确的第一步)来工作,告诉调试器如何从版本控制中检索源文件。不过,此功能在 Windbg 和 Visual Studio 中默认处于关闭状态。也就是说,默认情况下,windbg 和 Visual Studio 会忽略 Chrome 添加的源索引信息。
在 Visual Studio(自 2002 年以来的所有版本)中,您可以通过转到“工具”->“工具”来启用它。选项->调试->一般->启用源服务器支持。您可能还需要选中“将源服务器诊断消息打印到输出窗口”,以防它最初不起作用。
在windbg中,您可以在命令窗口中输入“.srcfix”,或者转到File->;源文件路径并在源路径对话框中键入 SRV*。如果您需要诊断,请在命令窗口中输入“!sym Noise”。
请注意,自 2014 年 12 月起,建议您使用 https 而不是 http 来检索 Chrome 符号,以提高安全性,因此请使用 https://chromium-browser-symsrv.commondatastorage.googleapis.com 作为符号服务器地址。
有关源索引的更多详细信息,请参阅我写的这篇博客文章:
https://randomascii.wordpress.com/2011/11/11/source-indexing-is-underused-awesomeness/
Using a symbol server (as described in http://www.chromium.org/developers/how-tos/debugging) is enough to get you the PDBs, but will not by itself get you source. To get the source code requires enabling source indexing.
Source indexing during builds works by adding extra data to the PDB file (so getting the PDB files was the correct first step) that tells the debuggers how to retrieve source files from version control. However this feature is off by default in both windbg and Visual Studio. That is, by default windbg and Visual Studio ignore the source indexing information which Chrome adds.
In Visual Studio (all versions since about 2002) you can enable it by going to Tools-> Options-> Debugging-> General-> Enable source server support. You may also want to check "Print source server diagnostic messages to the Output window" in case it doesn't work initially.
In windbg you can type ".srcfix" into the command window, or go to File-> Source File Path and type SRV* into the source path dialog. If you want diagnostics then type "!sym noisy" into the command window.
Note that as of December 2014 it is recommended that you use https rather than http for retrieving Chrome symbols, to improve security, so use https://chromium-browser-symsrv.commondatastorage.googleapis.com as the symbol server address.
For more details on source indexing see this blog post which I wrote:
https://randomascii.wordpress.com/2011/11/11/source-indexing-is-underused-awesomeness/
根据这篇文章,您可以配置 VS 或 Windbg 从 http://msdl.microsoft.com/download/symbols 和 https://chromium-browser-symsrv.commondatastorage.googleapis.com
其他解决方法是在你这边编译整个源代码...(但你已经知道了:))
As per this article, you can configure VS or windbg to download symbols from http://msdl.microsoft.com/download/symbols and https://chromium-browser-symsrv.commondatastorage.googleapis.com
Other workaround of that is to compile the entire source on your side... (but you already know that :))