From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10227 invoked by alias); 18 May 2012 17:17:38 -0000 Received: (qmail 10202 invoked by uid 22791); 18 May 2012 17:17:36 -0000 X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_NO,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_BJ X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 May 2012 17:17:23 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 9AD261C70B3; Fri, 18 May 2012 13:17:22 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id YkKsCfYYPnK6; Fri, 18 May 2012 13:17:22 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 69DAE1C70B2; Fri, 18 May 2012 13:17:22 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 2C817145616; Fri, 18 May 2012 10:17:08 -0700 (PDT) Date: Fri, 18 May 2012 17:17:00 -0000 From: Joel Brobecker To: Jan Kratochvil Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: gdb.base/print-file-var.exp false PASS [Re: [RFA] choose symbol from given block's objfile first.] Message-ID: <20120518171708.GM10253@adacore.com> References: <1336430581-11262-1-git-send-email-brobecker@adacore.com> <874nrqvbeh.fsf@fleche.redhat.com> <20120509190529.GI15555@adacore.com> <20120509190753.GA31769@adacore.com> <20120509214758.GQ15555@adacore.com> <20120509214856.GA8314@adacore.com> <20120518161008.GA24465@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120518161008.GA24465@host2.jankratochvil.net> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-05/txt/msg00696.txt.bz2 On Fri, May 18, 2012 at 06:10:08PM +0200, Jan Kratochvil wrote: > On Wed, 09 May 2012 23:48:56 +0200, Joel Brobecker wrote: > > +++ b/gdb/testsuite/gdb.base/print-file-var-lib1.c > [..] > > +int this_version_id = 104; > > + > > +int > > +get_version_1 (void) > > +{ > > + return this_version_id; > > +} > [...] > > +++ b/gdb/testsuite/gdb.base/print-file-var-lib2.c > [...] > > +int this_version_id = 203; > > + > > +int > > +get_version_2 (void) > > +{ > > + return this_version_id; > > +} > [...] > > +++ b/gdb/testsuite/gdb.base/print-file-var-main.c > [...] > > +int > > +main (void) > > +{ > > + if (get_version_1 () != 104) > > + return 1; > > + if (get_version_2 () != 104) > > + return 2; > > + return 0; > > +} > [...] > > +++ b/gdb/testsuite/gdb.base/print-file-var.exp > [...] > > +gdb_test "print 'print-file-var-lib1.c'::this_version_id" \ > > + " = 104" > > + > > +gdb_test "print 'print-file-var-lib2.c'::this_version_id" \ > > + " = 203" > > This testcase proves GDB behaves incorrectly - if the code sees 104 in both > cases then GDB should also print 104 in both cases. I am curious why did you > check it in when you have proven yourself the regression. I really don't know how to read your last sentence, and I am going to pretend you did not write it. Please correct me if I misunderstood what you are trying to imply. My mistake, I was expecting get_version_2 in this example to return 203, not 104. But I see now that, on my Linux machine, it does return 104. On the other hand, on Windows, with the same code, the function returns 203. So the code is not portable. I wonder how things are working on GNU/Linux, because the two shared libraries are linked independently, and then the main executable does not reference the global variable at all. I don't know what to do. I can remove the testcase entirely, or we can test the target and adjust the expected output based on that. This is still not going to help with the GDB side of things. But I don't think that this is a regression. I don't think we have any way of knowing which instance of the variable to pick. -- Joel