public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH][gdb/testsuite] Fix gdb.opt/solib-intra-step.exp with -m32
Date: Mon, 18 Jan 2021 11:44:04 +0100	[thread overview]
Message-ID: <20210118104402.GA31253@delia> (raw)

Hi,

When running test-case gdb.opt/solib-intra-step.exp with target board
unix/-m32, we run into:
...
(gdb) step^M
__x86.get_pc_thunk.bx () at ../sysdeps/i386/crti.S:66^M
66      ../sysdeps/i386/crti.S: No such file or directory.^M
(gdb) FAIL: gdb.opt/solib-intra-step.exp: first-hit (optimized)
...

The thunk is a helper function for PIC, and given that we have line info for
it, we step into.

Fix this by allowing the step into the thunk, and stepping out of it.

Tested on x86_64-linux.

Any comments?

Thanks,
- Tom

[gdb/testsuite] Fix gdb.opt/solib-intra-step.exp with -m32

gdb/testsuite/ChangeLog:

2021-01-18  Tom de Vries  <tdevries@suse.de>

	* gdb.opt/solib-intra-step.exp: Handle stepping into thunk.

---
 gdb/testsuite/gdb.opt/solib-intra-step.exp | 55 +++++++++++++++++++++---------
 1 file changed, 38 insertions(+), 17 deletions(-)

diff --git a/gdb/testsuite/gdb.opt/solib-intra-step.exp b/gdb/testsuite/gdb.opt/solib-intra-step.exp
index 14b34eabd50..ad19895d890 100644
--- a/gdb/testsuite/gdb.opt/solib-intra-step.exp
+++ b/gdb/testsuite/gdb.opt/solib-intra-step.exp
@@ -48,33 +48,54 @@ if ![runto_main] then {
 }
 
 set test "first-hit"
+set state 0
 gdb_test_multiple "step" $test {
-    -re " first-hit .*\r\n$gdb_prompt $" {
-	pass $test
+    -re -wrap " first-hit .*" {
+	gdb_assert { $state != -1 } $test
     }
-    -re " first-retry .*\r\n$gdb_prompt $" {
-	gdb_test "step" " first-hit .*" "first-hit (optimized)"
+    -re -wrap " first-retry .*" {
+	if  { $state != 0 } {
+	    set state -1
+	} else {
+	    set state 1
+	}
+	send_gdb "step\n"
+	exp_continue
+    }
+    -re -wrap "get_pc_thunk.*" {
+	if  { $state != 1 } {
+	    set state -1
+	} else {
+	    set state 2
+	}
+	send_gdb "step\n"
+	exp_continue
     }
 }
 
 set test "second-hit"
+set state 0
 gdb_test_multiple "step" $test {
-    -re " second-hit .*\r\n$gdb_prompt $" {
-	pass $test
+    -re -wrap " second-hit .*" {
+	gdb_assert { $state != -1 } $test
     }
-    -re " first-retry .*\r\n$gdb_prompt $" {
-	set test "second-hit (optimized 1)"
-	gdb_test_multiple "step" $test {
-	    -re " second-hit .*\r\n$gdb_prompt $" {
-		pass $test
-	    }
-	    -re " first-hit .*\r\n$gdb_prompt $" {
-		gdb_test "step" " second-hit .*" "second-hit (optimized 2)"
-	    }
+    -re -wrap " second-retry .*" {
+	if { $state != 0 } {
+	    set state -1
+	} else {
+	    set state 1
 	}
+	send_gdb "step\n"
+	exp_continue
     }
-    -re " second-retry .*\r\n$gdb_prompt $" {
-	gdb_test "step" " second-hit .*" "second-hit (optimized 3)"
+    -re -wrap "get_pc_thunk.*" {
+	if  { $state != 1 } {
+	    set state -1
+	} else {
+	    set state 2
+	}
+	send_gdb "step\n"
+	exp_continue
     }
 }
 

                 reply	other threads:[~2021-01-18 10:44 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=20210118104402.GA31253@delia \
    --to=tdevries@suse.de \
    --cc=gdb-patches@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).