Development

Latest gdb important milestone

Grey-bearded debugger offers plenty

October 26, 2009, 04:32 PM — 

GNU released gdb 7.0 at the beginning of the month. This is an important milestone for all of us.

It's important for several reasons, even if you rarely use debuggers (as I do, on current projects), work mostly in high-level languages (as I do) and/or Java, are so unfamiliar with gdb that you don't know where to begin with it, or use gdb so much and so instinctively that you don't need for it to change. As we'll see over the next few installments of "Smart Development", Version 7.0 is a great time to learn gdb.

Even if you don't touch gdb directly, it affects your world. Just as you benefit from open-source even without reading the source (through the social guarantees of security, for example), your development environment is a healthier one when you know you can put your hands on a reliable, highly-portable, very powerful debugger if you get into trouble.

"How did I get here?"

'Ever been in a debugging session, and realized, "Uh-oh: I needed to pause ten steps earlier; how am I going to find out what the variables were?" You're not alone. With 7.0, gdb fully supports "reverse execution" or "reverse debugging"): you can back your program up. gdb gives all the usual control over reverse execution: you can single-step, you can step either into subroutines or over them--backwards--you can back up until you reach a breakpoint, and so on.

That's not all. 7.0 also makes it easy to record and playback a session. This gives you both the opportunity to read the log, to learn what you did to arrive at your location, and also to retrace some or all of your path.

Moreover, you can script gdb's capabilities with Python, now. If you need to look at the contents of a complicated data structure through time, during the execution of your application, you now can code in high-level Python a little report that understands how to display the content usefully, then invoke that function during your session. Script it once, and you never again have to slow down to figure out the keystrokes to look at the contents of the location addressed by the third element of the content of ...

This is only a fraction of what 7.0 provides. I'll follow up throughout the week with more examples of how slick gdb has become.

Sign up for ITworld's Daily newsletter
Follow ITworld on Twitter @IT_world

I like it!
Comments

reverse debugging tutorial online

There is an online tutorial for using gdb reverse debugging and process record/replay at
http://www.sourceware.org/gdb/wiki/ProcessRecord/Tutorial
| reply

Debuggers?

An alternative to an excellent debugger is excellent design derived from outstanding requirements. The better these are the less likely a debugger needs to be invoked. IMHO many of the root-causes have been distilled down to issues in design or requirements. Any debuggers available for these two important phases....?
| reply

Debug design? Requirements?

Yes and no. No, there aren't executable debuggers for the overwhelming majority of "requirements" and "designs". Yes, though, there's a vast literature on techniques to formalize and automate analysis and design.

Thanks for raising the question. I'll make a point of covering it in more detail in November 2009. For now, I'll simply offer the tip that the smartest single thing I know to do is to bring in testers and documenters as early in a development cycle as possible. Applications that can't be verified or explained ... well, that stacks the odds against success.

| reply
peer-to-peer

Esther Schindler
If the comments are ugly, the code is ugly

claird
SVG a graphics format for 21st century

pasmith
Take Chrome OS for a test spin

Sandra Henry-Stocker
Solaris Tip: Have Your Files Changed Since Installation?

sjvn
64-bits of protection?

jfruh
Android fragments vs. the iPhone monolith

mikelgan
What Gizmodo missed about the Pro WX Wireless USB disk drive

 

Sidekick: The Good News & the Bad News
Either way you look at it Microsoft Data Center management did not follow standards or best practices in this failure. In which case it makes me wonder more about the outsourcing of corporate data much less personal data.
- mburton325

Join the conversation here

The Daily Tip

The Daily TipQuick, practical advice for IT pros. Made fresh daily.

Hot tips:

Want to cash in on your IT savvy? Send your tip to tips@itworld.com. If we post it, we'll send you a $25 Amazon e-gift card.

Newsletters

Subscribe to ITWORLD TODAY and receive the latest IT news and analysis.

I would like to receive offers via email from ITworld partners.
By clicking submit you agree to the terms and conditions outlined in ITworld's privacy policy.
Featured Sponsor

AISO founders envisioned a Web hosting company that was environmentally friendly. While the company employed energy-efficient innovations like solar panels, its infrastructure produced unacceptable power and cooling requirements. Find out how AISO leveraged AMD technology to overcome their challenge in this case study white paper.

In this whitepaper, Scalar explores the opportunity to change the landscape with respect to mission critical databases built around Oracle. Leveraging technologies such as Linux, high-end commodity processing power and Oracle RAC technology to architect, design, build and maintain database infrastructure that delivers maximum availability, reliability and performance at a fraction of traditional cost.

On a typical day, weather.com, the Web site for The Weather Channel in Atlanta, serves up between 15 million and 20 million page views. But in September 2004, when back-to-back hurricanes ransacked Florida, the peak traffic on one day more than tripled: over 70 million page views by more than 7 million unique visitors. Read the full success story now.

Marketplace