public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Bruno Larsen <blarsen@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] gdb/testsuite: Update gdb.base/so-impl-ld.exp
Date: Tue, 13 Sep 2022 12:08:15 +0000 (GMT)	[thread overview]
Message-ID: <20220913120815.3D4493865483@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8fa9bc6a030c9a41eb8cf6f0f66043e02005b291

commit 8fa9bc6a030c9a41eb8cf6f0f66043e02005b291
Author: Bruno Larsen <blarsen@redhat.com>
Date:   Wed Jul 20 16:44:37 2022 -0300

    gdb/testsuite: Update gdb.base/so-impl-ld.exp
    
    gdb.base/so-impl-ld.exp was setup assuming that the compiler would add
    epilogue information and that GDB would stop in the } line.  This would
    make clang tests fail like so:
    
     step^M
     solib_main (arg=10000) at ../../../common/git-repos/binutils-gdb/gdb/testsuite/gdb.base/solib1.c:7^M
     7|__  return arg*arg;|__|___/* HERE */^M
     (gdb) PASS: gdb.base/so-impl-ld.exp: step into solib call
     next^M
     main () at ../../../common/git-repos/binutils-gdb/gdb/testsuite/gdb.base/so-impl-ld.c:22^M
     22|_  return 0;^M
     (gdb) FAIL: gdb.base/so-impl-ld.exp: step in solib call
     next^M
     0x00007ffff7cef560 in __libc_start_call_main () from /lib64/libc.so.6^M
     (gdb) FAIL: gdb.base/so-impl-ld.exp: step out of solib call
    
    This patch changes it so solib_main has 2 lines where GDB can stop
    regardless of compiler choices, and updates the exp file to
    generically deal with unknown number of steps until leaving that
    function.

Diff:
---
 gdb/testsuite/gdb.base/so-impl-ld.exp | 13 ++-----------
 gdb/testsuite/gdb.base/solib1.c       |  5 +++--
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/gdb/testsuite/gdb.base/so-impl-ld.exp b/gdb/testsuite/gdb.base/so-impl-ld.exp
index 372b18f3915..3c5d1070a5b 100644
--- a/gdb/testsuite/gdb.base/so-impl-ld.exp
+++ b/gdb/testsuite/gdb.base/so-impl-ld.exp
@@ -56,21 +56,12 @@ gdb_test "step" "solib_main .arg=10000. at.*${libfile}.c:${decimal}.* HERE .*" \
 
 # Verify that we can step within the shlib call.
 #
-gdb_test "next" "${decimal}\[ \t\]*\}.* STEP .*" "step in solib call"
+gdb_test "next" "${decimal}\[ \t\]*return ans;.* STEP .*" "step in solib call"
 
 # Verify that we can step out of the shlib call, and back out into
 # the caller.
 #
-gdb_test_multiple "next" "step out of solib call" {
-    -re "0x\[0-9a-f\]*\[ \t\]*9\[ \t\]*.*$gdb_prompt $" {
-	gdb_test "next" \
-	    "main .. at.*so-impl-ld.c:22.*" \
-	    "step out of solib call"
-    }
-    -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $" {
-	pass "step out of solib call"
-    }
-}
+gdb_step_until ".*main .. at.*return 0;.*" "step out of solib call"
 
 gdb_exit
 return 0
diff --git a/gdb/testsuite/gdb.base/solib1.c b/gdb/testsuite/gdb.base/solib1.c
index 16b72338f26..bf52beec5de 100644
--- a/gdb/testsuite/gdb.base/solib1.c
+++ b/gdb/testsuite/gdb.base/solib1.c
@@ -4,5 +4,6 @@ extern "C"
 int
 solib_main (int arg)
 {
-  return arg*arg;		/* HERE */
-}				/* STEP */
+  int ans = arg*arg;		/* HERE */
+  return ans;			/* STEP */
+}

                 reply	other threads:[~2022-09-13 12:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220913120815.3D4493865483@sourceware.org \
    --to=blarsen@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).