From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23667 invoked by alias); 31 Aug 2006 16:57:48 -0000 Received: (qmail 23658 invoked by uid 22791); 31 Aug 2006 16:57:46 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Thu, 31 Aug 2006 16:57:44 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1GIprH-0001iA-0Y; Thu, 31 Aug 2006 12:57:39 -0400 Date: Thu, 31 Aug 2006 16:57:00 -0000 From: Daniel Jacobowitz To: Frederic RISS Cc: Michael Veksler , gdb@sourceware.org Subject: Re: Get versioned minsyms from dynamic symtab (Was: Re: How to call operator<< functions?) Message-ID: <20060831165738.GA6529@nevyn.them.org> Mail-Followup-To: Frederic RISS , Michael Veksler , gdb@sourceware.org References: <44F5645F.4000301@tx.technion.ac.il> <1156936373.3429.250.camel@crx549.cro.st.com> <1156944608.3429.275.camel@crx549.cro.st.com> <1157024034.3429.303.camel@crx549.cro.st.com> <44F6D16B.7090001@tx.technion.ac.il> <1157027172.3429.309.camel@crx549.cro.st.com> <44F6DDF8.9000703@tx.technion.ac.il> <1157030582.3429.316.camel@crx549.cro.st.com> <1157042884.3429.344.camel@crx549.cro.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1157042884.3429.344.camel@crx549.cro.st.com> User-Agent: Mutt/1.5.11+cvs20060403 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-08/txt/msg00281.txt.bz2 On Thu, Aug 31, 2006 at 06:48:04PM +0200, Frederic RISS wrote: > What happens is that you get 2 definitions of std::cout in the debug > information of your example. One definition for each file. The gotcha is > that neither of these definitions are complete. They're just empty > shells specifying that the symbol is of type > ``typedef basic_ostream > std::ostream'' > without giving a clue to the debugger what this type is made of. > I think GCC should emit a complete type because you use std::ostream in > each of your files. This is a deliberate choice on GCC's part, to reduce overly excessive debug information. There've been arguments about it in the past. My feeling is that we will end up with something like a -gfull argument to force the extra information to be emitted. GDB needs to work as well as possible anyway. > The first 'p x.Print(std::cout)' works because at this point, the > debugger has only read the full debug information of the first file. > This file contains a definition of std::cout and the definition of > B::Print which both point to the same instance of the std::ostream type. > Being the same instance, even if the type is incomplete GDB resolves the > overload correctly. > After you've referenced 'myCout' which is defined in the second file, > the debug info of the latter has been read, bringing a second definition > of std::cout in the global scope. This second definition is found by > further lookups of this symbol, and this time, the symbol type isn't the > same instance as before. GDB tries to compare to incomplete types and of > course it fails... This is a problem with GDB, that I've always been amazed we didn't hit more often. It's a very difficult problem and I don't really know what we should be doing about it. I don't know if there's a standard term for this, but I've called it type unification in the past. We need some way to figure out that these are the same type, to the best of our knowledge. -- Daniel Jacobowitz CodeSourcery