Debugging x64 module tests in Visual Studio

I am having difficulty debugging C ++ x64 unit tests in Visual Studio 2012/13.

My unit test project works great for both Win32 and x64, but when debugging the test, characters are loaded, but the set of breakpoints is skipped completely, and the program never stops, like what happens if you just run the test.

If I create a unit test project for Win32, breakpoints hit and I can debug as usual.

Are there any special settings for debugging unit tests in x64? The properties were copied from the standard Win32 parameters for the project, and all Win32-dependent parameters were deleted. Is this the right idea to set up a unit test project?

+6
source share
1 answer

You must set the default processor architecture for the default tester on x64. You can find it in Test | Test Settings | Default processor architecture | x64.

You can also create a test settings file with this parameter in it.

  • Add the XML file to the Visual Studio solution and rename it so that its file extension is .runsettings.
  • Replace the contents of the file with an example.
  • Edit it to suit your needs.
  • In the Test menu, select Test Parameters, Select Test Test File.

Taken from Configuring Unit Tests with the .runsettings File

You want to change the TargetPlatform flag as follows.

 <?xml version="1.0" encoding="utf-8"?> <RunSettings> <RunConfiguration> <ResultsDirectory>.\TestResults</ResultsDirectory> <TargetPlatform>x86</TargetPlatform> <TargetFrameworkVersion>Framework40</TargetFrameworkVersion> </RunConfiguration> <!-- more stuff --> </RunSettings> 
0
source

Source: https://habr.com/ru/post/953482/


All Articles