剥离到 pdb 的路径 [英] Strip the path to the pdb
问题描述
默认情况下,在发布模式下编译 Visual Studio 项目时,会将 pdb 的完整路径放入映像文件中,例如:
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
使用未公开的链接器开关 (/pdbpath:none
) 可以强制 Visual Studio 2008 减少 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
我需要对仍使用 VC6 构建的项目执行相同操作.
I need to do the same with a project which is still built using VC6.
我在项目设置级别尝试了/pdbpath:none
"开关,但链接器抱怨这个未知开关.
I tried the "/pdbpath:none
" switch at the project settings level, but the linker complains about this unknown switch.
有没有人知道在链接 VC6 项目时或之后直接在图像级别完成此操作的方法(或工具)?
Does anyone knows a method (or a tool) to accomplish this either when linking a VC6 project or afterwards directly at the image level?
推荐答案
对于较新的 link.exe
版本,语法已更改.
For newer link.exe
versions, the syntax changed.
您想要的选项现在是 /pdbaltpath:%_PDB%
它在 MSDN 上有记录:https://msdn.microsoft.com/en-us/library/dd998269.aspx
It is documented on MSDN: https://msdn.microsoft.com/en-us/library/dd998269.aspx
%_PDB%
扩展为不带任何路径信息的实际 .pdb 文件的文件名
%_PDB%
expands to the file name of the actual .pdb file without any path information
对于 VC6,您可能希望继续使用相同的编译器,但使用新版本的 link.exe
.
For VC6, you might want to continue using the same compilers but a new version of link.exe
.
Windows 驱动程序工具包还附带一个名为 binplace.exe
的工具,可以在构建后修改此信息.
The Windows Driver Kits also come with a tool named binplace.exe
which can modify this information post-build.
这篇关于剥离到 pdb 的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!