PDA

View Full Version : Can’t debug qtest unit tests (but can build and run them without issue)



bob_smith
11th December 2010, 02:40
I’m having a problem trying to debug qtestlib tests. I can build and run the tests just fine and they output appropriate results. However I can’t actually seem to step through the tests to debug them. Despite not being able to find any posts on the issue in this forum or any others hopefully someone has run into such a thing before or at least has an idea of what may be wrong.

If I try and debug (step into) the tests I get a message saying “Debugging information for ‘my_project_tests.exe’ cannot be found or does not match. Cannot find or open the PDB file.” And it asks me if I want to continue debugging. If I click yes then take a look at the modules window I see that, sure enough, the line my_project_tests.exe has a symbol status of “Cannot find or open the PDB file.” The only other modules that have anything other than symbols_loaded are the following:

wxvault.dll has the message “Binary was not built with debug information”
detoured.dll has the message “Cannot find or open the PDB file”
sophos_detoured.dll (the antivirus we use) has the message “Cannot find or open the PDB file”

If I then right-click on my_project_tests.exe and say load symbols from symbols path and select my_project_tests.pdb (and I’m sure it is the pdb that was built with the project, did a clean build to verify) Visual Studio gives me an error dialog saying “A matching symbol file was not found in this folder.” and it clears the entry.

In terms of project settings I believe this project was created in VS by saying new project->Qt4 Projects->Qt Console Application then selecting GUI and Test library as additional modules.

Here’s a list of possible applicable project settings:
Qt is version 4.7.0 and I’m using VS2010 with the Qt plugin.
Debug information format is Program Database (/Zi)
Optimization is disabled
Runtime library is set to Multi-threaded Debug
Additional Dependencies include:
qtmaind.lib
QtCored4.lib
QtGuid4.lib
QtTestd4.lib
my_project.lib
Generate Debug Info in Yes

If there are any other settings or other information that would be helpful please let me know.

Thanks for your help. I’ve run into missing symbols before of course but this one is proving more difficult than normal…

bob_smith
13th December 2010, 19:03
If no one has any ideas what may be wrong can someone at least verify that they are able to debug Qt unit tests using Qt 4.7 and Visual Studio 2010 so I can verify that it’s just my problem?

bapi23
11th November 2012, 19:24
I also can't debug unit tests under Linux Ubuntu x64. I use QtCreator and the simpliest default unit tests project. I can run tests only from console (not from Qt Creator) under Qt creator I receive empty console without any information and therefor I cant debug its seems like app don't start. Can anyone test this issue under linux? Thanks in advice.

edit:
I must add that debug works fine for me this appear only under unit testing

ChrisW67
11th November 2012, 22:17
In Qt Creator make sure you are using a suitable console program (Tools menu, Options, Environment, General tab). For example, the default "xterm -e" works fine for me but "konsole -e" does not. Alternatively turn off the "Run in Console" option on the test run configuration and the output will appear in the Output Pane.