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. Writing a custom dumper
QtWS25 Last Chance

Writing a custom dumper

Scheduled Pinned Locked Moved Qt Creator and other tools
5 Posts 2 Posters 1.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.
  • O Offline
    O Offline
    orgads
    Qt Champions 2017
    wrote on last edited by
    #1

    Hello,

    I opened a bug report QTCREATORBUG-5508 for this, maybe I can get some help here.

    What I want is a dumper that will display for a certain type a member or a function evaluation. The only thing I want to change is the 'Value' display for the class, I want to be able to expand it and see its members like before.

    How do I do that?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      loladiro
      wrote on last edited by
      #2

      Here is the "answer":http://doc.qt.nokia.com/qtcreator-snapshot/creator-debugging-helpers.html

      1 Reply Last reply
      0
      • O Offline
        O Offline
        orgads
        Qt Champions 2017
        wrote on last edited by
        #3

        I read the docs (see my bug report). That's not what I want.

        Moreover, I tried to create a most simple dumper:
        @
        def qdump__MyClass(d, item):
        d.putStringValue(item.value["string"])
        d.putNumChild(0)
        @

        with the code:
        @
        class MyClass
        {
        const char *string;
        public:
        MyClass() : string("test") {}
        };

        int main()
        {
        MyClass c;
        return 0;
        }
        @

        It makes gdb crash...

        1 Reply Last reply
        0
        • O Offline
          O Offline
          orgads
          Qt Champions 2017
          wrote on last edited by
          #4

          Got it. putStringValue is only for QString...

          I did:
          @
          def qdump__MyClass(d, item):
          d.putValue(encodeCharArray(item.value["string"], 40), Hex2EncodedLatin1)
          d.putNumChild(0)
          @

          now it works. Can it be simpler than that?

          1 Reply Last reply
          0
          • O Offline
            O Offline
            orgads
            Qt Champions 2017
            wrote on last edited by
            #5

            I found a simpler way:
            @d.putValue(extractCharArray(item.value["string"], 40))@

            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