From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18227 invoked by alias); 9 May 2012 21:49:21 -0000 Received: (qmail 18211 invoked by uid 22791); 9 May 2012 21:49:19 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO,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; Wed, 09 May 2012 21:49:06 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 321671C6AA6; Wed, 9 May 2012 17:49:05 -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 FIi73xM+9PVc; Wed, 9 May 2012 17:49:05 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id AC7261C6AE6; Wed, 9 May 2012 17:49:04 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 91C72145616; Wed, 9 May 2012 14:48:56 -0700 (PDT) Date: Wed, 09 May 2012 21:49:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFA] choose symbol from given block's objfile first. Message-ID: <20120509214856.GA8314@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> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="r5Pyd7+fXNt84Ff3" Content-Disposition: inline In-Reply-To: <20120509214758.GQ15555@adacore.com> 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/msg00325.txt.bz2 --r5Pyd7+fXNt84Ff3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 702 [grumble grumble] And here is a second testcase that gets fixed by this patch as well. I suspect the reason why my patch fixes it is because the variables in the shared libraries must be LOC_UNRESOLVED, and thus resolved through default_read_var_value/lookup_minimal_symbol. gdb/testsuite/ChangeLog: * gdb.base/print-file-var-lib1.c, gdb.base/print-file-var-lib2.c, gdb.base/print-file-var-main.c, gdb.base/print-file-var.exp: New files. gdb/ChangeLog: * config/djgpp/fnchange.lst: Add entries for print-file-var-lib1.c, print-file-var-lib2.c, print-file-var-main.c and print-file-var.exp (located in gdb/testsuite/gdb.base). Tested on x86_64-linux. -- Joel --r5Pyd7+fXNt84Ff3 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0003-Add-print-file-var-testcase-with-two-libs-defining-t.patch" Content-length: 7741 >From ea60097df50e222f0ed7629df3fa5b4155d15cf0 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Wed, 9 May 2012 14:41:13 -0700 Subject: [PATCH] Add print 'file'::var testcase with two libs defining the same global variable gdb/testsuite/ChangeLog: * gdb.base/print-file-var-lib1.c, gdb.base/print-file-var-lib2.c, gdb.base/print-file-var-main.c, gdb.base/print-file-var.exp: New files. gdb/ChangeLog: * config/djgpp/fnchange.lst: Add entries for print-file-var-lib1.c, print-file-var-lib2.c, print-file-var-main.c and print-file-var.exp (located in gdb/testsuite/gdb.base). --- gdb/config/djgpp/fnchange.lst | 4 ++ gdb/testsuite/gdb.base/print-file-var-lib1.c | 23 +++++++++++ gdb/testsuite/gdb.base/print-file-var-lib2.c | 23 +++++++++++ gdb/testsuite/gdb.base/print-file-var-main.c | 29 +++++++++++++ gdb/testsuite/gdb.base/print-file-var.exp | 55 ++++++++++++++++++++++++++ 5 files changed, 134 insertions(+), 0 deletions(-) create mode 100644 gdb/testsuite/gdb.base/print-file-var-lib1.c create mode 100644 gdb/testsuite/gdb.base/print-file-var-lib2.c create mode 100644 gdb/testsuite/gdb.base/print-file-var-main.c create mode 100644 gdb/testsuite/gdb.base/print-file-var.exp diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst index 59e456e..7d5ea82 100644 --- a/gdb/config/djgpp/fnchange.lst +++ b/gdb/config/djgpp/fnchange.lst @@ -417,6 +417,10 @@ @V@/gdb/testsuite/gdb.base/hook-stop-frame.c @V@/gdb/testsuite/gdb.base/hstop-frame.c @V@/gdb/testsuite/gdb.base/hook-stop-continue.exp @V@/gdb/testsuite/gdb.base/hstop-continue.exp @V@/gdb/testsuite/gdb.base/hook-stop-frame.exp @V@/gdb/testsuite/gdb.base/hstop-frame.exp +@V@/gdb/testsuite/gdb.base/print-file-var-lib1.c @V@/gdb/testsuite/gdb.base/pfv-lib1.c +@V@/gdb/testsuite/gdb.base/print-file-var-lib2.c @V@/gdb/testsuite/gdb.base/pfv-lib2.c +@V@/gdb/testsuite/gdb.base/print-file-var-main.c @V@/gdb/testsuite/gdb.base/pfv-main.c +@V@/gdb/testsuite/gdb.base/print-file-var.exp @V@/gdb/testsuite/gdb.base/pfv.exp @V@/gdb/testsuite/gdb.base/return-nodebug1.c @V@/gdb/testsuite/gdb.base/return-1nodebug.c @V@/gdb/testsuite/gdb.base/siginfo-addr.c @V@/gdb/testsuite/gdb.base/si-addr.c @V@/gdb/testsuite/gdb.base/siginfo-obj.c @V@/gdb/testsuite/gdb.base/si-obj.c diff --git a/gdb/testsuite/gdb.base/print-file-var-lib1.c b/gdb/testsuite/gdb.base/print-file-var-lib1.c new file mode 100644 index 0000000..dc9d03d --- /dev/null +++ b/gdb/testsuite/gdb.base/print-file-var-lib1.c @@ -0,0 +1,23 @@ +/* This testcase is part of GDB, the GNU debugger. + Copyright 2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +int this_version_id = 104; + +int +get_version_1 (void) +{ + return this_version_id; +} diff --git a/gdb/testsuite/gdb.base/print-file-var-lib2.c b/gdb/testsuite/gdb.base/print-file-var-lib2.c new file mode 100644 index 0000000..1803cb2 --- /dev/null +++ b/gdb/testsuite/gdb.base/print-file-var-lib2.c @@ -0,0 +1,23 @@ +/* This testcase is part of GDB, the GNU debugger. + Copyright 2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +int this_version_id = 203; + +int +get_version_2 (void) +{ + return this_version_id; +} diff --git a/gdb/testsuite/gdb.base/print-file-var-main.c b/gdb/testsuite/gdb.base/print-file-var-main.c new file mode 100644 index 0000000..b8baf0f --- /dev/null +++ b/gdb/testsuite/gdb.base/print-file-var-main.c @@ -0,0 +1,29 @@ +/* This testcase is part of GDB, the GNU debugger. + Copyright 2012 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +extern int get_version_1 (void); +extern int get_version_2 (void); + +int +main (void) +{ + if (get_version_1 () != 104) + return 1; + if (get_version_2 () != 104) + return 2; + return 0; +} + diff --git a/gdb/testsuite/gdb.base/print-file-var.exp b/gdb/testsuite/gdb.base/print-file-var.exp new file mode 100644 index 0000000..67c3ac4 --- /dev/null +++ b/gdb/testsuite/gdb.base/print-file-var.exp @@ -0,0 +1,55 @@ +# Copyright 2012 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . */ + +set executable print-file-var-main + +set lib1 "print-file-var-lib1" +set lib2 "print-file-var-lib2" + +set libobj1 "${objdir}/${subdir}/${lib1}.so" +set libobj2 "${objdir}/${subdir}/${lib2}.so" + +set lib_opts { debug additional_flags=-fPIC } + +if { [gdb_compile_shlib ${srcdir}/${subdir}/${lib1}.c \ + ${libobj1} \ + ${lib_opts} ] != "" } { + return -1 +} +if { [gdb_compile_shlib ${srcdir}/${subdir}/${lib2}.c \ + ${libobj2} \ + ${lib_opts} ] != "" } { + return -1 +} +if { [gdb_compile "${srcdir}/${subdir}/${executable}.c" \ + "${objdir}/${subdir}/${executable}" \ + executable \ + [list debug shlib=${libobj1} shlib=${libobj2}]] + != ""} { + return -1 +} + +clean_restart $executable + +if ![runto_main] { + untested "could not run to main" + return -1 +} + +gdb_test "print 'print-file-var-lib1.c'::this_version_id" \ + " = 104" + +gdb_test "print 'print-file-var-lib2.c'::this_version_id" \ + " = 203" -- 1.7.1 --r5Pyd7+fXNt84Ff3--