Debugging Symbols

We all like to use the PDB files when they are available. Sometimes we have to get those from the Internet from MS. Usually I download the whole package of symbols for my current OS and get done with it. The problem is that sometimes after updates and the like, they are out of date and then the files I got are not relevant anymore. And as I use WinDbg I decided to set the symbols path variable in the system environment, to have it supported for other apps as well. Though I really ask myself how come I haven’t done it before. Because at my work, I already use it for a long time now…

Anyhow, I set that variable to: SRV*http://msdl.microsoft.com/download/symbols;C:\symbols;

And I was happy then that everything loads automatically. Afterwards I noticed that everytime I start debugging code in MSVS it accessed the inet for something, blocked the whole application for a few seconds and then resumed with starting my application and let me debug it. The point was that it was my own application with full source and everything and it still accessed the inet everytime, maybe for checking timestamps with loaded modules, etc. It even caused some problems like saying that my source isn’t the same like the binary I want to debug and it hasn’t let me use the source when debugging that code. So after a few times with this same confusion, I couldn’t continue work like that anymore and I tried to think what I changed that caused this weird debugging behaviors and only then it got to my mind that I added that extra variable in the environment. So I took a look at the variable and by a hint from a friend, I switched the places of the local symbols directory with the http address. And since then I don’t have any weird seeks to the inet to get/check PDBs when not required and everything run fast as normal as before.

That’s it, just wanted to share this issue. Of course, I don’t blame any application for using the first address in the variable first, because it’s up to the user how to define the priorities. It is just that I didn’t think it would matter… To learn I was wrong.

2 Responses to “Debugging Symbols”

  1. Yoni says:

    After reading your post, I checked to see how the variable is set in my environment…

    _NT_SYMBOL_PATH=srv*C:\Misc\Symbols*http://msdl.microsoft.com/download/symbols

    Yep, I have local directory configured before remote.

    However, it *STILL* sucks, because of various system-wide hooks.
    Whenever I start an application with a GUI, some Logitech (mouse-related) DLL will want to load itself to my process, because it hooks window creation. (And that’s not the only such DLL…)
    The VS debugger will catch the DLL load event, and search for the matching PDB, which is of course found neither in the local directory nor on the Microsoft server, resulting in the annoying wait.

  2. arkon says:

    Hmm, that’s intresting, maybe there is a way to tell the debugger to ignore those… I will ask around.

Leave a Reply