开发者

Strip the path to the pdb

开发者 https://www.devze.com 2023-04-09 01:47 出处:网络
Per default, when compiling a Visual Studio project in release mode, the complete path to the pdb is put into the image file, e.g.:

Per default, when compiling a Visual Studio project in release mode, the complete path to the pdb is put into the image file, e.g.:

c:\myprojects\demo\release\test.pdb

Using an undocumented linker switch (/pdbpath:none) one can force Visual Studio 2008 to reduce the full qualified name of the pdb, e.g:

test.pdb

I need to do the same with a project which is still built using VC6.

I tried the "/pdbpath:none" switch at the project settings level, but the linker complains about this unknown switch.

Does anyone knows a method (or a tool) to acc开发者_开发知识库omplish this either when linking a VC6 project or afterwards directly at the image level?


Your best bet is to use pdbstr.exe from MS directly. It allows for direct extraction, update, and misc other functions directly, independent of compiler version (up to the last supported version, which I think is VS2013 right now). We use it to add SVN linkings directly to PDBs which we then store in local symbol stores using srctool.


For newer link.exe versions, the syntax changed.

The option you want is now /pdbaltpath:%_PDB%

It is documented on MSDN: https://msdn.microsoft.com/en-us/library/dd998269.aspx

%_PDB% expands to the file name of the actual .pdb file without any path information

For VC6, you might want to continue using the same compilers but a new version of link.exe.

The Windows Driver Kits also come with a tool named binplace.exe which can modify this information post-build.

0

精彩评论

暂无评论...
验证码 换一张
取 消