How to show variables in full binary form during debugging in Qt Creator
-
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 variablesi
andj
are shown as1100
and0
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
andj
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 as0000000000001100
ifint
is 16 bits and as00000000000000000000000000001100
ifint
is 32 bits. -
@JonB Yes, i want that
i
should be shown as0000000000001100
ifi
is 16 bits and more 16 leading zeros ifi
is 32 bits. Just like visual studio allows it here. Same things goes forj
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. -
Here is the bug report(feature request): https://bugreports.qt.io/browse/QTCREATORBUG-28305
-
It is probably possible: Using Debugging Helpers
-
@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.