Qt creator not giving me information about variables while debugging
-
Hey, I am running into some problems with debugging with Qt creator recently (using QtCreator 8.0.1). When hitting a breakpoint in a function, and stepping through it, the local stack variables disappear from the view (top right window in the video) and I cant inspect them anymore afterwards, also some statements are skipped while stepping through my code:
https://streamable.com/7ae63kDoes anyone have an idea on how I could be able to fix this?
Thanks in advance -
It looks like you are on Linux using GDB as a debugger. Which GDB version are you using?
The "Debugger Log" could have some information that could help:
-
Thanks for the reply, I am using gdb 12.1 on linux (KDE Manjaro).
What information specifically should I be looking for? The output is quiet much
-
You don't seem to have debug info for Qt available, so not being able to step into the QFile constructor is expected.
On a general note, be careful on what you have in your "Evaluated Expressions". This is executed(!) in the context of the current frame on each step, so destructive function calls or for performance reasons invalid code should be avoided.
-
Why wouldn't I have debug symbols, if I am running it in debug mode, and my compile options are:
target_compile_options(adapters PRIVATE "$<$<CONFIG:DEBUG>:-Wall;-Wextra;-g3;-Og>") target_compile_options(adapters PRIVATE "$<$<CONFIG:RELEASE>:-O3>")
Also, this still doesn't explain why I cant see my stack variables and why I cant query their values
-
Why wouldn't I have debug symbols, if I am running it in debug mode, and my compile options are:
target_compile_options(adapters PRIVATE "$<$<CONFIG:DEBUG>:-Wall;-Wextra;-g3;-Og>") target_compile_options(adapters PRIVATE "$<$<CONFIG:RELEASE>:-O3>")
Also, this still doesn't explain why I cant see my stack variables and why I cant query their values
@Creaperdown
The options are only for compiling your own code. Unless you have compiled Qt itself for debug or got its symbols from somewhere, and the source code is present, you are not going to see source inside a Qt function. That should be a separate issue from your own code. -
How did you get Qt installed?
For Qt SDK you need to install the Qt Debugging Information Files component, see below:
-
I see, this probably is the problem here. Since I want to use Qt 5.15.5, but the Qt Installer doesnt offer my a way to download it, I am using my desktops automatically provided Qt, which probably doesnt have the debug information
-
Hi,
Qt 5.15.3 and onward when released are only in source format so you have to build them yourself.
As for your distribution provided Qt, there are usually separated packages with debug informations.
-
Hi,
Qt 5.15.3 and onward when released are only in source format so you have to build them yourself.
As for your distribution provided Qt, there are usually separated packages with debug informations.
@SGaist How exactly would I add these packages to work with QtCreator?
-
It looks like you are using Manjaro Linux. As it turns out Manjaro doesn't build packages with Debug symbols,
that is if I interpret https://forum.manjaro.org/t/debug-symbols-on-manjaro/61157 correctly.You will have to install Qt via https://download.qt.io/official_releases/online_installers/qt-unified-linux-x64-online.run and select the Qt Debug Information Files at installation time.
-
It looks like you are using Manjaro Linux. As it turns out Manjaro doesn't build packages with Debug symbols,
that is if I interpret https://forum.manjaro.org/t/debug-symbols-on-manjaro/61157 correctly.You will have to install Qt via https://download.qt.io/official_releases/online_installers/qt-unified-linux-x64-online.run and select the Qt Debug Information Files at installation time.
@cristian-adam said in Qt creator not giving me information about variables while debugging:
It looks like you are using Manjaro Linux. As it turns out Manjaro doesn't build packages with Debug symbols,
that is if I interpret https://forum.manjaro.org/t/debug-symbols-on-manjaro/61157 correctly.Actually if we have a look at https://wiki.archlinux.org/title/Debugging/Getting_traces there is advice how to install debug packages:
# pacman -U https://geo.mirror.pkgbuild.com/extra-debug/os/x86_64/qt6-base-debug-6.4.0-1-x86_64.pkg.tar.zst