Source Indexing SVN Repositories is Broken

Some of us spend a fair amount of time pouring through crash dumps generated on Windows. For us, the symbol server support provided by Microsoft’s debugging engines is a godsend. However, source indexing is an even bigger boon because it allows us to not only see the symbols within the crash, but be able to pull the exact source down for source-level debugging.

Unfortunately, it seems that SVN 1.7 broke this functionality! Since it is so critical to my daily workflow, I set about fixing it.

The way source indexing works is that Microsoft collected a bunch of perl scripts to process the text from various version control systems, and then provided a common interface for them to push this information to an alternate stream within the PDB file. The debugger then pulls this information from the alternate stream and can use it to fetch the exact file.

For SVN, the perl script executes svn info -R on the source base to find the file path and revision information, and this is matched up against the output from srctool.exe -r for the PDBs found. For example:

F:\Aaron Ballman\My Documents\Visual Studio 2010\Projects\Twilight>srctool Win\Release\Twilight.pdb -r

f:\aaron ballman\my documents\visual studio 2010\projects\twilight\win\sources\download.h
f:\aaron ballman\my documents\visual studio 2010\projects\twilight\twilight.h
f:\aaron ballman\my documents\visual studio 2010\projects\twilight\win\sources\appcast.cpp
c:\program files (x86)\microsoft sdks\windows\v7.0a\include\reason.h
c:\program files (x86)\microsoft visual studio 10.0\vc\include\xxshared
c:\program files (x86)\microsoft sdks\windows\v7.0a\include\windef.h

Win\Release\Twilight.pdb: 456 source files are indexed

F:\Aaron Ballman\My Documents\Visual Studio 2010\Projects\Twilight>svn info -R

Path: C:\svn\Twilight\Win\signtool.exe
Name: signtool.exe
URL: http://theriver:81/svn/TwilightAutoUpdater/trunk/Win/signtool.exe
Repository Root: http://theriver:81/svn/TwilightAutoUpdater
Repository UUID: e71ecc14-d901-6b44-84a7-01eeaeca339f
Revision: 62
Node Kind: file
Schedule: normal
Last Changed Author: mis\aballman
Last Changed Rev: 42
Last Changed Date: 2011-10-17 12:14:15 -0400 (Mon, 17 Oct 2011)
Text Last Updated: 2012-05-07 17:06:47 -0400 (Mon, 07 May 2012)
Checksum: f944d3c2c989da14d87517d1ff647dd3

So srctool.exe has a list of paths, and svn info has a list of paths — those paths matching are the key to hooking these two systems up.

Unfortunately, SVN 1.6 had a different info format than SVN 1.7 Now the format looks like:

Path: Win\signtool.exe
Name: signtool.exe
Working Copy Root Path: F:\Aaron Ballman\My Documents\Visual Studio 2010\Projects\Twilight
URL: http://theriver:81/svn/TwilightAutoUpdater/trunk/Win/signtool.exe
Repository Root: http://theriver:81/svn/TwilightAutoUpdater
Repository UUID: e71ecc14-d901-6b44-84a7-01eeaeca339f
Revision: 62
Node Kind: file
Schedule: normal
Last Changed Author: mis\aballman
Last Changed Rev: 42
Last Changed Date: 2011-10-17 11:14:15 -0500 (Mon, 17 Oct 2011)
Text Last Updated: 2010-03-19 14:02:22 -0500 (Fri, 19 Mar 2010)
Checksum: 96e8c80db8035c6badea2be97796b00c736afd15

The important piece to notice is that Path no longer returns an absolute path, but instead returns a path relative to Working Copy Root Path (which didn’t previously exist). This is what causes source indexing to break for SVN.

I’m no Perl expert, but I did manage to create a version of the svn source indexing module that handles both the 1.6 and 1.7 formats for svn info. Basically, I’m assuming that Path is correct right up until I find a Working Copy Root Path, at which point I assume Path is a relative path and fix it up. This seems to fix the cases I’ve run into, but I have not run it on a huge sample of code bases. You can find the fixed file here. This file should replace svn.pm in the srcsrv directory of your WinDbg installation folder.

Hopefully this fixes any source indexing problems you’ve run into with SVN 1.7! I’ve filed a report with Microsoft, so if this issue affects you, please up-vote it on Connect.

This entry was posted in Win32 and tagged , , . Bookmark the permalink.

One Response to Source Indexing SVN Repositories is Broken

  1. ellusak says:

    when source root is a drive, like D:\, that is Working copy root is D:\, in this case,
    you should not add a backslash between WCR and local_path

Leave a Reply

Your email address will not be published. Required fields are marked *