Thread: GUI Debugger for linux -- DDD

  1. #1
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300

    GUI Debugger for linux -- DDD

    I noticed while installing Ubuntu, DDD is now available as a distro package. Perhaps it always has been, but about 6 months or so ago I went to check it out and could not find an rpm as it only recently began being maintained again after some years, and I had to patch a bug in lesstif in order to build from source.

    I only use a debugger when I have to, and not for fun, but I will say this -- having a GUI frontend for gdb makes it a lot more useful (there is also --tui, which uses ncurses windows, but I've never fooled with that). One of the nicest things about it is the (optional) gridded "data window" at the top; you can click on any variable in the source view and send it to the data window, then drag them around into whatever arrangement you want with the mouse. As you can see in the screenshot, I've lined up a couple of struct instances and a variable ("hit"). In the "BlockBoard" struct, I can even view all the elements of a member array (BlockBoard is also an array, so BlockBoard[n].xxyz is the case in point). The values are kept updated during execution, so here I have a (point n' click!) breakpoint set (the red stop sign) in a oft-called function, and everytime I hit the breakpoint the values for the two structs and "hit" are made current. That's almost as good as a nice printf and a lot more convenient and simple to configure.

    Also, you can reload the executable if you re-compile, and as long as the source changes aren't too drastic, you keep all your break points and the data display choices in the data window -- which you can maintain different sets of those relevant to different breakpoints (only variables which apply to the current context will appear).

    The little toolbar window stage right is handy too, if you set it "stays on top".

    I won't claim to be an expert with this, I just wanted to make it known to people like me who don't like IDE's etc. If you are just learning to use gdb, this will probably make it easier (it seems more intuitive, IMO). I barely ever have to type anything, but you can see the gdb commands used by DDD in the bottom window.

    The one obvious criticism I'd make it is uses an archiac version of Qt, so the interface looks kinda crappy, and selecting a file in a pop-up includes the archiac and confusing "filter" button (you have to select a subdirectory, then click "filter", then choose a file).
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  2. #2
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Thanks for posting this MK27. I'll take a look at it later. Admittedly I've had troubles getting gdb to work at all. Ran it via command line a couple times, and ran into some Code::Blocks GDB GUI bug so it wouldn't let me debug breakpoints or anything.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  3. #3
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875

    GDB front-ends

    There are a couple of nice front-ends for GDB for those who hate the command line on Linux: DDD of course but also:

    Insight
    Nemiver
    xxgdb (apt-get install xxgdb)
    kdb (apt-get install kdb)

    To name a few...I know there are more....

    Becoming conversant with command-line GDB is a worth-while skill, like learning enough of VIM to not curse it with your life if stuck using it....

    Jeff

  4. #4
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875
    BTW don't forget the sheer debugging prowess of Valgrind...GDB (et al) can catch bugs as they are happening but a thorough use of Valgrind can catch them *before* they happen. Even if the code is not eventually going to be used on Linux, you can catch an amazing amount of gotchas...

    Valgrind

    Jeff

  5. #5
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875
    BTW not to sound all zen and everything but at the end of the day, the best debugger is the brain. Use it.
    C/C++ Environment: GNU CC/Emacs
    Make system: CMake
    Debuggers: Valgrind/GDB

  6. #6
    Registered User
    Join Date
    Jul 2007
    Posts
    131
    What - archaic version of Qt? DDD uses Motif. (fronty <3 CDE)

    DDD is very nice. It's my favourite debugging tool. And it supports other debuggers than gdb too - you can use it even with perl debugger.

    EDIT: Fixed typo: debugger -> debuggers
    Last edited by fronty; 12-15-2009 at 02:39 PM.

  7. #7
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875

    DDD with other debuggers

    Quote Originally Posted by fronty View Post
    What - archaic version of Qt? DDD uses Motif. (fronty <3 CDE)

    DDD is very nice. It's my favourite debugging tool. And it supports other debugger than gdb too - you can use it even with perl debugger.
    I did not know that; how very cool! Can you supply a link with more info? Curious minds want to know.... ^__^
    C/C++ Environment: GNU CC/Emacs
    Make system: CMake
    Debuggers: Valgrind/GDB

  8. #8
    Registered User
    Join Date
    Jul 2007
    Posts
    131
    According to DDD's website current version supports debugging with GDB, DBX, WDB, Ladebug, JDB, XDB, perl debugger, bash debugger, GNU make debugger and python debugger. Checked DDD's manual and it seems to contain good info on usage with different debuggers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. any shareware GUI to use for Windows ?
    By Amy N. in forum C Programming
    Replies: 6
    Last Post: 07-22-2009, 01:31 PM
  2. GUI Programming...
    By ShadeS_07 in forum C++ Programming
    Replies: 12
    Last Post: 12-28-2008, 04:58 PM
  3. .NET And GUI Programming :: C++
    By kuphryn in forum C++ Programming
    Replies: 4
    Last Post: 01-27-2002, 04:22 PM
  4. GUI Programming :: C++ Exclusive
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 01-25-2002, 03:22 PM
  5. C++: Reference Book, GUI, Networking & Beyond
    By kuphryn in forum C++ Programming
    Replies: 4
    Last Post: 11-10-2001, 08:03 PM