From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19224 invoked by alias); 26 Feb 2004 19:00:23 -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 19196 invoked from network); 26 Feb 2004 19:00:12 -0000 Received: from unknown (HELO takamaka.act-europe.fr) (209.53.16.160) by sources.redhat.com with SMTP; 26 Feb 2004 19:00:12 -0000 Received: by takamaka.act-europe.fr (Postfix, from userid 507) id 3209547D62; Thu, 26 Feb 2004 11:00:11 -0800 (PST) Date: Thu, 26 Feb 2004 19:00:00 -0000 From: Joel Brobecker To: Elena Zannoni , gdb-patches@sources.redhat.com Subject: Re: [RFA/dwarf-2] Fix for the null record problem Message-ID: <20040226190011.GE1154@gnat.com> References: <20040219140145.GB804@gnat.com> <16437.11835.435941.553479@localhost.redhat.com> <20040226023108.GF3425@gnat.com> <20040226032743.GA30615@nevyn.them.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="EeQfGwPcQSOJBaQU" Content-Disposition: inline In-Reply-To: <20040226032743.GA30615@nevyn.them.org> User-Agent: Mutt/1.4i X-SW-Source: 2004-02/txt/msg00770.txt.bz2 --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 501 > I'd like to have the empty struct test anyway. Remember to add a > variable of that type if you add a type to class2.cc; or newer GCCs > will just elide the type. Would the following patch be ok to apply? 2004-02-26 J. Brobecker * gdb.cp/class2.cc (empty): New class. (refer): New function. (main): Declare an object of type empty and use it. * gdb.cp/class2.exp: Print the value of an object of type empty. Tested on x86-linux. -- Joel --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="empty.diff" Content-length: 1294 Index: class2.cc =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/class2.cc,v retrieving revision 1.2 diff -u -r1.2 class2.cc --- class2.cc 11 Feb 2004 14:01:25 -0000 1.2 +++ class2.cc 26 Feb 2004 18:51:32 -0000 @@ -48,10 +48,19 @@ ; } +struct empty {}; + +// Stop the compiler from optimizing away data. +void refer (empty *) +{ + ; +} + int main (void) { A alpha, *aap, *abp; B beta, *bbp; + empty e; alpha.a1 = 100; beta.a1 = 200; beta.b1 = 201; beta.b2 = 202; @@ -59,6 +68,7 @@ aap = α refer (aap); abp = β refer (abp); bbp = β refer (bbp); + refer (&e); return 0; // marker return 0 } // marker close brace Index: class2.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/class2.exp,v retrieving revision 1.1 diff -u -r1.1 class2.exp --- class2.exp 25 Nov 2003 15:01:31 -0000 1.1 +++ class2.exp 26 Feb 2004 18:51:32 -0000 @@ -113,3 +113,7 @@ gdb_test "print * (B *) abp" \ "= {.*a1 = 200.*b1 = 201.*b2 = 202}" \ "print * (B *) abp at marker return 0" + +# Printing the value of an object containing no data fields: + +gdb_test "p e" "= {}" "print object with no data fields" --EeQfGwPcQSOJBaQU--