From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27898 invoked by alias); 13 Dec 2007 16:56:37 -0000 Received: (qmail 27889 invoked by uid 22791); 13 Dec 2007 16:56:36 -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, 13 Dec 2007 16:56:21 +0000 Received: (qmail 32594 invoked from network); 13 Dec 2007 16:56:19 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 13 Dec 2007 16:56:19 -0000 To: Doug Evans Cc: gdb@sourceware.org Subject: Re: protection from dangling pointers in dwarf info when .so's go away References: <20071213032724.GA25868@caradoc.them.org> <20071213131841.GA24646@caradoc.them.org> From: Jim Blandy Date: Thu, 13 Dec 2007 16:56:00 -0000 In-Reply-To: <20071213131841.GA24646@caradoc.them.org> (Daniel Jacobowitz's message of "Thu, 13 Dec 2007 08:18:41 -0500") 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-12/txt/msg00089.txt.bz2 Daniel Jacobowitz writes: > On Thu, Dec 13, 2007 at 12:16:36AM -0800, Doug Evans wrote: >> What happens if TYPE_OBJFILE (type) != TYPE_OBJFILE >> (TYPE_VPTR_BASETYPE (baseclass)) ? > > Precisely what you saw, but how does this happen? The baseclass links > should normally point through to other types in the same objfile. > > I'm guessing that there was inadequate debug info for a base class, > leading GDB to do name resolution into a shared library with better > debug info (probably because it defined the class's key method)? If I remember right, the way we usually handle this is by leaving the types from the main executable 'incomplete', as if it had just seen 'struct foo' but no definition for it. When we need the full definition of 'struct foo', we look it up by name, find it whereever it happens to be available, and use it there. So we do an extra name lookup, because that allows the reference to break naturally when objfiles are freed. But there shouldn't be pointers between objfiles, for the reasons stated.