This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] gdb_test_multiple: Fix user code argument processing


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

commit 71c0ee8cb9d7d77e8b480aaad715cc5343737993
Author: Pedro Alves <palves@redhat.com>
Date:   Tue Apr 7 18:19:30 2015 +0100

    gdb_test_multiple: Fix user code argument processing
    
    While teaching gdb_test_multiple to forward "-i" to gdb_expect, I
    found that with:
    
          gdb_test_multiple (...) {
            -i $some_variable -re "..." {}
          }
    
    $some_variable was not getting expanded in the gdb_test_multiple
    caller's scope.  This is a bug inside gdb_test_multiple.  When
    processing an argument in passed in user code, it was appending the
    original argument literally, instead of appending the uplist'ed
    argument.
    
    gdb/testsuite/ChangeLog:
    2015-04-07  Pedro Alves  <palves@redhat.com>
    
            * lib/gdb.exp (gdb_test_multiple): When processing an argument,
    	append the substituted item, not the original item.

Diff:
---
 gdb/testsuite/ChangeLog   | 5 +++++
 gdb/testsuite/lib/gdb.exp | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 82544a0..694b1c8 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
 2015-04-07  Pedro Alves  <palves@redhat.com>
 
+        * lib/gdb.exp (gdb_test_multiple): When processing an argument,
+	append the substituted item, not the original item.
+
+2015-04-07  Pedro Alves  <palves@redhat.com>
+
 	* gdb.base/interrupt.exp: Use gdb_test_multiple instead of
 	gdb_expect.
 
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index e0a03ec..203b8cf 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -730,7 +730,7 @@ proc gdb_test_multiple { command message user_code } {
 	}
 	if { $expecting_arg } {
 	    set expecting_arg 0
-	    lappend processed_code $item
+	    lappend processed_code $subst_item
 	    continue
 	}
 	if { $expecting_action } {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]