2

Problem:

A developer would like to create new Program Database Files (PDB) every time a build has started.

For what scenario:

C++ hot-swapping, debugging on the fly, DLL code plugins for the main program to execute code.

4

1 回答 1

5

Solution:

  1. Open your code project.
  2. Open Project Properties.
  3. In the left pane, expand the Configuration Properties node.
  4. Expand the Linker node.
  5. Click on the Debugging node.
  6. In the right pane, find the Generate Program Database File entry.
  7. Replace the value as the following:

    $(OutDir)$(TargetName)-$([System.DateTime]::Now.ToString("HH_mm_ss_fff")).pdb

  8. Click on Apply and then Ok.

To start C++ hotswapping (Debugging on the fly) mode:

  1. Have two projects added to a new solution in Visual Studio 2013.
  2. Make one of the projects generate a DLL when building.
  3. Create your program.
  4. For the DLL, write a function that gets constantly called upon while the program is running. Export the function to a DLL.
  5. Set the DLL project to generate new PDB files for each build.
  6. Compile and building all projects.
  7. Start your program without debugging (CTRL+F5).
  8. Update exported DLL function.
  9. Build DLL project once. (CTRL+SHIFT+B).
  10. Your program should then immediately update execution of the function after the second build.

Demonstration of C++ hotswapping. HTML5 version of the GIF here.

Note:

  • You may add the following value to the Project Properties in order to get rid of excessive PDB files. This can be added to the Pre-Build Event entry in the Build Events node.

    del "$(OutDir)*.pdb"

于 2015-01-18T23:56:20.247 回答