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: [committed][gdb/testsuite] Simplify gdb.base/info-types.exp.tcl
Date: Mon, 7 Jun 2021 14:34:41 +0200	[thread overview]
Message-ID: <20210607123440.GA8513@delia> (raw)

Hi,

The regexp matching state machine in gdb.base/info-types.exp.tcl handles
"File .*:" lines individually.  Now that we do line-by-line matching, that's
no longer necessary.

Simplify accordingly.

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Simplify gdb.base/info-types.exp.tcl

gdb/testsuite/ChangeLog:

2021-06-07  Tom de Vries  <tdevries@suse.de>

	* gdb.base/info-types.exp.tcl: Remove "File .*" matching from regexp
	matching state machine.

---
 gdb/testsuite/gdb.base/info-types.exp.tcl | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/gdb/testsuite/gdb.base/info-types.exp.tcl b/gdb/testsuite/gdb.base/info-types.exp.tcl
index 0eac3dbe67c..104fdb3a62f 100644
--- a/gdb/testsuite/gdb.base/info-types.exp.tcl
+++ b/gdb/testsuite/gdb.base/info-types.exp.tcl
@@ -89,9 +89,12 @@ proc run_test { lang } {
 	return 0
     }
 
+    set file_re "File .*[string_to_regexp $srcfile]:"
+
     if { $lang == "c++" } {
 	set output_lines \
 	    [list \
+		 $file_re \
 		 "98:\[\t \]+CL;" \
 		 "42:\[\t \]+anon_struct_t;" \
 		 "65:\[\t \]+anon_union_t;" \
@@ -126,6 +129,7 @@ proc run_test { lang } {
     } else {
 	set output_lines \
 	    [list \
+		 $file_re \
 		 "52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \
 		 "45:\[\t \]+typedef struct {\\.\\.\\.} anon_struct_t;" \
 		 "68:\[\t \]+typedef union {\\.\\.\\.} anon_union_t;" \
@@ -160,28 +164,20 @@ proc run_test { lang } {
 	    if { $state == 0 } { set state 1 } else { set state -1 }
 	    exp_continue
 	}
-	-re "^\r\nFile .*[string_to_regexp $srcfile]:" {
-	    if { $state == 1 } { set state 2 } else { set state -2 }
-	    exp_continue
-	}
-	-re "^\r\nFile \[^\r\n\]*:" {
-	    if { $state == 2 } { set state -4 }
-	    exp_continue
-	}
 	-re "^\r\n(\[^\r\n\]*)(?=\r\n)" {
-	    if { $state == 2 } {
+	    if { $state == 1 } {
 		set line $expect_out(1,string)
 		set res [match_line $line $output_lines idx]
 		if { $res == 1 } {
-		    set state 3
+		    set state 2
 		} elseif { $res == -1 } {
-		    set state -3
+		    set state -2
 		}
 	    }
 	    exp_continue
 	}
 	-re -wrap "" {
-	    if { $state == 3} {
+	    if { $state == 2} {
 		pass $gdb_test_name
 	    } else {
 		fail "$gdb_test_name (state == $state)"

                 reply	other threads:[~2021-06-07 12:35 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=20210607123440.GA8513@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