From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3168 invoked by alias); 6 Jun 2014 10:15:26 -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 3154 invoked by uid 89); 6 Jun 2014 10:15:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Jun 2014 10:15:24 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s56AFKQE025094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 6 Jun 2014 06:15:20 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s56AFIXR026554; Fri, 6 Jun 2014 06:15:19 -0400 Message-ID: <539194B5.7090501@redhat.com> Date: Fri, 06 Jun 2014 10:15:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Yao Qi , gdb-patches@sourceware.org Subject: Re: [PATCH] Tweak gdb.base/async.exp References: <1402040654-11738-1-git-send-email-yao@codesourcery.com> In-Reply-To: <1402040654-11738-1-git-send-email-yao@codesourcery.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-06/txt/msg00311.txt.bz2 On 06/06/2014 08:44 AM, Yao Qi wrote: > I see two fails in async.exp on arm-none-eabi target: > > nexti&^M > (gdb) 0x000001ba 14 x = 5; x = 5;^M > completed.^M > FAIL: gdb.base/async.exp: nexti& > finish&^M > Run till exit from #0 0x000001ba in foo () at /scratch/yqi/arm-none-eabi-lite/src/gdb-trunk/gdb/testsuite/gdb.base/async.c:14^M > (gdb) 0x000001e6 in main () at /scratch/yqi/arm-none-eabi-lite/src/gdb-trunk/gdb/testsuite/gdb.base/async.c:32^M > 32 y = foo ();^M > Value returned is $1 = 8^M > completed.^M > FAIL: gdb.base/async.exp: finish& > > The corresponding test is "test_background "nexti&" "" ".*y = 3.*"", > and it assumes that GDB "nexti" into the next source line. It is wrong > on arm. After "nexti", it still stops at the same source line, and it > fails. Note: "nexti" is supposed to skip function calls, but the test isn't actually testing that works. It'd be nice if it did. E.g., we'd add: for (i = 0; i < 2; i++) foo (); and "stepi" the first loop iteration looking for the first address that has a "backtrace" with two frames. The "call/jmp" instruction that nexti& should step over would be the address the program was stopped before the last stepi. We'd run to the address again (for the second iteration), and do a "nexti&", making sure we land on the next instruction, after the call returns. But TBC, since the test doesn't do this today, it's fine to fix it assuming nexti is just like stepi. With in mind ... > +# We may nexti into the same source line or into the next source line. > +# In the former case, the current PC is printed out. We match either > +# of them. > +test_background "nexti&" "" ".*( 0x0*$next_insn_addr|y = 3).*" I'd rather always only check by address. It's simpler and it'd prevent a bug where we should still end on the same line, like on ARM, but nexti steps too much and only stops on the next line. I think we just need to do: - x = 5; x = 5; + x = 5; x = 5; x = 5; in the C file? 'x' is volatile, so that'd always makes us land in the middle of the line. > +# The PC address is displayed if PC is in the middle of a source line. > test_background "finish&" \ > - "Run till exit from #0 foo \\(\\) at.*async.c.*\r\n" \ > + "Run till exit from #0 ($hex in )?foo \\(\\) at.*async.c.*\r\n" \ This can then be unconditional too. > ".*$hex in main \\(\\) at.*async.c.*y = foo \\(\\).*Value returned is.*= 8.*" > > set jump_here [gdb_get_line_number "jump here"] -- Pedro Alves