2

The MSDN says, when use /Z7:

Produces an .obj file containing full symbolic debugging information for use with the debugger. The symbolic debugging information includes the names and types of variables, as well as functions and line numbers. No .pdb file is produced.

Because obj files will be link into exe file finally. So I think the debug info will write into the final building file (exe file).

In this, MSDN says:

It is not possible to create an .exe or .dll that contains debug information. Debug information is always placed in a .pdb file.

After I test it, I found:

  1. whatever /Z7 or /Zi was set, PDB file always get generated.

  2. build with /Z7, and generate a core dump file, use vs open this core dump file, it still need a PDB file to debug.

It seems first msdn doc I refer is outdated.

Can I debugging windows core dump file like linux app which only need a single core dump file? without any additional files like a PDB? Or this is an mission impossible.

jean
  • 2,825
  • 2
  • 35
  • 72
  • I don't think they are same question. I asked total different question – jean Dec 17 '15 at 12:03
  • Most useful answer buried in the comments in linked question. For visibility, modern MSDN states: _It is not possible to create an .exe or .dll that contains debug information. Debug information is always placed in a .pdb file._ – dewaffled Dec 17 '15 at 12:06
  • I read that comment. But in other msdn doc, it says: No .pdb file is produced. This is inconsistent. So I am asking why – jean Dec 17 '15 at 12:24
  • In c++ compilation and linking are separate processes. Have a look at the directory with object files - with Zi option you will see pdb file generated there and with Z7 no pdb and larger object files size. Modern linker though does not support embedding debug information and lways creates pdb – dewaffled Dec 17 '15 at 12:29
  • I think you need to clearly specify for which Visual Studio versions you are seeking for an answer. – RedX Dec 17 '15 at 12:37
  • @frymode This is make sense. I found there are 2 pdb files. One is in folder with obj(temp), other is in folder with exe(final). For the first pdb, if use /Z7, it will not generated, and obj size will gets bigger. For the second pdb, whatever the setting is, always generated. The 2 MSDN doc should mention those 2 kinds pdb respectively – jean Dec 18 '15 at 01:47
  • @jean First article you reference is `Compiler Options` the other - `Linker Options`. So they are correct by themself if we consider compiler and linker separate tools ) They could mention linker option in compiler's though. – dewaffled Dec 18 '15 at 07:26

0 Answers0