How to update the source location in symbol (.pdb) files

1.6k views Asked by At

What I am trying to do is run a batch script to update .pdb files to point to a different source location. I'm not sure if there is a way to update the absolute paths in the pdb file, but currently I'm looking into inserting a source stream into the pdb file so the debugger can get the source files.

I am inserting a source stream using pdbstr.exe:

pdbstr -w -i:c:\test\pdbstream.txt -p:"C:\test\somelibrary.pdb" -s:srcrv

The pdbstream.txt contents are pretty basic:

SRCSRV: ini ------------------------------------------------
VERSION=1
SRCSRV: variables ------------------------------------------
SRCSRVTRG=%var1%
SRCSRVCMD=cmd echo %var1% >> c:\test\output.txt
SRCSRV: source files ---------------------------------------
C:\somedifferentpath\somelibrary\sources\firstclass.cs
C:\somedifferentpath\somelibrary\sources\secondclass.cs
SRCSRV: end ------------------------------------------------

According to the info on MSDN I added only the required parameters. To my understanding, this should run the command in the SRCSRVCMD variable when the debugger loads the pdb file and searches for the source files. So I would expect some output in c:\test\output.txt.

I have verified that the correct pdb file is loaded for the module, but when i'm debugging in Visual Studio it does not find any source file. The output shows:

"SRCSRV: The module 'C:\test\somelibrary.dll' does not contain source server information."

Is the source stream not valid, or am I simply overlooking a particular step? Or can I change the absolute source location in the pdb file without inserting a datastream?

Edit

To clarify, I am currently using the Visual Studio debugger. The code I am trying to debug is in private libraries I created myself. I want the .pdb files to point to the correct source files after everything (dll, pdb & source files) is moved to a different location on disk.

0

There are 0 answers