Visual Studio: Debugging Chrome with Source?
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 se开发者_运维问答e 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?
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/
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 :))
精彩评论