Latest gdb important milestone

Grey-bearded debugger offers plenty

By Cameron Laird  3 comments

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.

3 comments

    Anonymous 2 years ago
    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....?
    claird
    claird 2 years ago in reply to Anonymous

    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.

    Anonymous 2 years ago
    There is an online tutorial for using gdb reverse debugging and process record/replay athttp://www.sourceware.org/gdb/wiki/ProcessRecord/Tutorial

      Add a comment

      Post a comment using one of these accounts
      Or join now
      At least 6 characters

      Note: Comment will appear soon after you have activated your account.
      Obscene/spam comments will be removed and accounts suspended.
      The information you submit is subject to our Privacy Policy and Terms of Service.

      ITworld LIVE

      DevelopmentWhite Papers & Webcasts

      White Paper

      HP NonStop SQL Fundamentals whitepaper

      This whitepaper offers a detailed look into the fundamentals of HP NonStop SQL solutions. See how this system delivers unprecedented levels of application availability with fail-safe data integrity and meets the needs of enterprises with large-scale business critical applications.

      White Paper

      Nebraska Medical Center case study

      See how the Nebraska Medical Center implemented a SQL solution to make information more readily available to streamline operations, improve patient care and facilitate medical research with an enterprise solution running on HP NonStop servers.

      White Paper

      Concepts of NonStop SQL/MX

      For DBAs and developers who are familiar with Oracle solutions and want to learn about NonStop SQL/MX, this whitepaper provides an overview of the similarities and differences between the two products-with a specific focus on implementation.

      White Paper

      6 Things Your CIO Needs to Know About Requirements

      If your organization is not predictably successful on technology projects, there is likely an issue in requirements. CIOs must take action and own requirements maturity improvement. There are 6 main things a CIO must know about requirements.

      Webcast On Demand

      User Experience Monitoring

      In this webinar, you will learn hints & tips for improving end-user response times from Forrester Research analyst, Jean-Pierre Garbani.

      Sponsor: Nimsoft

      See more White Papers | Webcasts

      Ask a question

      Ask a Question