From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id kv8nAx+/4WkHnh0AWB0awg (envelope-from ) for ; Fri, 17 Apr 2026 01:03:27 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=JVpFgvsf; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id EE22C1E0B1; Fri, 17 Apr 2026 01:03:26 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 4D3E41E0B1 for ; Fri, 17 Apr 2026 01:03:25 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 316814BAD150 for ; Fri, 17 Apr 2026 05:03:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 316814BAD150 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=JVpFgvsf Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 8AC334BA23FA for ; Fri, 17 Apr 2026 05:02:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8AC334BA23FA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8AC334BA23FA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776402174; cv=none; b=mjW/PqFv6yeogiY5/Mh+9rZyjJN9sNymN1CpciAgPlAs7AM2WQlAGvgMGVMiXUPgZMQbMd+1pU+3BR20SHjoqHXvmDpbL0UK68zo+hz4yoAA+LqhpQe4LmXa9P4NeVf3aM5mro0+9aZQMYOYyhv9jcbqaUrNSogft9ejKJUtAXU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776402174; c=relaxed/simple; bh=zzkSLjoYIqMtwWaq9xLMQgR7zO8Ouga9W3yVur6a5LA=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=u2FVxiedI4KArcEc3ABWFYB4iYuGR+5sGlC7dAI+NWWeTvtdpntmCvybZtIYEstjX1c9eZeH+kG6TmwS6O8GKGwyaBD5uGfMFud+Ci4Jz2kkJ8XZr0KRcIPUYaaA93iuK5JtELRvk67y7idihORGJ7D0/I5+3iFINIIJKJChSfc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8AC334BA23FA Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63GH15x9522535; Fri, 17 Apr 2026 05:02:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=pp1; bh=WA53pkub3IqhwokCetPe/SbyR+uNvI xciFCYLdpO2y0=; b=JVpFgvsfUq1J/eQIRjHfeSpPDZYfKL6/xMKCYP8XNxIoWh FtfThwM0nOcyFbsuhJAftF6VgvdsDevpQFWlf+qRZQAQDoUBF+p1wa+XbJpucVcT yRB+FH9PddUYDXtHq+Fpzsa2hDpQ1twk85iJIZTAQjtl9/1M+BHW77r9+XbA8Umo V7obJh5XmgwktVBSYpiEUp2O8m/MeGVYx+vPEtCxIsrH9haBNX5CMpy6J4rVlW1Q E8fCh8fBRX+JmjSsgq4EPsKhpbjWeyTxHR0SdTMNBMFgWP/U1OHryEzBSYOQxDkF nlVnK901mQNAipNePLQbK/c0WIBNki7SrFpxqdqw== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4dh89n0w83-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Apr 2026 05:02:51 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 63H3Awaw003253; Fri, 17 Apr 2026 05:02:50 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4djbh97emv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Apr 2026 05:02:50 +0000 Received: from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com [10.241.53.104]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 63H52mlT32244276 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 17 Apr 2026 05:02:48 GMT Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7A66F58056; Fri, 17 Apr 2026 05:02:48 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5002158069; Fri, 17 Apr 2026 05:02:46 +0000 (GMT) Received: from [9.109.244.166] (unknown [9.109.244.166]) by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP; Fri, 17 Apr 2026 05:02:46 +0000 (GMT) Content-Type: multipart/alternative; boundary="------------22lgkqHxP2jNAM50AGR2DAPf" Message-ID: Date: Fri, 17 Apr 2026 10:32:44 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] gdb/testsuite: Fix skip-tree.exp for PowerPC post-call NOP Content-Language: en-GB To: Andrew Burgess , gdb-patches@sourceware.org Cc: Ulrich.Weigand@de.ibm.com, cel@linux.ibm.com, abhay.k@ibm.com References: <20260415055144.2729164-1-abhay@linux.ibm.com> <875x5qg9kt.fsf@redhat.com> From: Abhay Kandpal In-Reply-To: <875x5qg9kt.fsf@redhat.com> X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE3MDA0NSBTYWx0ZWRfX/3qYm9qeg3ac iQEFCggGcmy9jRKBdYSCwMxu+GIrR7OWqkMn7bM8QD6u1DYYhPjzbKItkgJ5E74JTAjIPgmLgEE bzZgl6eVnOnOQRvI/qlz+Kf8ktpgxHbRlSIYVdzYPyP1gy2WxkfqocOfXOD1lgxwrhfY8Q39Bwz XwvlvD0a+MEgsQrNXsAK1ovujufW6wZbeDgiCRpCY3dLJnQmHVIW2LmcfTcoNthuWBGNWflu3+X pwKUPEeDZ8GQbwclTyaD8kJj/bTjnewp4S1DFADEz4JoKdraO63NCeJObgp+b78tSypwH0qtKzv dnG5dSHSfC5tKR+5Yi8QbWJo2ClOzeY5E83VmucXxCdoWeW+d92BvI/yKyCZG9+6K+7Fp+qTpkZ nElEEIEtlS7H2FyJ/B8D8SqDIB3tqQPQJBvwhp5bou783CWTEpVwDZFm3ovR6fu23zLKgtYcq2E eQN7qnS6Dsr8fzB9uiA== X-Authority-Analysis: v=2.4 cv=eJ4jSnp1 c=1 sm=1 tr=0 ts=69e1befb cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=r77TgQKjGQsHNAKrUKIA:9 a=CCpqsmhAAAAA:8 a=VnNF1IyMAAAA:8 a=20KFwNOVAAAA:8 a=lS0_NObwzt3pvEfrKtQA:9 a=QEXdDO2ut3YA:10 a=iatINRoPdeLgJCPbmJYA:9 a=8XdnNT1935Z0GbMb:21 a=_W_S_7VecoQA:10 a=lqcHg5cX4UMA:10 a=ul9cdbp4aOFLsgKbc677:22 X-Proofpoint-GUID: _RxeCPtgYGtcalpISIX3Xns09V1UjImQ X-Proofpoint-ORIG-GUID: _RxeCPtgYGtcalpISIX3Xns09V1UjImQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_04,2026-04-16_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 clxscore=1015 bulkscore=0 suspectscore=0 spamscore=0 impostorscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604170045 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org This is a multi-part message in MIME format. --------------22lgkqHxP2jNAM50AGR2DAPf Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Andrew, Patch looks good to me. Your approach is better. It's more general and will automatically handle any other architectures that might have similar behavior, not just PowerPC. Please go ahead and push your patch. Thanks for improving on my initial fix and for the Co-Authored-By credit. Regards Abhay Kandpal On 16/04/26 21:51, Andrew Burgess wrote: > Abhay Kandpal writes: > >> The skip-tree.exp test was recently added in commit 5ed98c177f9a >> and fails on PowerPC due to architectural differences in function >> return handling. >> >> On PowerPC64 ELFv2, calls to external functions are followed by a >> `nop` instruction that serves as a placeholder for TOC pointer >> restoration. Since this `nop` typically has no DWARF line entry, >> `finish` reports the call line instead of the next line. >> >> This patch adds a PowerPC-specific `next` command after `finish` in >> skip-tree.exp to advance to the expected source line. This handles >> the architectural difference without changing GDB's core behavior. >> >> Tested on ppc64le, x86_64-linux. > Abhay, > > Thanks for looking at this, and apologies for adding a failing PPC test. > > While I think your proposal is fine, I'd like to suggest the patch below > as an alternative. While your change is PPC specific, the patch below > is more general and works by spotting the 'finish' returns us to the > call line, or the next line. This way, if there are other targets that > have the same problem, they will also be fixed by this patch. > > Would you be OK with me pushing this instead? > > Thanks, > Andrew > > --- > > commit 3feb7845032e48bd010291f80591cead065ece40 > Author: Andrew Burgess > Date: Thu Apr 16 17:55:27 2026 +0200 > > gdb/testsuite fix skip-tree.exp test for PowerPC > > The gdb.base/skip-tree.exp test was added in commit: > > commit 5ed98c177f9a2381fe5c6ab873d05f1e5dcb8f7f > Date: Wed Feb 4 20:31:31 2026 +0000 > > gdb: introduce '**' for skip globs > > This test currently fails on PowerPC due to architectural differences > in function return handling. > > On PowerPC64 ELFv2, calls to external functions are followed by a > `nop` instruction that serves as a placeholder for TOC pointer > restoration. Since this `nop` typically has no DWARF line entry, > `finish` reports the call line instead of the next line. > > This issue was reported here: > > https://inbox.sourceware.org/gdb-patches/20260415055144.2729164-1-abhay@linux.ibm.com > > The fix proposed there was to add a PowerPC specific check so that the > test would send a `next` command after using `finish` to advance to > the expected source line. > > This commit actually takes a more general approach. After calling > `finish` we check which line we ended up on. If it was the caller > line then we send GDB a `next` to move to the expected line. If we > arrive directly at the next line, then no `next` is needed. > > I've tested this change on x86-64, where no `next` is needed, and > PowerPC, where `next` is now used as required to get the test > passing. > > To simplify the pattern matching in the exp file, I tweaked the source > file slightly. But adding a call to a dummy 'func5' it's now easy to > pattern match as we step through 'func1', 'func2', etc. > > Co-Authored-By: Abhay Kandpal > > diff --git a/gdb/testsuite/gdb.base/skip-tree.c b/gdb/testsuite/gdb.base/skip-tree.c > index 4a254b860b1..3bedc397a85 100644 > --- a/gdb/testsuite/gdb.base/skip-tree.c > +++ b/gdb/testsuite/gdb.base/skip-tree.c > @@ -22,17 +22,26 @@ extern void func4 (void); > > static volatile int global_var; > > +void > +func5 (void) > +{ > + /* Nothing. */ > +} > + > int > main (void) > { > + /* Some filler before the real work starts. */ > ++global_var; > > func1 (); /* In aa/bb/file.c */ > func2 (); /* In cc/bb/file.c */ > func3 (); /* In dd/ee/file.c */ > func4 (); /* In dd/ee/ff/file.c */ > + func5 (); /* Makes exp file simpler. */ > > - ++global_var; /* End marker. */ > + /* Some filler before the function ends. */ > + ++global_var; > > return 0; > } > diff --git a/gdb/testsuite/gdb.base/skip-tree.exp b/gdb/testsuite/gdb.base/skip-tree.exp > index dc93c4cef84..b1d42ffa87e 100644 > --- a/gdb/testsuite/gdb.base/skip-tree.exp > +++ b/gdb/testsuite/gdb.base/skip-tree.exp > @@ -48,7 +48,7 @@ set lineno_f1 [gdb_get_line_number "func1 ();" $srcfile] > set lineno_f2 [gdb_get_line_number "func2 ();" $srcfile] > set lineno_f3 [gdb_get_line_number "func3 ();" $srcfile] > set lineno_f4 [gdb_get_line_number "func4 ();" $srcfile] > -set lineno_end [gdb_get_line_number "End marker" $srcfile] > +set lineno_f5 [gdb_get_line_number "func5 ();" $srcfile] > > # Compile all the source files into DESTFILE. If RELATIVE_FILENAMES > # is true then the compilation is done using relative filenames to the > @@ -139,19 +139,29 @@ proc run_test { file_glob skip_func1 skip_func2 skip_func3 skip_func4 \ > "$::decimal\\s+\\+\\+global_var_$i;"] \ > "step into func$i" > > - # Now finish the function, returning to the caller. > - gdb_test "finish" ".*" \ > - "finish from func$i" > + # Now finish the function, returning to the caller. Some > + # targets, after the finish, will place the inferior back > + # on the calling line. We spot this and issue a 'next' to > + # move forward to the next function call. > + set saw_next_line false > + set saw_previous_line false > + gdb_test_multiple "finish" "finish from func$i" { > + -re -wrap "\r\n$::decimal\\s+func[expr {$i + 1}] \\(\\);\[^\r\n\]*" { > + pass $gdb_test_name > + } > + -re -wrap "\r\n$::decimal\\s+func$i \\(\\);\[^\r\n\]*" { > + # After 'finish' this target reports the inferior > + # as still on the calling line. Use 'next' to > + # prepare for the next test. > + send_gdb "next\n" > + exp_continue > + } > + } > } else { > # After skipping the function, on which line should we > # stop, and what does the line look like. > - if { $j < 5 } { > - set lineno [set "::lineno_f$j"] > - set after_skip_re "func$j \\(\\);\[^\r\n\]+" > - } else { > - set lineno $::lineno_end > - set after_skip_re "\\+\\+global_var;\[^\r\n\]+" > - } > + set lineno [set "::lineno_f$j"] > + set after_skip_re "func$j \\(\\);\[^\r\n\]+" > > # Step the inferior, we expect to skip the function. > gdb_test "step" \ > --------------22lgkqHxP2jNAM50AGR2DAPf Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
Hi Andrew,

Patch looks good to me. Your approach is better.  
It's more general and will automatically handle any other architectures that might have similar behavior, not just PowerPC.
Please go ahead and push your patch. Thanks for improving on my initial fix and for the Co-Authored-By credit.

Regards
Abhay Kandpal


On 16/04/26 21:51, Andrew Burgess wrote:
Abhay Kandpal <abhay@linux.ibm.com> writes:
The skip-tree.exp test was recently added in commit 5ed98c177f9a
and fails on PowerPC due to architectural differences in function
return handling.

On PowerPC64 ELFv2, calls to external functions are followed by a
`nop` instruction that serves as a placeholder for TOC pointer
restoration. Since this `nop` typically has no DWARF line entry,
`finish` reports the call line instead of the next line.

This patch adds a PowerPC-specific `next` command after `finish` in
skip-tree.exp to advance to the expected source line. This handles
the architectural difference without changing GDB's core behavior.

Tested on ppc64le, x86_64-linux.
Abhay,

Thanks for looking at this, and apologies for adding a failing PPC test.

While I think your proposal is fine, I'd like to suggest the patch below
as an alternative.  While your change is PPC specific, the patch below
is more general and works by spotting the 'finish' returns us to the
call line, or the next line.  This way, if there are other targets that
have the same problem, they will also be fixed by this patch.

Would you be OK with me pushing this instead?

Thanks,
Andrew

---

commit 3feb7845032e48bd010291f80591cead065ece40
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Thu Apr 16 17:55:27 2026 +0200

    gdb/testsuite fix skip-tree.exp test for PowerPC
    
    The gdb.base/skip-tree.exp test was added in commit:
    
      commit 5ed98c177f9a2381fe5c6ab873d05f1e5dcb8f7f
      Date:   Wed Feb 4 20:31:31 2026 +0000
    
          gdb: introduce '**' for skip globs
    
    This test currently fails on PowerPC due to architectural differences
    in function return handling.
    
    On PowerPC64 ELFv2, calls to external functions are followed by a
    `nop` instruction that serves as a placeholder for TOC pointer
    restoration. Since this `nop` typically has no DWARF line entry,
    `finish` reports the call line instead of the next line.
    
    This issue was reported here:
    
      https://inbox.sourceware.org/gdb-patches/20260415055144.2729164-1-abhay@linux.ibm.com
    
    The fix proposed there was to add a PowerPC specific check so that the
    test would send a `next` command after using `finish` to advance to
    the expected source line.
    
    This commit actually takes a more general approach.  After calling
    `finish` we check which line we ended up on.  If it was the caller
    line then we send GDB a `next` to move to the expected line.  If we
    arrive directly at the next line, then no `next` is needed.
    
    I've tested this change on x86-64, where no `next` is needed, and
    PowerPC, where `next` is now used as required to get the test
    passing.
    
    To simplify the pattern matching in the exp file, I tweaked the source
    file slightly.  But adding a call to a dummy 'func5' it's now easy to
    pattern match as we step through 'func1', 'func2', etc.
    
    Co-Authored-By: Abhay Kandpal <abhay@linux.ibm.com>

diff --git a/gdb/testsuite/gdb.base/skip-tree.c b/gdb/testsuite/gdb.base/skip-tree.c
index 4a254b860b1..3bedc397a85 100644
--- a/gdb/testsuite/gdb.base/skip-tree.c
+++ b/gdb/testsuite/gdb.base/skip-tree.c
@@ -22,17 +22,26 @@ extern void func4 (void);
 
 static volatile int global_var;
 
+void
+func5 (void)
+{
+  /* Nothing.  */
+}
+
 int
 main (void)
 {
+  /* Some filler before the real work starts.  */
   ++global_var;
 
   func1 ();	/* In aa/bb/file.c */
   func2 ();	/* In cc/bb/file.c */
   func3 ();	/* In dd/ee/file.c */
   func4 ();	/* In dd/ee/ff/file.c */
+  func5 ();	/* Makes exp file simpler.  */
 
-  ++global_var;	/* End marker.  */
+  /* Some filler before the function ends.  */
+  ++global_var;
 
   return 0;
 }
diff --git a/gdb/testsuite/gdb.base/skip-tree.exp b/gdb/testsuite/gdb.base/skip-tree.exp
index dc93c4cef84..b1d42ffa87e 100644
--- a/gdb/testsuite/gdb.base/skip-tree.exp
+++ b/gdb/testsuite/gdb.base/skip-tree.exp
@@ -48,7 +48,7 @@ set lineno_f1 [gdb_get_line_number "func1 ();" $srcfile]
 set lineno_f2 [gdb_get_line_number "func2 ();" $srcfile]
 set lineno_f3 [gdb_get_line_number "func3 ();" $srcfile]
 set lineno_f4 [gdb_get_line_number "func4 ();" $srcfile]
-set lineno_end [gdb_get_line_number "End marker" $srcfile]
+set lineno_f5 [gdb_get_line_number "func5 ();" $srcfile]
 
 # Compile all the source files into DESTFILE.  If RELATIVE_FILENAMES
 # is true then the compilation is done using relative filenames to the
@@ -139,19 +139,29 @@ proc run_test { file_glob skip_func1 skip_func2 skip_func3 skip_func4 \
 		     "$::decimal\\s+\\+\\+global_var_$i;"] \
 		"step into func$i"
 
-	    # Now finish the function, returning to the caller.
-	    gdb_test "finish" ".*" \
-		"finish from func$i"
+	    # Now finish the function, returning to the caller.  Some
+	    # targets, after the finish, will place the inferior back
+	    # on the calling line.  We spot this and issue a 'next' to
+	    # move forward to the next function call.
+	    set saw_next_line false
+	    set saw_previous_line false
+	    gdb_test_multiple "finish" "finish from func$i" {
+		-re -wrap "\r\n$::decimal\\s+func[expr {$i + 1}] \\(\\);\[^\r\n\]*" {
+		    pass $gdb_test_name
+		}
+		-re -wrap "\r\n$::decimal\\s+func$i \\(\\);\[^\r\n\]*" {
+		    # After 'finish' this target reports the inferior
+		    # as still on the calling line.  Use 'next' to
+		    # prepare for the next test.
+		    send_gdb "next\n"
+		    exp_continue
+		}
+	    }
 	} else {
 	    # After skipping the function, on which line should we
 	    # stop, and what does the line look like.
-	    if { $j < 5 } {
-		set lineno [set "::lineno_f$j"]
-		set after_skip_re "func$j \\(\\);\[^\r\n\]+"
-	    } else {
-		set lineno $::lineno_end
-		set after_skip_re "\\+\\+global_var;\[^\r\n\]+"
-	    }
+	    set lineno [set "::lineno_f$j"]
+	    set after_skip_re "func$j \\(\\);\[^\r\n\]+"
 
 	    # Step the inferior, we expect to skip the function.
 	    gdb_test "step" \

--------------22lgkqHxP2jNAM50AGR2DAPf--