From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 104739 invoked by alias); 18 Jul 2017 19:42:35 -0000 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 Received: (qmail 104726 invoked by uid 89); 18 Jul 2017 19:42:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Jul 2017 19:42:32 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v6IJgPQR018387 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 18 Jul 2017 15:42:30 -0400 Received: by simark.ca (Postfix, from userid 112) id 9D88A1F2A1; Tue, 18 Jul 2017 15:42:25 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 8B8581E627; Tue, 18 Jul 2017 15:42:23 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 18 Jul 2017 19:42:00 -0000 From: Simon Marchi To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 01/40] Make gdb.base/dmsym.exp independent of "set language ada" In-Reply-To: <1496406158-12663-2-git-send-email-palves@redhat.com> References: <1496406158-12663-1-git-send-email-palves@redhat.com> <1496406158-12663-2-git-send-email-palves@redhat.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 18 Jul 2017 19:42:25 +0000 X-IsSubscribed: yes X-SW-Source: 2017-07/txt/msg00264.txt.bz2 On 2017-06-02 14:21, Pedro Alves wrote: > This test is using "set language ada" expecting that to cause GDB to > do Ada symbol name matching. That won't work when GDB uses the > symbol's language to decide which symbol matching algorithm to use, > because the test's symbols are C symbols. > > So generalize the test a bit to not rely on Ada name matching rules. > > Confirmed that by undoing the original fix the test was written for, > the test still fails. > > gdb/testsuite/ChangeLog: > > * gdb.base/dmsym.c (pck__foo__bar__minsym): Rename to ... > (test_minsym): ... this, and make static. > (get_pck__foo__bar__minsym): Rename to ... > (get_test_minsym): ... this. > * gdb.base/dmsym.exp (): Remove "set language ada" call. Adjust > symbol names and comments. > * gdb.base/dmsym_main.c (get_pck__foo__bar__minsym): Rename to ... > (get_test_minsym): ... this. > (pck__foo__bar__minsym__2): Rename to ... > (test_minsym): ... this. > (main): Adjust. > --- > gdb/testsuite/gdb.base/dmsym.c | 8 ++++---- > gdb/testsuite/gdb.base/dmsym.exp | 39 > +++++++++++++------------------------ > gdb/testsuite/gdb.base/dmsym_main.c | 10 +++++----- > 3 files changed, 23 insertions(+), 34 deletions(-) > > diff --git a/gdb/testsuite/gdb.base/dmsym.c > b/gdb/testsuite/gdb.base/dmsym.c > index f358b51..dccea23 100644 > --- a/gdb/testsuite/gdb.base/dmsym.c > +++ b/gdb/testsuite/gdb.base/dmsym.c > @@ -15,11 +15,11 @@ > You should have received a copy of the GNU General Public License > along with this program. If not, see > . */ > > -int pck__foo__bar__minsym = 123; > +static int test_minsym = 123; > > int > -get_pck__foo__bar__minsym (void) > +get_test_minsym (void) > { > - pck__foo__bar__minsym++; > - return pck__foo__bar__minsym; > + test_minsym++; > + return test_minsym; > } > diff --git a/gdb/testsuite/gdb.base/dmsym.exp > b/gdb/testsuite/gdb.base/dmsym.exp > index a318080..191a319 100644 > --- a/gdb/testsuite/gdb.base/dmsym.exp > +++ b/gdb/testsuite/gdb.base/dmsym.exp > @@ -44,42 +44,31 @@ clean_restart ${testfile} > set num "\[0-9\]+" > set addr "0x\[0-9a-zA-Z\]+" > > -# Although the test program is written in C, the original problem > -# occurs only when the language is Ada. The use of a C program is > -# only a convenience to be able to exercise the original problem > -# without requiring an Ada compiler. In the meantime, temporarily > -# force the language to Ada. > - > -gdb_test_no_output "set lang ada" > - > -# Verify that setting a breakpoint on `pck__foo__bar__minsym' only > -# results in one location found (function pck__foo__bar__minsym__2). > -# A mistake would be to also insert a breakpoint where > -# pck__foo__bar__minsym is defined. Despite the fact that there is > -# no debugging info available, this is a data symbol and thus should > -# not be used for breakpoint purposes. > - > -gdb_test "break pck__foo__bar__minsym" \ > +# Verify that setting a breakpoint on `test_minsym' only results in > +# one location found. A mistake would be to also insert a breakpoint > +# in the test_minsym data symbol in dmsym.c. Despite the fact that > +# there is no debugging info available, this is a data symbol and thus > +# should not be used for breakpoint purposes. > + > +gdb_test "break test_minsym" \ > "Breakpoint $num at $addr.: file .*dmsym_main\\.c, line > $num\\." > > # However, verify that the `info line' command, on the other hand, > # finds both locations. > > -gdb_test "info line pck__foo__bar__minsym" \ > - "Line $num of \".*dmsym_main\\.c\" .*\r\nNo line number > information available for address $addr " > - > -gdb_test_no_output "set lang auto" > +gdb_test "info line test_minsym" \ > + "Line $num of \".*dmsym_main\\.c\" .*\r\nNo line number > information available for address $addr " > > -# Now, run the program until we get past the call to > -# pck__foo__bar__minsym__2. Except when using hardware breakpoints, > -# inferior behavior is going to be affected if a breakpoint was > -# incorrectly inserted at pck__foo__bar__minsym. > +# Now, run the program until we get past the call to test_minsym. > +# Except when using hardware breakpoints, inferior behavior is going > +# to be affected if a breakpoint was incorrectly inserted at > +# test_minsym. > > gdb_breakpoint dmsym_main.c:[gdb_get_line_number "BREAK" dmsym_main.c] > > gdb_run_cmd > gdb_test "" \ > - "Breakpoint $num, pck__foo__bar__minsym__2 \\(\\) at.*" \ > + "Breakpoint $num, test_minsym \\(\\) at.*" \ > "run until breakpoint at BREAK" > > gdb_test "continue" \ > diff --git a/gdb/testsuite/gdb.base/dmsym_main.c > b/gdb/testsuite/gdb.base/dmsym_main.c > index 99589b8..0338dc7 100644 > --- a/gdb/testsuite/gdb.base/dmsym_main.c > +++ b/gdb/testsuite/gdb.base/dmsym_main.c > @@ -15,18 +15,18 @@ > You should have received a copy of the GNU General Public License > along with this program. If not, see > . */ > > -extern int get_pck__foo__bar__minsym (void); > +extern int get_test_minsym (void); > > -int > -pck__foo__bar__minsym__2 (void) > +static int > +test_minsym (void) > { > - return get_pck__foo__bar__minsym (); > + return get_test_minsym (); > } > > int > main (void) > { > - int val = pck__foo__bar__minsym__2 (); > + int val = test_minsym (); > > if (val != 124) /* BREAK */ > return 1; I don't think anybody looked at this one, so I did. Looks good to me. Simon