From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16029 invoked by alias); 23 Jan 2004 23:06:46 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 16021 invoked from network); 23 Jan 2004 23:06:46 -0000 Received: from unknown (HELO hawaii.kealia.com) (209.3.10.89) by sources.redhat.com with SMTP; 23 Jan 2004 23:06:46 -0000 Received: by hawaii.kealia.com (Postfix, from userid 2049) id AB883C6AF; Fri, 23 Jan 2004 15:06:45 -0800 (PST) To: gdb-patches@sources.redhat.com Subject: Re: [rfa] lookup_transparent_type hack References: <20040119042535.GA10479@nevyn.them.org> From: David Carlton Date: Fri, 23 Jan 2004 23:06:00 -0000 In-Reply-To: (David Carlton's message of "Thu, 22 Jan 2004 14:00:08 -0800") Message-ID: User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Rational FORTRAN, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-01/txt/msg00639.txt.bz2 On Thu, 22 Jan 2004 14:00:08 -0800, David Carlton said: > These failures aren't caused by my patch to GDB - they happen with or > without the patch - but I want to look into the reason for the > behavior first before committing the patch. I've looked into them; as I suspected, they didn't really have anything to do with this patch. There is a bug in the way I handle the debug output that GCC 3.4 generates for classes in namespaces; I'll submit a patch for that later this afternoon. And, once I fixed that bug, I discovered that, if you do: void func () { C2 *obj = create2 (); return; } and set a breakpoint on the 'return' line then, if it's compiled with GCC 3.4, 'print *obj' claims that there isn't a variable named 'obj'. Sigh. So I tweaked rtti1.cc to avoid this issue. With that change, I committed the patch; the rtti1.cc part of the patch is below. David Carlton carlton@kealia.com Index: testsuite/gdb.cp/rtti1.cc =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/rtti1.cc,v retrieving revision 1.1 diff -u -p -r1.1 rtti1.cc --- testsuite/gdb.cp/rtti1.cc 23 Aug 2003 03:55:59 -0000 1.1 +++ testsuite/gdb.cp/rtti1.cc 23 Jan 2004 22:54:25 -0000 @@ -1,6 +1,6 @@ /* Code to go along with tests in rtti.exp. - Copyright 2003 Free Software Foundation, Inc. + Copyright 2003, 2004 Free Software Foundation, Inc. Contributed by David Carlton and by Kealia, Inc. @@ -55,6 +55,26 @@ namespace n1 { } // n1 +// NOTE: carlton/2004-01-23: This call exists only to convince GCC to +// keep around a reference to 'obj' in n2::func - GCC 3.4 had been +// optimizing it away. +void refer_to (n2::C2 *obj) +{ + // Do nothing. +} + +namespace n2 +{ + void func () + { + C2 *obj = create2 (); + + refer_to (obj); // func-constructs-done + + return; + } +} + int main() { using namespace n1; @@ -63,5 +83,7 @@ int main() C1 *e1 = create1(); C2 *e2 = create2(); - return 0; // constructs-done + n2::func(); // main-constructs-done + + return 0; }