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

[{'answer_id': 28174, 'author': 'Matt Dillard', 'author_id': 863, 'author_profile': 'https://Stackoverflow.com/users/863', 'pm_score': 3, 'selected': False, 'text': '<p>If you\'re looking to be more generic about the paths embedded in a pdb file, you could first use the MS-DOS <code>subst</code> command to map a particular folder to a drive letter.</p>\n\n<pre><code>subst N: &lt;MyRealPath&gt;\n</code></pre>\n\n<p>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.</p>\n\n<p>This practice is recommended by John Robbins in his excellent book, <a href="https://rads.stackoverflow.com/amzn/click/com/0735615365" rel="noreferrer" rel="nofollow noreferrer">Debugging Applications for Microsoft .NET and Microsoft Windows</a>.</p>\n'}, {'answer_id': 28230, 'author': 'On Freund', 'author_id': 2150, 'author_profile': 'https://Stackoverflow.com/users/2150', 'pm_score': 5, 'selected': True, 'text': '<p>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.</p>\n'}, {'answer_id': 174051, 'author': 'deemok', 'author_id': 23713, 'author_profile': 'https://Stackoverflow.com/users/23713', 'pm_score': 1, 'selected': False, 'text': "<p>It is certainly possible, as On Freund has already pointed out.\nBut if it is only so that the sources can be located and loaded during debugging, then a better way would be to set the source path correspondingly. Once set in a debugger, it will preemt all hard coded paths inside PDBs.</p>\n\n<p>\nIn windbg (for instance):\n<blockquote>\n.srcpath+ path_to_source_root\n</blockquote>\nor this (in case you're debugging remotely):\n<blockquote>\n.lsrcpath+ path_to_source_root\n</blockquote>\n</p>\n"}, {'answer_id': 4957501, 'author': 'Dave', 'author_id': 611404, 'author_profile': 'https://Stackoverflow.com/users/611404', 'pm_score': 2, 'selected': False, 'text': '<p>I wanted to find the answer to this in order to debug a crash dump that occurred in an executable that I did not build on my machine, therefore the path to the source code referenced in the PDB was invalid, as was the path to the PDB referenced in the executable.</p>\n\n<p>After searching around and failing to find something that works, I discovered that if you place the executable and PDB alongside the crash dump file (i.e. in the same directory) then open and run the crash dump in VS, VS will find and use the PDB/EXE locally.  Furthermore, it will also prompt for the location of the source code when clicking on an entry in the call stack: pointing it at whichever source code is relevant, it all works fine, which is great!</p>\n\n<p>Anyway, hopefully this helps someone else...:)</p>\n'}]
['https://Stackoverflow.com/questions/27952', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2822/']