Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to debug a release version with QT Creator or GDB in Linux.
Forum Updated to NodeBB v4.3 + New Features

How to debug a release version with QT Creator or GDB in Linux.

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 5 Posters 427 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fox Zhang
    wrote on last edited by
    #1

    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!

    J.HilkJ JoeCFDJ 2 Replies Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      See https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • F Fox Zhang

        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!

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        @Fox-Zhang

        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


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply
        1
        • S Offline
          S Offline
          stretchthebits
          wrote on last edited by
          #4

          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 bad

          On Linux, you will need int64_t
          int64_t thatAddress;
          thatAddress = (int64_t)&thing; <===== This will work

          What 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.

          1 Reply Last reply
          0
          • F Fox Zhang

            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!

            JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by JoeCFD
            #5

            @Fox-Zhang

            1. 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
            2. still run valgrind your_app(debug build) with full flags to see any suspicious problems and fix them first
            3. run some static C++ analyser (for example cppcheck)
              https://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis
            4. 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.

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved