Update 2015-07-19: Gitorious is dead. The repo has been forked in GitHub. Links were updated.
However, the debugger irritates me. It irritates me the least, but still it needs polishing. But, unlike Visual Studio, I have access to the source code and compiles out of the box (yay!).
Which means I can’t just rant and sit (though my time is valuable).
The Register window
The current register window is crap. I mean, look at it. Most useless window ever. Like Bruce Dawson, I like the debugger to show me huge amounts of information at once.
Copy pasting doesn’t work very well, comparing “ffff” with “fffff” is hard (there are no leading zeroes), numbers keep jumping due to lack of leading zeroes, debugging xmm registers with floating point content is a nightmare. I could go on.One register per row doesn’t cut it. What a waste of space. Specially when we have wide screens. Lots of scrolling going on.
So, in just one day I wrote a new Register window: the Registers “Pretty” window. I beg you to test it a bit before I submit a merge request.
You can enable it like any other debugger window (right click->Registers (pretty)
The pretty window is a read-only text area. So you can select and copy. It relies on Courier New, a fixed-width font, to display everything aligned. You cannot change this (hardcoded in C++) though you can tweak the font size at run time (‘Debugger font size follows main editor’ option must be on)
- Up to four registers per line. 8 & 16 bit registers are shown four per line. If the window is too small, the content wraps. 32 & 64 bit registers are shown two per line, while >64 bit registers are displayed one per line.
- Everything is padded and with leading zeroes. Now it’s easier to compare and visualize. There a few minor exceptions, most notably with registers breaking the name convention (i.e. rax is three letters, r9 is two)
- x87 registers shown in floating point. Now you can see its contents in floating point arithmetic rather than useless hex. It’s contents may be rounded/truncated/corrupted when using full 80-bit precision (I did not test this!) but next to them always the hex representation is shown just in case. Testing of stN register content is appreciated.
- XMM sub-register display. 4 floats per xmm register? Got it! Each fp is shown as xmm00, xmm01 and so on, xmm73 etc. When an xmm register changes, only the sub registers that changed turn red. I don’t remember even MSVC having this feature! Yay!
Here are a few captures of the register window, note that you can have both the old and new register window enabled:
What is missing?
- XMM double & integer sub-registers. I don’t use them as much, so I focus on what I needed.
- AVX registers. I don’t own an AVX capable machine. You can donate one to me if you wish 😛 ZMM registers means adding support for 16 sub-registers. You can extend the support though. It’s very easy. Look for RegisterHandler::writePrettyOutput function.
- Toggle sub-registers off. XMM sub-registers are always shown.
- On the first break, some xmm subregisters may not be in red, while others are. That’s because there is no data to compare to and the “previous state” is defaulted to zero. Thus if the actual data contains zeroes, it won’t be marked in red (i.e. a minor bug).
- ARM enhanced support. I didn’t try ARM. It should work out of the box, but there is no “enhanced” experienced (i.e. ensuring all registers that are related are displayed together, useful conversions, stuff like that).
Now only one really annoying debugging bug remains in Qt Creator: I like to navigate the “Locals and Expressions” window with arrow keys. But whenever Qt requests more data from GDB (i.e. I expanded an element to see its children), the window is refreshed and though the scroll is retained, the selection is reset to the very first element, so on my arrow key stroke the window scrolls back to the top. I have to use the mouse instead. REALLY annoying.
Let’s hope this contribution makes into the main branch. The debugger really needs care.
Just in case you missed, here’s the repo with source code again.