QtCreator debug pause stop at code not assembly - qt

How can I configure QtCreator so that when I'm debugging and I press pause it would show the code it is currently processing (now it shows assembly). Couldn't find an answer anywhere about this.
I am using Windows 7.

I have this problem with Qt Creator 4.2.2 in Ubuntu 16.04. One of the steps can solve your problem:
Try to swith compile mode in the left corner to Debug mode
Try to switch off option Debug->Operate by instruction, when you debugging. But it doesn't work for me.
Try to switch option Tools->Debugger->Set breakpoint using full absolute path.
Try to add your Qt Src path in window Source Path Mapping (Tools->Debugger->Add Qt sources)
Use only ASCII symbols in your 'project' and 'build' directory paths.
After step 5, there was magic and gdb sucess work in src mode.

It might not have the sources for the code it is currently executing. It could be in a system DLL, for instance. If you look at the stack trace, you might find a function that it has the source for, but this is not guaranteed -- it could be in a thread for which no source is available at all.

Related

Cannot step into Qt source

I create a Qt project,build the project with msvc2017-32bit kit, and debug the project in Qt Creator. The problem is I can not step into the Qt functions. I can stop at break-points in my own source code, but cannot stop at break-points in files in Qt src directory. When I step into a Qt function, a message Stopped: "end-stepping-range" appears by the debugging buttons. Why could this happen?
According to #user13088490's suggestion, I installed the debugger tools for windows in windows 10 SDK, but the problem persists.
Follow the instructions from Qt here.
For Mac, the instructions are:
In Projects->Build&Run->Run->Run Settings->Run, select "Use debug version of frameworks".
There are different instructions for Windows, but I have not tried it yet.
You probably also need to have QT sources installed.
Go to the MaintenanceTool and check if Qt Creator 4.15.2 CDB Debugger Support and Debugging Tools for Windows has been selected.
I run Qt on Windows, although a different compiler than you, and you can set the debug target paths by going to Tools->Options->Debugger. From here you can click a button Add Qt sources.... Below is an image of my setup and this works for me.

Problems with QT 5 deployment

I've attempted to follow the instructions on deploying Qt to Windows, but I am stuck on step number 1. In it, it tells you to:
cd C:\path\to\Qt
configure -static any other options you need
Unfortunately, I can't get the Qt DOS prompt to recognize the "configure" command despite attempting to use it in virtually every folder under my Qt installation. Does anyone know where this command is store? Everything else about my project is working great with Visual Studio, but I just can't seem to figure out the deployment.
I've Googled the crap out of this and tried both the Qt and the regular Windows command prompts. Any help would be greatly appreciated!
Thanks
EDIT: For clarity, I have tried dragging all of the .dlls needed to run my program (by running it and finding the ones I get errors on), but all that happens is I stop getting errors when trying to run my app. If I double click it with the .dlls in the same folder, nothing happens at all.
Are you sure you need the static Qt build? Note that you must static build the actual Qt framework for that, and only after that you can build your application.
If yes, make sure you have the Qt source code, because configure is part of the source code of Qt, it's a tool that configure the Qt build.
The step refers to path of Qt Source directory e.g. C:\QtSDK\QtSources\\
As you can see in qt5 source tree there is a file configure.bat
You need to run that with static option, so it will configure Qt for static linking.
Then you need to re-build Qt to make your new configuration to take effect.

How to trace the source code in QT?

I want to trace the source code , but when I set a breakpoint, the program doesn't pause.
How can I do that and are there some settings I should set?
My environment is Qt SDK.
Since we've confirmed that your GDB is working properly, the problem is that in order to be able to debug Qt code, the Qt code needs to be compiled in debug mode.
Be warned though, it will take a lot of time to compile Qt in debug mode.
You should compile under Debug mode and hit start debugging instead of normal run. I use to have the same exact problem. Here, this might help: How to use debugger in Qt Creator

Qt debug won't stop on breakpoint

I just installed qt creator sdk and the windows debug thing. When I try to debug the debugger comes with the warning:
Preferred debugger engine for debugging binaries of type 'x86-windows-msys-pe-23bit' is not available.
The debugger engine Cdb engine will be used as a fallback
Details: There is no gdb binary available for binaries in format 'x86-windows-msys-pe-32bit'
Then the program start building.
When I set breakpoints into the program the debugger won't stop at de breakpoints. I've tried a lot of things to let the debugger work properly but nothing has helped so far. If anybody has a suggestion please let me know. I think it maybe has something to do with the compiler I'm using which is something like mingw but i have no idea how to set another compiler or something like that
Since you do not know msys, most likely you do not need the msys compiler, try mingw compiler itself from here.
make sure to install gcc, and gdb.
Since you did not mention I assume it is Windows, as a side note, if gdb gave you headache on Windows please use the mingw version bundled with Code::Blocks it is probably older though (look for the one that comes with mingw bundled).
You need to get either gdb/cdb installed with Qt to be able to debug your code. Try editing the options in Tools->Options in Qt Creator and pointing to correct gdb paths. That should solve this problem. There are other options available there to configure the gdb options in the settings dialog.

How can I make MSVC debugger step into Qt library source code again?

Until now my Visual Studio 2008 debugger gracefully stepped into Qt library code when I pressed F11. After upgrading Qt to the latest version and changing QTDIR, F11 does not step into library code anymore. Any clues how to make the debugger smart again?
Activate the modules list, Debug - Windows - Modules, to see what libraries are loaded and if debug symbols are loaded for those libraries. Note that you need to have the debugger active on your process to be able to do this.
In debug mode, the Qt libraries should be suffixed by d. QtCored4.dll for instance. If you see QtCore4.dll on the list, you have linked to the wrong libraries. If it does say QtCored4.dll but under Symbol Status there is something different than Symbols loaded., then that's the reason. You can manually load the symbols here by right clicking on the dll and selecting Load Symbols. It asks for the Pdb file after clicking that.
You can add more pdb file locations, if they weren't loaded but exist, from Tools - Options - Debugging(tree) - Symbols(tree). If you want the symbols to be automatically loaded.
Should it give some error, that the pdb file doesn't match the binary or something like that, you should re-build your Qt debug version, unless you have more pdb files to try. Use the Visual studio command prompt and go to the Qt directory, run configure and nmake. It takes a while, possibly some hours. There was some switch to only build debug version but i forgot where it goes. Note that the build might fail and after that it's a lot of fun www.google.com searches. The best bet might be to get the source only package, I forgot where to get that and it's not easily found. If you know where to get it, tell me please. I vaguely remember that there might be some other way to build the debug version, but this is the only one i know for sure.
#0xbaadf00d's recommendation to "open the Debug/Windows/Modules view" for verifying which modules have loaded successfully and which are not loaded is extremely useful.
Here is a summary of what I check when I need to step into Qt source code:
The DLLs must be for the Qt version in developer's Qt kit
The Qt .pdb files must be present in Qt kit's folders: bin, lib, plugins/platforms, plugins/qmltooling
Visual Studio Tools/Option/Debugging/Symbols needs paths to .pdb files:
If qt.conf file is used, must point to correct bin folder
If target is WinCE or WEC2013 and using HKLM\Loader\SystemPath, you must specify path to DLLs in SystemPath variable
Set the location for the source files in the project property pages:

Resources