From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15176 invoked by alias); 15 Nov 2007 16:50:10 -0000 Received: (qmail 15167 invoked by uid 22791); 15 Nov 2007 16:50:10 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 15 Nov 2007 16:50:03 +0000 Received: (qmail 13219 invoked from network); 15 Nov 2007 16:50:00 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 15 Nov 2007 16:50:00 -0000 To: Eli Zaretskii Cc: schwab@suse.de, ghost@cs.msu.su, gdb@sources.redhat.com Subject: Re: Multiple breakpoint locations References: <18233.63439.953202.586908@kahikatea.snap.net.nz> From: Jim Blandy Date: Thu, 15 Nov 2007 16:50:00 -0000 In-Reply-To: (Eli Zaretskii's message of "Thu, 15 Nov 2007 06:08:08 +0200") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-11/txt/msg00161.txt.bz2 Eli Zaretskii writes: >> Cc: Vladimir Prus , gdb@sources.redhat.com >> From: Jim Blandy >> Date: Wed, 14 Nov 2007 13:26:26 -0800 >> >> Following that link, I think I now better appreciate why full C++ >> support in GDB is basically impossible: in order to decide which 'fun' >> template the call in 'main' refers to, one must try to instantiate >> each template and type-check the resulting code. So GDB would need to >> essentially incorporate a full C++ front end. > > The information emitted by the compiler (which already has a full C++ > implementation) could help, couldn't it? Actually, it doesn't. Did you follow the link Andreas posted? When the user enters a source expression referring to some function, and we have several function templates in scope under the given name, the process of deciding which function template's instantiation the user's expression actually refers to involves essentially trying out each template, typechecking its entire body, and rejecting the template if a problem arises. The debugging information could carry the templates' definitions to us, giving us enough information to do the work --- but the work itself is not much less complicated than a C++ front end. In practice, the debugging information does not carry the definitions of all the templates in scope, because it would often be huge. You will often have many templates in scope that you never used --- from header files, say. In order to carry out the process described above, the debugging information would need to carry the templates' complete definitions, including statements and expressions, not just summary information like what a C declaration carries. And those full definitions can be substantial. Restricting yourself to templates actually instantiated in the program would bring the size issue under control, but it doesn't address the 'complete C++ front end' issue.