Labels

Monday, September 24, 2007

Debug vs Release Mode

PDB Files.

Note:

§ To build ‘Class Library’ type of projects in ‘Release’ mode, you require is to set it to ‘Release’ mode either using toolbar or menu [Build -> Configuration Manager dialog]

§ To build ‘Web Service/Website’ type of projects in ‘Release’ mode, set the ‘debug=false’ attribute in ‘compilation’ tag of Web.config.

§ PDB files are used to store debugging and project state information and they are created when you compile the application.

§ They are required for debugging.

§ A PDB file is created when you compile a Visual Basic/C#/JScript .NET program with /debug.

o The /DEBUG option creates debugging information for the .exe file or DLL.

o The linker puts the debugging information into a program database (PDB). It updates the PDB during subsequent builds of the program.

o An .exe file or DLL created for debugging contains the name and path of the corresponding PDB.

o The debugger reads the embedded name and uses the PDB when you debug the program.

o The linker uses the base name of the program and the extension .pdb to name the program database, and embeds the path where it was created.

§ The major Difference Between Debug And Release is that Optimization Is Turned On And Debug Symbols Are Not Emitted. Most of this optimization is done by the JITR and not the language compiler.

§ Having the solution in Debug mode makes the app run slower, use more memory, etc. It is only necessary for debugging/tweaking. You should only change it to release when you want to use the files in production/live.

§ Release compilations execute faster than Debug.

o The Debug configuration of your program is compiled with Full Symbolic Debug Information in Microsoft format and no optimization (optimization complicates debugging, since the relationship between source code and generated instructions is more complex).

o The Release configuration of your program is fully optimized and contains no symbolic debug information. Debug information may be generated in separate PDB files.

§ Performance is generally better if you compile in release mode, but you will notice a drastic change when errors DO occur because the debug symbols are not created. Therefore, debugging can become significantly more difficult.

§ M. Imp - In Release mode, we cannot attach debugger to the aspnet_wp process. i.e Breakpoints will not work and will behave as below figure.













Thanks & Regards,

Arun Manglick || Tech Lead |

1 comment:

  1. Use of 'PDB' file -

    Its been mentioned that - Building in Debug mode makes the linker to puts the debugging information into a Program Database (PDB).

    Now, when you debug a application, the debugger first maps the native code to MSIL, and then maps the MSIL code to source code by using the above generated Program Database (PDB) file.

    ReplyDelete