3

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.

tom_mai78101
  • 2,383
  • 2
  • 32
  • 59

1 Answers1

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"

tom_mai78101
  • 2,383
  • 2
  • 32
  • 59
  • Does this apply to VS2010? For example, at my shop they have bought VS2010 and will only upgrade to VS2013 if there is sufficient justification (due to running certificaiton tests and paying for licenses). – Thomas Matthews Jan 19 '15 at 00:44
  • I believed yes. There's no specific code standardization changes needed. It's all done within the Project Properties, and you just need to export constantly updated functions to a DLL, and make your program load that DLL. The only thing I'm worried about is the macros used in the Project Properties. The macros are never officially documented in the MSDN documentation. – tom_mai78101 Jan 19 '15 at 02:22
  • @PrashantPimpale This setup should work even up to VS 2019, since it's just Visual Studio specific configurations, and not really the programming language stuffs. – tom_mai78101 Sep 19 '19 at 12:29