[binutils-gdb] [gdb/testsuite] Fix gdb.base/sect-cmd.exp

Tom de Vries vries@sourceware.org
Tue Jun 8 08:04:47 GMT 2021


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

commit 25ff4de715741c889efba6340cc3c508113ed2f2
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Jun 8 10:04:44 2021 +0200

    [gdb/testsuite] Fix gdb.base/sect-cmd.exp
    
    With a testsuite setup modified to make expect wait a little bit longer for
    gdb output (see PR27957), I reliably run into:
    ...
    (gdb) FAIL: gdb.base/sect-cmd.exp: set section .text to original \
      address (timeout)
    ...
    
    The problem is a too greedy regexp:
    ...
           -re ".*$address1 \- $address2 is $section_name.*" {
    ...
    which ends up consuming the gdb prompt with the terminating ".*".
    
    Fix this by limiting the regexp to a single line.
    
    Tested on x86_64-linux.
    
    gdb/testsuite/ChangeLog:
    
    2021-06-08  Tom de Vries  <tdevries@suse.de>
    
            * gdb.base/sect-cmd.exp: Fix saw_section_address_line regexp.

Diff:
---
 gdb/testsuite/ChangeLog             | 4 ++++
 gdb/testsuite/gdb.base/sect-cmd.exp | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 45040960d0f..a856e890f80 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2021-06-08  Tom de Vries  <tdevries@suse.de>
+
+	* gdb.base/sect-cmd.exp: Fix saw_section_address_line regexp.
+
 2021-06-07  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* gdb.base/continue-all-already-running.exp: Call fail if can't
diff --git a/gdb/testsuite/gdb.base/sect-cmd.exp b/gdb/testsuite/gdb.base/sect-cmd.exp
index 7aa24ca615f..cb1e4464a69 100644
--- a/gdb/testsuite/gdb.base/sect-cmd.exp
+++ b/gdb/testsuite/gdb.base/sect-cmd.exp
@@ -58,7 +58,7 @@ if { $address1 == "" || $address2 == "" || $section_name == "" } {
 set saw_section_address_line false
 gdb_test_multiple "section $section_name $address1" \
     "set section $section_name to original address" {
-	-re ".*$address1 \- $address2 is $section_name.*" {
+	-re ".*$address1 \- $address2 is $section_name in \[^\r\n\]*" {
 	    set saw_section_address_line true
 	    exp_continue
 	}


More information about the Gdb-cvs mailing list