Unsolved How to debug a release version with QT Creator or GDB in Linux.
-
Background: Product refresh from 32-bit to 64-bit, QT version 5.15.
Problem: Saw a bug that can only be reproduced with Release version in Linux.
Question: How to modify Qmake parameters to allow debug of release build with QT Creator or GDB in Linux???Thanks in Advance Bros!
-
-
Saw a bug that can only be reproduced with Release version in Linux
make sure you initialize everything correctly, nullptrs for pointers, bools to false, values to something reasonable.
Will most likely fix the issue
-
You compiled a project that was meant for 32 bit to 64 bit?
Is it possible that somewhere in your code, you are copying a pointer to an integer?int thatAddress;
thatAddress = (int)&thing; <===== That’s badOn Linux, you will need int64_t
int64_t thatAddress;
thatAddress = (int64_t)&thing; <===== This will workWhat I do to debug a Release version is to sprinkle some code in there that writes to a file. When the EXE crashes, it tells me which is the offending line.
-
- first try to run the following (if it is on Linux) to see if you can find some clues(where it crashes).
strace your_app - still run valgrind your_app(debug build) with full flags to see any suspicious problems and fix them first
- run some static C++ analyser (for example cppcheck)
https://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis - introduce QT Logging
https://www.francescmm.com/logging-with-qt/
https://www.kdab.com/wp-content/uploads/stories/slides/Day2/KaiKoehne_Qt Logging Framework 16_9_0.pdf
There may be no other way to debug a release build in qt creator.
- first try to run the following (if it is on Linux) to see if you can find some clues(where it crashes).