Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change the locations of source files in a symbols file (pdb)

Tags:

Basically what I want to do it this: a pdb file contains a location of source files (e.g. C:\dev\proj1\helloworld.cs). Is it possible to modify that pdb file so that it contains a different location (e.g. \more\differenter\location\proj1\helloworld.cs)?

like image 669
Sir Rippov the Maple Avatar asked Aug 26 '08 12:08

Sir Rippov the Maple


People also ask

Where are pdb files located?

pdb file stores all debug information for the project's .exe file, and resides in the \debug subdirectory.

What is PDB path?

PDB Path in CodeView Debug Information In both cases, the name of the PDB file with the . pdb extension is included to ensure the debugger locates the correct PDB for the program. A partially qualified PDB path would list only the PDB file name, such as: Test.pdb.

Does PDB file contains source code?

pdb files contain the following information: The names of all local variables. The names of all source code files and the mapping from IL instructions onto lines within those files.

How do I load a PDB symbol?

Open Settings: Tools->Options -> Debugging -> Symbols and add directory, where your . PDB files are located. You can add custom path, like for each project, and also you can edit common path, where Visual Studio will save all .


2 Answers

You can use the source indexing feature of the Debugging Tools for Windows, which will save references to the appropriate revisions of the files in your source repository as an alternate stream in the PDB file.

like image 146
On Freund Avatar answered Apr 24 '23 20:04

On Freund


If you're looking to be more generic about the paths embedded in a pdb file, you could first use the MS-DOS subst command to map a particular folder to a drive letter.

subst N: <MyRealPath> 

Then open your project relative to the N: drive and rebuild it. Your PDB files will reference the source files on N:. Now it doesn't matter where you place that particular set of source files, so long as you subsequently call the root directory "N:" like you did when you built it.

This practice is recommended by John Robbins in his excellent book, Debugging Applications for Microsoft .NET and Microsoft Windows.

like image 45
Matt Dillard Avatar answered Apr 24 '23 19:04

Matt Dillard