Skip to content

What is GammaRay? 3 reasons to start using it today

What is GammaRay?

For starters, it’s a powerful electromagnetic wave, as well as a way to treat cancer. It’s also an under-appreciated German speed metal band. And it’s what gives Dr. Bruce Banner his big green alter ego. But Qt aficionados will know the GammaRay that we’re talking about is an uber-powerful Qt debugger and introspection tool. If you’re not using it already, read on to find out why it should be part of your go-to toolkit.

Fig 0. Doc Bruce Banner, bathed in Gamma Rays

Fig 0. Doc Bruce Banner, bathed in gamma rays

The GammaRay Qt debugger is metaphorically named after the medical treatment, for obvious reasons, once you know what it does. When you need to cure (debug) really invasive (complex) cancers (defects) in your patient (code), you sometimes need a powerful gamma ray (aka “GammaRay”).

Okay, so that’s the “what”, but why is it so great? Here are three big reasons why you need to stop procrastinating and start getting familiar with this world class tool.

1) GammaRay understands Qt. Your C++ debugger is only so smart. Sure, it can tell you the values of QObject properties, but it doesn’t grok them. GammaRay is built with an understanding of Qt—it understands things like object properties, object hierarchies, signals/slots, MVC architecture, and scene graphs, and shows these to you in an intuitive way. Unlike a plain old C++ debugger, GammaRay knows what all that moc stuff is actually doing to your code. “Just say no” to manually inspecting any more pointers in a Qt-unaware debugger.

Fig 1. Tracing through a Qt State Machine in Gamma Ray

Fig 1. Tracing through a Qt State Machine in GammaRay

2) GammaRay is visual. Do you use state machines but you can’t figure out why they’re misbehaving? Is your program generating tons of signals that cloud your visibility to the real problem? Is your MVC WTF? Sometimes getting a visual representation makes all the difference in the world for debugging big, complex problems, and GammaRay makes that easy with its domain-specific viewers. Using GammaRay means you’ll never again have to click through 10,000 properties to build a mental model of your running system’s data structures in your head, or scan through pages of log files looking for events evidence.

Fig 2. Looking at interactions of signals between three objects

Fig 2. Looking at interactions of signals between three objects

3) GammaRay is read/write. With GammaRay, not only can you inspect object properties, you can change them in running code on the fly. We may have powerful CPUs and compilers, but C++ still has a compile step and the bigger the code, the more inconvenient that is. Tell the truth—aren’t you just a tiny bit jealous when you see Web developers in the Chrome debugger hacking their code live and seeing the results immediately in the browser? Yeah, thought so. GammaRay gives you that same power, whether you’re using Qt Quick, QtWidgets, QGraphicsView, or a custom mix thereof.

Fig 3. Finding the perfect color using Gamma Ray

Fig 3. Finding the perfect color using GammaRay

Hopefully you’re convinced. Great! Although we’ve barely scratched the surface, it’s free and it’s here so you can start experimenting. We hope to bring you a number of deeper dives into what this tool can really do and how to maximize your use of it in the upcoming weeks…

About KDAB

KDAB is a consulting company offering a wide variety of expert services in Qt, C++ and 3D/OpenGL and providing training courses in:

KDAB believes that it is critical for our business to contribute to the Qt framework and C++ thinking, to keep pushing these technologies forward to ensure they remain competitive.

Leave a Reply

Your email address will not be published. Required fields are marked *