Remove PDB references from released file

妖精的绣舞 提交于 2019-11-27 08:54:21

Read the PDB Files documentation on MSDN:

A program database (PDB) file holds debugging and project state information that allows incremental linking of a Debug configuration of your program. A PDB file is created when you compile a C/C++ program with /ZI or /Zi or a Visual Basic/C#/JScript .NET program with /debug.

In Visual C++, the /Fd option names the PDB file created by the compiler. When you create a project in Visual Studio using wizards, the /Fd option is set to create a PDB named project.PDB.

Note that the absolute path is mentioned in the documentation:

The Visual Studio debugger uses the project.PDB file created by the linker directly and embeds the absolute path to the PDB in the EXE or DLL file.

You can always go to Project Properties > Linker > Debugging > Generate Debug Info and set it to No.

mox

You can use /pdbpath:none to remove the full qualified path name of the PDB file, but keep the name and extension of the PDB only. Keeping the name (and extension) of the PDB for released images is your only way to debug an image that is buggy. Windows images almost always keep the name and extension of the PDBs!

If you don't mind using an external tool and you cannot rebuild your module with /pdbpath:none, the peupdate tool can be used to list, remove or change the PDB string in an executable module:

http://bytepointer.com/tools/index.htm#peupdate

You might use the tool as follows to clear the PDB path:

peupdate -c <module_path>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!