Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Creator and GDB pretty printing

Qt Creator and GDB pretty printing

Scheduled Pinned Locked Moved Qt Creator and other tools
6 Posts 3 Posters 7.8k 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.
  • P Offline
    P Offline
    pixerit
    wrote on last edited by
    #1

    I have a GDB pretty printer that works under GDB. I can't get Qt Creator to use the printers in the locals window. Can Qt Creator use GDB pretty printers and if so, how can I set up?

    I appreciate any help you can provide. Thank you,
    Chris

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You're probably looking for that part of Qt Creator's "documentation":http://qt-project.org/doc/qtcreator-3.2/creator-debugging-helpers.html

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andrep
        wrote on last edited by
        #3

        Qt Creator can wrap and use "normal" GDB pretty printers that are registered in the global gdb.pretty_printers and all obj.pretty_printers that are loaded at application startup using the usual GDB means.

        The feature can be enabled by switching on "Load system GDB pretty printers" in the Tools->Options, Debugger settings.

        However, that is not recommended to use. Instead, the prefered solution is to write "Creator style" pretty printers (also in Python, see share/qtcreator/debugger/*types.py for examples). These require usually less code, are able to deliver output in different formats, and are "portable" in so far as they can also be used with LLDB.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pixerit
          wrote on last edited by
          #4

          Thanks for the reply, I appreciate the help.

          I have "Load system GDB pretty printers" checked but the printers still don't seem to be working. The locals still show the raw output. From GDB my printers are working fine. If I print from the GDB window my printer is in use. Qt Creator doesn't seem to use them, though. It seems to use some bb command, which I assume is a Qt Creator extension? Is there a way to make the locals windows use standard GDB commands (print)?

          Regarding the creator style printers, we're reluctant right now to switch to them right now. We have printers that work in GDB that we'd like to get working in Qt Creator.

          Thanks again for any help.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andrep
            wrote on last edited by
            #5

            You could try to search the debugger log (Windows->Views->Debugger Log) for obvious error messages.

            "bb" is the main entry point to run the Python code Creator uses for pretty printing. It will trigger Creator's own pretty printing, but also the "imported" pretty printers, assuming that the import went ok. "importing" here means asking GDB for registered pretty printers (and if your GDB-style pretty printers work on the command line, there should some reports), and making them known to the "bb" machinery. Without seeing your actual printer implementation (and the layout of the structures you are trying to pretty print) it's hard to guess where the import fails.

            [I am somewhat tempted to offer you to re-do your GDB-style pretty printers in "Creator style", just to prove a point, but... ;-)]

            1 Reply Last reply
            0
            • P Offline
              P Offline
              pixerit
              wrote on last edited by
              #6

              For the Creator style printers, is it possible to put them in a module? I can only seem to get them to be recognized if they're directly in ~/.gdbinit or Creator's startup commands. I'd like to have them in a module, likely a few different modules.

              Thanks!
              --Chris

              1 Reply Last reply
              0

              • Login

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