LWN: Comments on "GDB 7.0 released" https://lwn.net/Articles/356044/ This is a special feed containing comments posted to the individual LWN article titled "GDB 7.0 released". en-us Sat, 11 Oct 2025 01:45:25 +0000 Sat, 11 Oct 2025 01:45:25 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net GDB 7.0 released https://lwn.net/Articles/357431/ https://lwn.net/Articles/357431/ MichaelSnyder <div class="FormattedComment"> There has just been posted a tutorial page for gdb reverse debugging:<br> <a rel="nofollow" href="http://www.sourceware.org/gdb/wiki/ProcessRecord/Tutorial">http://www.sourceware.org/gdb/wiki/ProcessRecord/Tutorial</a><br> <p> </div> Sun, 18 Oct 2009 12:16:46 +0000 GDB 7.0 released https://lwn.net/Articles/357084/ https://lwn.net/Articles/357084/ jwakely <i>GDB can only present the information present in the debug info, so if GCC is just slapping in the fully expanded instantiated types, then that's all GDB can give the user.</i> <p> ... and this isn't true. GDB can show a more useful representation of data structures than simply listing all the bases and members, and that's exactly what the new python pretty printing does. Thu, 15 Oct 2009 11:33:21 +0000 GDB 7.0 released https://lwn.net/Articles/357069/ https://lwn.net/Articles/357069/ jwakely <i>A lot of that is GCC's fault, really. GDB can only present the information present in the debug info, so if GCC is just slapping in the fully expanded instantiated types, then that's all GDB can give the user.</i> <p> GCC has to "slap in" the full type name for the linker, typedefs do not affect the name the linker uses. <p> <i>GDB needs a big push in the debug info department.</i> <p> You mean GCC, right? It's getting a big push, see <a href='http://gcc.gnu.org/wiki/Var_Tracking_Assignments'>http://gcc.gnu.org/wiki/Var_Tracking_Assignments</a> <p> <i>It could use a big push in the compile time error quality, too, for that matter.</i> <p> See <a href='http://gcc.gnu.org/wiki/Better_Diagnostics'>http://gcc.gnu.org/wiki/Better_Diagnostics</a> - although it's easy to say diagnostics should be better, it's a lot harder to suggest specific improvements. Thu, 15 Oct 2009 08:56:56 +0000 GDB 7.0 released https://lwn.net/Articles/357068/ https://lwn.net/Articles/357068/ elanthis <div class="FormattedComment"> A lot of that is GCC's fault, really. GDB can only present the information present in the debug info, so if GCC is just slapping in the fully expanded instantiated types, then that's all GDB can give the user.<br> <p> GDB needs a big push in the debug info department. It could use a big push in the compile time error quality, too, for that matter.<br> </div> Thu, 15 Oct 2009 08:26:00 +0000 great news about reverse debugging https://lwn.net/Articles/356382/ https://lwn.net/Articles/356382/ nix <div class="FormattedComment"> i.e., a reversible VM (with the reversibility interface being GDB, <br> definitely a good decision.)<br> </div> Fri, 09 Oct 2009 22:46:40 +0000 great news about reverse debugging https://lwn.net/Articles/356332/ https://lwn.net/Articles/356332/ MichaelSnyder <div class="FormattedComment"> No, but VMware supports reverse *debugging*, with gdb.<br> You run gdb on the host, and debug the guest (either user<br> process or kernel). When you say "reverse-continue" in gdb, <br> VMware executes the guest backward until it hits a breakpoint<br> or watchpoint.<br> <p> <p> </div> Fri, 09 Oct 2009 18:35:27 +0000 GDB 7.0 released https://lwn.net/Articles/356264/ https://lwn.net/Articles/356264/ bronson <div class="FormattedComment"> <font class="QuotedText">&gt; though if gdb has trouble with that, it'll have trouble with longjmp too.</font><br> <p> Not true. An exception unwinds the stack calling destructors as it goes. Longjmp just restores registers and jumps up the stack. They're very different beasts.<br> <p> C++ Exception handling is actually quite complex with a number of unintuitive gotchas. Sadly, it's been a great source of compiler bugs too.<br> <p> </div> Fri, 09 Oct 2009 15:07:29 +0000 GDB 7.0 released https://lwn.net/Articles/356257/ https://lwn.net/Articles/356257/ cry_regarder <div class="FormattedComment"> We had this in a commercial compiler ($100K plus for reverse capability) in PL/I, Fortran, and COBOL back in 1994 on IBM ES-9000... It was insanely awesome for debugging code written by your grandfather :-)<br> <p> Cry<br> </div> Fri, 09 Oct 2009 13:56:41 +0000 GDB 7.0 released https://lwn.net/Articles/356234/ https://lwn.net/Articles/356234/ sspr <div class="FormattedComment"> Thank you for this informative comment. Reading these kind of comments (and articles!) is exactly what makes me stick&amp;subscribe to LWN.<br> <p> </div> Fri, 09 Oct 2009 09:38:12 +0000 GDB 7.0 released https://lwn.net/Articles/356228/ https://lwn.net/Articles/356228/ nix <div class="FormattedComment"> Well, another problem is that GDB tended to use the full expanded names for all these types, rather than hiding things which are not referenced in the source code but only via default template parameters (very common: e.g. allocators in the STL). This tends to make trivial things like 'cout' or 'list&lt;string&gt;' into multiline what-the-hell-is-that horrors. (This was fixed for diagnostic output some time ago, but I haven't done much C++ debugging recently so I'm not sure if GDB fixed it similarly.)<br> <p> </div> Fri, 09 Oct 2009 09:07:45 +0000 GDB 7.0 released https://lwn.net/Articles/356224/ https://lwn.net/Articles/356224/ nix Forget longjmp. With the debugging information currently supplied in all released GCCs, GDB has trouble with variables that transition between registers and memory more than once (i.e. most of them in complex functions). The var-tracking branch for GCC should fix this, hopefully. <p> Regarding the constructors, the <a href="http://www.codesourcery.com/public/cxx-abi/abi.html#obj-ctor">C++ ABI</a> defines three types of constructor: complete object constructors, base object constructors, and complete object allocating constructors (but the latter type is optional and GCC never generates them). GCC somewhat confusingly calls the former two types 'in-charge' and 'not-in-charge' constructors, and these are the names GDB uses for them. <p> Complete object constructors are supposed to dig out the appropriate VTT pointer during virtual inheritance and call the base object constructor: however, released GCCs instead just clone the entire function body (see gcc/cp/class.c:build_clone()). When he implemented this, Mark Mitchell <a href="http://gcc.gnu.org/ml/gcc-patches/2000-04/msg00403.html">mentioned</a> that <blockquote> It would be better to have multiple entry points into a single routine, but we don't have support for that yet in the back-end, and we can always change the method used later without breaking the ABI. </blockquote> but nobody ever implemented this, so when you set a breakpoint in a constructor it ends up in <i>two</i> places, not one, and this confuses the hell out of most GDBs. <p> (Mind you, GDB has to handle this anyway even if the in-charge constructor does change to call the not-in-charge one: GCC can do cloning of arbitrary functions now to aid constant propagation and inlining, even across translation unit boundaries if whole-program optimization is on, and I'd expect that to confuse GDB in exactly the same way as in-charge/not-in-charge constructors always have. I haven't checked to see if this has been fixed in the last year.) Fri, 09 Oct 2009 09:05:49 +0000 great news about reverse debugging https://lwn.net/Articles/356223/ https://lwn.net/Articles/356223/ nix <div class="FormattedComment"> A reversible VM isn't *quite* the same thing. (There was a reversible VM project for Linux based on UML, called ReVirt, but it was an academic project so it suffered the usual fate of such and died as soon as the funding went away. I keep wishing someone would bring one back again, but, admittedly, without ever actually doing anything toward that end myself.)<br> <p> </div> Fri, 09 Oct 2009 08:43:10 +0000 GDB 7.0 released https://lwn.net/Articles/356183/ https://lwn.net/Articles/356183/ njs <div class="FormattedComment"> IME the biggest problem with debugging C++ in gdb -- at least traditionally -- is that C++ programs tend to use complex opaque types for everything (e.g., std::string, std::map, ...). In theory this isn't a problem, all the data is there and accessible through C-callable functions, but in practice it's hellish.<br> <p> IIRC the new Python scripting stuff is supposed to help with this.<br> </div> Fri, 09 Oct 2009 05:14:51 +0000 GDB 7.0 released https://lwn.net/Articles/356175/ https://lwn.net/Articles/356175/ quotemstr Fair enough on exception handling (though if gdb has trouble with that, it'll have trouble with <code>longjmp</code> too.) <p> But what's this double-constructor thing? Fri, 09 Oct 2009 01:50:13 +0000 great news about reverse debugging https://lwn.net/Articles/356158/ https://lwn.net/Articles/356158/ MichaelSnyder <div class="FormattedComment"> VMware workstation 7.0 supports reverse debugging in both gdb (for Linux VMs) and Virtual Studio (for M$oft VMs).<br> <p> </div> Thu, 08 Oct 2009 23:32:26 +0000 GDB 7.0 released https://lwn.net/Articles/356151/ https://lwn.net/Articles/356151/ MichaelSnyder <div class="FormattedComment"> You're thinking of checkpoint/restart. This is completely different.<br> The present "reverse debugging" feature set allows you to do reverse-step,<br> reverse-next, reverse-continue etc., running backward to any breakpoint<br> or watchpoint, or just stepping backward by a single instruction if you<br> choose. You're not restricted to stopping only at previously designated<br> checkpoints.<br> <p> <p> </div> Thu, 08 Oct 2009 22:55:09 +0000 great news about reverse debugging https://lwn.net/Articles/356149/ https://lwn.net/Articles/356149/ nix <div class="FormattedComment"> ooo! it can use chronicle-written databases! Yay!<br> <p> (think 'persistent after-the-fact remote debugging')<br> </div> Thu, 08 Oct 2009 22:36:56 +0000 GDB 7.0 released https://lwn.net/Articles/356148/ https://lwn.net/Articles/356148/ nix <div class="FormattedComment"> Differences that GDB has had trouble with include exception handling, <br> overloaded functions, the magic duplicate of every constructor that the <br> C++ ABI dictates (put a breakpoint on it and likely as not it'd land on <br> the wrong one)...<br> </div> Thu, 08 Oct 2009 22:33:38 +0000 great news about reverse debugging https://lwn.net/Articles/356147/ https://lwn.net/Articles/356147/ nix <div class="FormattedComment"> I dunno. Do non-free debuggers implement reverse debugging? It's obviously <br> really killingly *useful* to developers, which is probably why it got <br> done :) (it also needs lots of storage, which is probably why it didn't <br> get done twenty years ago.)<br> <p> </div> Thu, 08 Oct 2009 22:32:23 +0000 GDB 7.0 released https://lwn.net/Articles/356141/ https://lwn.net/Articles/356141/ ikm <div class="FormattedComment"> Well the difference is a *huge* quantity of them in some larger C++ projects, all are very lengthy and convoluted, many of them being template instantiations etc. I remember trying to debug such projects in GCC and attempting to trace through a program was quite impossible, being horribly slow. And sometimes gdb would just end up segfaulting and asking whether I would want to debug the gdb itself. It was a pity, really. Don't know the state of affairs now -- that's why I asked. But some years ago the situation didn't look good.<br> </div> Thu, 08 Oct 2009 21:59:42 +0000 GDB 7.0 released https://lwn.net/Articles/356130/ https://lwn.net/Articles/356130/ oak <div class="FormattedComment"> <font class="QuotedText">&gt; There's no difference between debugging C and C++ programs, except that </font><br> C++ ones have funny symbol names. Assuming you can get past the name <br> mangling (and the thiscall calling convention*), what's the difference?<br> <p> For example exception handling. Exception handler can crash when stack <br> has been unwound. A bit tricker to show callers then...<br> <p> Project Archer's devel branch page lists some other issues they deal with.<br> <p> </div> Thu, 08 Oct 2009 20:23:25 +0000 GDB 7.0 released https://lwn.net/Articles/356129/ https://lwn.net/Articles/356129/ robert_s <div class="FormattedComment"> "I guess you just have to arrange for the thread to stop at a<br> time when it's not holding locks the rest of the program depends on"<br> <p> Sounds like a great way to trigger and investigate race conditions that you'd never thought of.<br> </div> Thu, 08 Oct 2009 20:21:15 +0000 GDB 7.0 released https://lwn.net/Articles/356123/ https://lwn.net/Articles/356123/ cventers <div class="FormattedComment"> Reverse debugging sounds very cool, but non-stop debugging sounds even<br> cooler to me. I guess you just have to arrange for the thread to stop at a<br> time when it's not holding locks the rest of the program depends on :p<br> </div> Thu, 08 Oct 2009 19:51:09 +0000 GDB 7.0 released https://lwn.net/Articles/356120/ https://lwn.net/Articles/356120/ quotemstr <div class="FormattedComment"> There's no difference between debugging C and C++ programs, except that C++ ones have funny symbol names. Assuming you can get past the name mangling (and the thiscall calling convention*), what's the difference?<br> <p> * which is practically identical to the fastcall convention used by some C code.<br> </div> Thu, 08 Oct 2009 19:47:05 +0000 GDB 7.0 released https://lwn.net/Articles/356105/ https://lwn.net/Articles/356105/ pranith <div class="FormattedComment"> I tried the snapshot feature in 6.8 and it was a big letdown. After switching to the forked process, it mostly crashed. Never got it working.<br> </div> Thu, 08 Oct 2009 18:30:39 +0000 GDB 7.0 released https://lwn.net/Articles/356103/ https://lwn.net/Articles/356103/ JoeBuck I've had pretty good experiences with gdb 6.8 and C++, certainly a big improvement over earlier versions. Thu, 08 Oct 2009 18:02:05 +0000 GDB 7.0 released https://lwn.net/Articles/356087/ https://lwn.net/Articles/356087/ ikm <div class="FormattedComment"> Reverse debugging is sure cool, but does gdb still fall down on its knees when trying to debug any complex C++ program, perfomance- -- or sometimes even segfault-wise?<br> </div> Thu, 08 Oct 2009 16:44:30 +0000 GDB 7.0 released https://lwn.net/Articles/356065/ https://lwn.net/Articles/356065/ mjw <div class="FormattedComment"> From the Project Archer Roadmap<br> <a href="http://sourceware.org/gdb/wiki/ProjectArcher">http://sourceware.org/gdb/wiki/ProjectArcher</a><br> <p> "# Fedora patches. Fedora has a big backlog of gdb patches. We will rebase these to a more recent gdb, integrate them into archer, and send them upstream as appropriate."<br> </div> Thu, 08 Oct 2009 14:50:54 +0000 GDB 7.0 released https://lwn.net/Articles/356055/ https://lwn.net/Articles/356055/ rahulsundaram <div class="FormattedComment"> These were all patches that Red Hat contributed to GDB upstream. Should go away as Fedora inherits 0.7<br> </div> Thu, 08 Oct 2009 13:59:43 +0000 GDB 7.0 released https://lwn.net/Articles/356054/ https://lwn.net/Articles/356054/ arekm <div class="FormattedComment"> No idea, fedora at least needs these - <a href="http://cvs.fedora.redhat.com/viewvc/devel/gdb/">http://cvs.fedora.redhat.com/viewvc/devel/gdb/</a><br> </div> Thu, 08 Oct 2009 13:52:53 +0000 GDB 7.0 released https://lwn.net/Articles/356053/ https://lwn.net/Articles/356053/ coriordan Were those patches used to give GDB the features which it now has in 7.0? Thu, 08 Oct 2009 13:49:25 +0000 great news about reverse debugging https://lwn.net/Articles/356050/ https://lwn.net/Articles/356050/ coriordan <div class="FormattedComment"> The reverse-debugging feature was on FSF's high priority list for a good while - which usually indicates there's some acute problem of free software users/developers being drawn to some non-free software by this feature.<br> <p> Glad to hear it's gotten done.<br> <p> <a href="http://www.fsf.org/campaigns/priority.html">http://www.fsf.org/campaigns/priority.html</a><br> </div> Thu, 08 Oct 2009 13:47:14 +0000 GDB 7.0 released https://lwn.net/Articles/356048/ https://lwn.net/Articles/356048/ arekm <div class="FormattedComment"> Are 107 Fedora gdb patches merged in or will distros still need to apply tons of patches to make it more useful?<br> </div> Thu, 08 Oct 2009 13:34:56 +0000