From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9148 invoked by alias); 22 Dec 2002 11:39:04 -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 9138 invoked from network); 22 Dec 2002 11:39:02 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (216.138.202.10) by 209.249.29.67 with SMTP; 22 Dec 2002 11:39:02 -0000 Received: from redhat.com (tooth.toronto.redhat.com [172.16.14.29]) by touchme.toronto.redhat.com (Postfix) with ESMTP id 6D43580007F; Sun, 22 Dec 2002 06:38:50 -0500 (EST) Message-ID: <3E05A7E5.1020608@redhat.com> Date: Sun, 22 Dec 2002 10:25:00 -0000 From: Fernando Nasser Organization: Red Hat Canada User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020607 X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Carlton Cc: gdb-patches@sources.redhat.com Subject: Re: [rfa/testsuite] gdb.base/selftest.exp: work with optimization References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-12/txt/msg00621.txt.bz2 Approved. Fernando David Carlton wrote: > I recently happened to compare the outputs of gdb.base/selftest.exp > when GDB is compiled with and without optimization, and noticed that > it failed only in the optimized case. Digging further, it happens > during the part of the test that steps through captured_main; when GDB > is compiled with optimization, GDB sometimes stops on the opening > brace. That's not an error, but the regexps in question didn't allow > that. > > When I added a regexp to allow that, I found that GDB also sometimes > stopped on the line 'current_directory = gdb_dirbuf', even though it's > after the dirarg initialization line that we're looking for. This > looks like a reordering by the optimizer (or perhaps misleading > location information from the optimizer), so it's not a GDB bug > either. > > Here's a patch to selftest.exp to allow those possibilities; with this > patch, all the tests in that file pass whether or not GDB is compiled > with optimization. > > David Carlton > carlton@math.stanford.edu > > 2002-12-11 David Carlton > > * gdb.base/selftest.exp (do_steps_and_nexts): Allow initial brace > and current_directory initialization. > > Index: selftest.exp > =================================================================== > RCS file: /cvs/src/src/gdb/testsuite/gdb.base/selftest.exp,v > retrieving revision 1.5 > diff -u -p -r1.5 selftest.exp > --- selftest.exp 4 Dec 2002 03:15:27 -0000 1.5 > +++ selftest.exp 11 Dec 2002 21:08:19 -0000 > @@ -54,6 +54,10 @@ proc do_steps_and_nexts {} { > > for {set count 0} {$count < 26} {incr count} { > send_gdb "list\n" > + # NOTE: carlton/2002-12-11: The "initial brace" and > + # "current_directory initialization" possibilities happen to > + # me with GCC 3.1 on i686-pc-linux-gnu when I compile with > + # optimization. > gdb_expect { > -re ".*context = data.*$gdb_prompt $" { > set description "step over context initialization" > @@ -157,6 +161,14 @@ proc do_steps_and_nexts {} { > -re ".*textdomain .PACKAGE.;.*$gdb_prompt $" { > set description "next over textdomain PACKAGE" > set command "next" > + } > + -re "\[0-9\]*\t\{\r\n$gdb_prompt $" { > + set description "step over initial brace" > + set command "step" > + } > + -re ".*current_directory = gdb_dirbuf.*$gdb_prompt $" { > + set description "step over current_directory initialization" > + set command "step" > } > -re "\[ \t\]+\{\r\n$gdb_prompt $" { > setup_xfail "mips-*-irix5*" > -- Fernando Nasser Red Hat Canada Ltd. E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9