Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH][gdb/testsuite] Fix control-flow in gdb.reverse/insn-reverse.exp
Date: Mon, 30 Nov 2020 14:13:28 +0100	[thread overview]
Message-ID: <20201130131327.GA9125@delia> (raw)

Hi,

In gdb.reverse/insn-reverse.exp, we have loop containing a call to
gdb_test_multiple, which itself contains a break:
...
  for {} {$count < 500} {incr count} {
    ...
    gdb_test_multiple "x/i \$pc" "" {
      ...
      break
    }
...

On SLE-11 with:
...
$ runtest --version
Expect version is       5.44.1.11
Tcl version is          8.5
Framework version is    1.4.4
...
the break doesn't seem to have the effect of breaking out of the loop.

The break does have the effect of terminating evaluation of the expect clause,
which means we don't set insn_array, after which we run into:
...
ERROR: tcl error sourcing src/gdb/testsuite/gdb.reverse/insn-reverse.exp.
ERROR: can't read "insn_array(5)": no such element in array
...

Any comments?

Thanks,
- Tom

[gdb/testsuite] Fix control-flow in gdb.reverse/insn-reverse.exp

gdb/testsuite/ChangeLog:

2020-11-30  Tom de Vries  <tdevries@suse.de>

	* gdb.reverse/insn-reverse.exp: Don't break inside gdb_test_multiple
	clause.

---
 gdb/testsuite/gdb.reverse/insn-reverse.exp | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/gdb/testsuite/gdb.reverse/insn-reverse.exp b/gdb/testsuite/gdb.reverse/insn-reverse.exp
index 39e276964f..d1fdebf75f 100644
--- a/gdb/testsuite/gdb.reverse/insn-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/insn-reverse.exp
@@ -79,23 +79,27 @@ proc test { func testcase_nr } {
 	set count 0
 	set insn_addr ""
 	for {} {$count < 500} {incr count} {
+	    set prev_insn_addr $insn_addr
+	    set insn_addr ""
 	    gdb_test_multiple "x/i \$pc" "" {
 		-re ".* ($hex) <.*>:\[ \t\]*(.*)\r\n$gdb_prompt $" {
-		    set prev_insn_addr $insn_addr
 		    set insn_addr $expect_out(1,string)
+		    set insn_array($count) $expect_out(2,string)
+		}
+	    }
 
-		    if [expr {$last_insn == $insn_addr}] {
-			break
-		    }
+	    if [expr {$insn_addr == ""}] {
+		break
+	    }
 
-		    if [expr {$prev_insn_addr == $insn_addr}] {
-			# Failed to make progress, might have run into SIGILL.
-			unsupported "no progress at: $expect_out(2,string)"
-			break
-		    }
+	    if [expr {$last_insn == $insn_addr}] {
+		break
+	    }
 
-		    set insn_array($count) $expect_out(2,string)
-		}
+	    if [expr {$prev_insn_addr == $insn_addr}] {
+		# Failed to make progress, might have run into SIGILL.
+		unsupported "no progress at: $expect_out(2,string)"
+		break
 	    }
 
 	    set pre_regs($count) [capture_command_output "info all-registers" ""]

             reply	other threads:[~2020-11-30 13:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 13:13 Tom de Vries [this message]
2020-12-03 20:15 ` Tom Tromey

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=20201130131327.GA9125@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