How to trace the source code in QT? - 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

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.

QtCreator debug pause stop at code not assembly

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.

can’t debug in qt sdk 1.2-during startup program exited with code 0x0

Today I found that I could not debug in pure C projetc, but I could debug in qt gui project.
The error was “ during startup program exited with code 0×0”.
I was using Win 7 ultimate 64bit sp1. I had tried in another computer, it was the same.
My program ran when I was not trying to debug it.
Could someone help?
Qt SDK 1.2 includes qt lib 4.8 and qt creator 2.4.1.
Uncheck run in terminal, in Projects -> Run Options
If the debugger does not work properly, try the following:
Make sure you use at least Qt Creator 2.1.
Make sure the debugger is set up properly. For more information, see Setting Up Debugger.
In the Debug mode, select Windows > Views > Debugger Log to open the Debugger Log view. Browse the contents of the pane on the right hand side to find out what went wrong. Always attach the contents of the pane to debugger-related questions to the Qt Creator mailing list (qt-creator#trolltech.com) or paste them to creator.pastebin.com before asking questions in the IRC (on the #qt-creator channel at FreeNode).

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.

Debugging Mojo for Palm Pre with Eclipse & Aptana

I'm pretty new to Eclipse and Mojo (.NET guy). I'm having difficulty debugging. I can set breakpoints and switch to the "Debug" Perspective, but no matter what I can do (I am running in debug mode), I can't seem to get the IDE to stop at a breakpoint in the emulator. I'm sure it's a pretty newbie mistake with Eclipse. Anyone have a good step by step I can follow.
Currently, there is no way to set a breakpoint in eclipse for use with the palm emulator.
As Gtompson83 mentioned, all we've got to work with is the gdb-style command line debugger that is included with the SDK.
Yes it's a pain.
I find it easier to attach to the emulator via ssh (scroll down to "Debugging" section) to view logging, and then just using logging in your app to figure out what is going on.
Palm has a debugger as part of the command line tools. You can set break points and check variables.
Debugger Info
I like using the Ares Debugger/Logger. It works even for code not developed using Ares.
After starting the debug mode in Eclipse (changed debug config for the app to have checked the checkboxes for Inspectable and Mojo debugging),
launch the following URL in your browser (I've had the best results with Google Chrome):
http://ares.palm.com/AresDebug/ (you can use also AresLog for logger)
For AresDebug you may need to adjust the Script Filter to start with whatever your appinfo.json file has for the "id" value, then press Get Scripts. Then you're basically good to go. You can select another *.js file and set breakpoints, etc.

Resources