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 show variables in full binary form during debugging in Qt Creator

How to show variables in full binary form during debugging in Qt Creator

Scheduled Pinned Locked Moved Unsolved General and Desktop
debuggingbinary formatfeature-request
10 Posts 3 Posters 1.2k 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.
  • R Offline
    R Offline
    Ronhald
    wrote on 13 Oct 2022, 11:25 last edited by Ronhald
    #1

    I am debugging a C++ program using Qt creator and I want that variables in the Locals section should be displayed in full binary form instead of the four or so digits that are currently shown. I mean, as we can see in the screenshot below, the variables i and j are shown as 1100 and 0 respectively but I want them to be shown in their full 16 bit or 32 bit form(depending on what size short has on the system/compiler).

    So how can i show i and j to be in their full 16/32 bit binary representation instead of this trimmed down version that is currently shown.

    Basically, i should be shown as 0000000000001100 if int is 16 bits and as 00000000000000000000000000001100 if int is 32 bits.

    J 1 Reply Last reply 13 Oct 2022, 12:03
    0
    • R Ronhald
      13 Oct 2022, 11:25

      I am debugging a C++ program using Qt creator and I want that variables in the Locals section should be displayed in full binary form instead of the four or so digits that are currently shown. I mean, as we can see in the screenshot below, the variables i and j are shown as 1100 and 0 respectively but I want them to be shown in their full 16 bit or 32 bit form(depending on what size short has on the system/compiler).

      So how can i show i and j to be in their full 16/32 bit binary representation instead of this trimmed down version that is currently shown.

      Basically, i should be shown as 0000000000001100 if int is 16 bits and as 00000000000000000000000000001100 if int is 32 bits.

      J Offline
      J Offline
      JonB
      wrote on 13 Oct 2022, 12:03 last edited by
      #2

      @Ronhald
      You mean have it write out 00001100 instead of 1100, so with leading zeroes? Since it does not do that now, and would not do that for e.g. a different base like decimal, I very much doubt you can do that.

      R 1 Reply Last reply 13 Oct 2022, 12:17
      0
      • J JonB
        13 Oct 2022, 12:03

        @Ronhald
        You mean have it write out 00001100 instead of 1100, so with leading zeroes? Since it does not do that now, and would not do that for e.g. a different base like decimal, I very much doubt you can do that.

        R Offline
        R Offline
        Ronhald
        wrote on 13 Oct 2022, 12:17 last edited by
        #3

        @JonB Yes, i want that i should be shown as 0000000000001100 if i is 16 bits and more 16 leading zeros if i is 32 bits. Just like visual studio allows it here. Same things goes for j also. It should also be shown in full binary form. Maybe there can be a option to expand/toggle between short and full binary form.

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Ronhald
          wrote on 13 Oct 2022, 13:36 last edited by
          #4

          Here is the bug report(feature request): https://bugreports.qt.io/browse/QTCREATORBUG-28305

          1 Reply Last reply
          0
          • C Offline
            C Offline
            ChrisW67
            wrote on 14 Oct 2022, 07:10 last edited by
            #5

            It is probably possible: Using Debugging Helpers

            R 1 Reply Last reply 14 Oct 2022, 14:53
            2
            • C ChrisW67
              14 Oct 2022, 07:10

              It is probably possible: Using Debugging Helpers

              R Offline
              R Offline
              Ronhald
              wrote on 14 Oct 2022, 14:53 last edited by
              #6

              @ChrisW67 I looked into Debugging Helpers but I couldn't find any way to do what I want. Can you perhaps show(assuming it is possible) how it can be done.

              C 1 Reply Last reply 14 Oct 2022, 23:28
              0
              • R Ronhald
                14 Oct 2022, 14:53

                @ChrisW67 I looked into Debugging Helpers but I couldn't find any way to do what I want. Can you perhaps show(assuming it is possible) how it can be done.

                C Offline
                C Offline
                ChrisW67
                wrote on 14 Oct 2022, 23:28 last edited by
                #7

                @Ronhald What platform and tool chain are you using? This drives the debugger involved

                R 2 Replies Last reply 15 Oct 2022, 05:23
                0
                • C ChrisW67
                  14 Oct 2022, 23:28

                  @Ronhald What platform and tool chain are you using? This drives the debugger involved

                  R Offline
                  R Offline
                  Ronhald
                  wrote on 15 Oct 2022, 05:23 last edited by
                  #8

                  @ChrisW67 I am using the following:

                  Qt Creator 4.13.0
                  Qt 5.15.0 (GCC 5.3.1 20160406 (Red Hat 5.3.1-6), 64 bit)
                  Ubuntu 18.04 Linux/X11

                  1 Reply Last reply
                  0
                  • C ChrisW67
                    14 Oct 2022, 23:28

                    @Ronhald What platform and tool chain are you using? This drives the debugger involved

                    R Offline
                    R Offline
                    Ronhald
                    wrote on 16 Oct 2022, 05:45 last edited by
                    #9

                    @ChrisW67 Can you show how is this possible using debugging helpers? I provided the platform and other details in my last comment.

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      ChrisW67
                      wrote on 16 Oct 2022, 08:14 last edited by
                      #10

                      @Ronhald OK, I've been digging around in this. Unfortunately, the debug helpers seem to focused on providing a more human-friendly depiction of complex structures. For basic integers the displayed data is actually formatted by Qt Creator's C++ code using QString::number(). This suppresses leading zeros.

                      It may be possible to customise the Qt Creator source to take into consideration the sizeof(IntType) to generate a string of appropriate length.

                      1 Reply Last reply
                      1

                      1/10

                      13 Oct 2022, 11:25

                      • Login

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