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 view Backtrace / Stacktrace?
Forum Updated to NodeBB v4.3 + New Features

How to view Backtrace / Stacktrace?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 4 Posters 9.8k Views 2 Watching
  • 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.
  • A Offline
    A Offline
    AwesomeBoxhead
    wrote on 19 Oct 2019, 17:13 last edited by
    #1

    I am having one heck of a time figuring out how to view Stacktrace / Backtrace info.

    I can not find any good documentation that shows how I can set this up or view it. If you know of a way to view the stacktrace / backtrace within Qt, please let me know.

    I have found documention on Qt titled "Viewing Call Stack Trace" which does not explain how to view this Stack view. I set breakpoints and the program does not seem to break and I can not see any further detailed information in my Issues, Application Output, or other tabs.

    I found "StackView" which appears to be available with QML, however, I am not using QML.

    It appears the QDebug class does not offer anything for calling or working with a stacktrace / backtrace.

    Other people have created whole new classes to deal with Stacktracing, however, all these seem to be very old methods.

    Is construction my own StackTrace class something that people do in Qt to debug their program? Qt not have a native way to view the stack trace?

    Here are ways that I found where I would need to create my own stack trace class:

    Walking the callstack
    Printing a Stack Trace with MinGW
    Qt C++ Unhandled exceptions stack trace
    How to automatically generate a stacktrace when my program crashes

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on 19 Oct 2019, 17:59 last edited by
      #2

      You don't have to write any code to view the stack trace unless you're writing a debugger or want to have debugger-like features in your app.

      If you just want to vie the stack trace of your own app in Qt Creator just make sure about these things:

      qtcreator debugger

      • Check that you're actually running a debug version of the app, not release (See the picture above)
      • Make sure you've got a debugger automatically configured for your kit. Go to Tools -> Options -> Kits -> Kits tab, select a kit you're using and check if the "Debugger" field in its properties is set. Post a picture of that page if you're in doubt.
      • Make sure you're actually starting a debug session and not a run session i.e. the green arrow with bug icon in the picture above.

      With that all you need to do is set a breakpoint (F9 or click on the left margin of your code) and it should stop the app's execution at that point and a stack trace panel will show up automaticaly below your code when the breakpoint is hit.

      1 Reply Last reply
      3
      • M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 19 Oct 2019, 18:12 last edited by
        #3

        Hi
        So when you run as @Chris-Kawa describes
        then you should see this.

        alt text

        1 Reply Last reply
        1
        • A Offline
          A Offline
          AwesomeBoxhead
          wrote on 20 Oct 2019, 02:06 last edited by AwesomeBoxhead
          #4

          Thanks to both of you guys so much! That helped immensely :)

          Exactly what I was looking for!

          A 1 Reply Last reply 20 Oct 2019, 05:11
          1
          • A AwesomeBoxhead
            20 Oct 2019, 02:06

            Thanks to both of you guys so much! That helped immensely :)

            Exactly what I was looking for!

            A Offline
            A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on 20 Oct 2019, 05:11 last edited by
            #5

            Hi @AwesomeBoxhead,

            so if your problem is solved, please don't forget to mark this topic as SOLVED too. Thanks!

            Qt has to stay free or it will die.

            1 Reply Last reply
            1

            1/5

            19 Oct 2019, 17:13

            • Login

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