Slashdot Mirror


What Good Linux Debuggers Are There?

David Weekly asks: "I'm programming for a small software company that's got a fair bit of C++ code; we've been using gdb whilst on Linux, but have been a little frustrated by its shortcomings with multithreaded applications and its fumbling multiple inheritance issues. I poked around on the Net and, other than gdb, I was only able to find Etnus' TotalView as a modern, actively-developed Linux debugger. Are there really only two Linux debuggers (that one can take seriously)? How, for instance, do folks who code up Apache modules test them in multithreaded mode? (i.e., not just using '-X'.) I'd love to hear answers more substantive than 'use printf()' and/or 'just use ____, my favorite gdb frontend'."

1 of 69 comments (clear)

  1. Multiple inheritance by gkatsi · · Score: 3, Flamebait

    I have not worked much with threaded applications, but I have encountered the problems with multiple inheritance.

    What I've ended up doing in hard cases (where printf will not help) is create local pointers to the parent classes and examine them from gdb. Once the problem is solved, the extra variables are gone, too.

    Example:
    Base1 *b1 = dynamic_cast[Base1*](this);
    Base2 *b2 = dynamic_cast[Base2*](this);

    (change [] to less-than and greater-than).

    Of course, this will not help when your hierarchy is more than a couple of levels deep and things get even more complicated when the parent class is actually a template argument.

    I hope, however, that this is just a very-hard-to-fix bug in gdb, as opposed to an even deeper design problem (as I think is the case with threaded code). So there might still be hope.