[PATCH 07/11] [gdb/testsuite] Refactor exception handling in gdb_expect

Tom de Vries <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
Simplify gdb_expect using transparent_uplevel.
---
 gdb/testsuite/lib/gdb.exp | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 2cd2603e39f..479d1229142 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -7531,16 +7531,9 @@ proc gdb_expect { args } {
 	set tmt [get_largest_timeout]
     }
 
-    set code [catch \
-	{uplevel remote_expect host $tmt $expcode} string]
-
-    if {$code == 1} {
-	global errorInfo errorCode
-
-	return -code error -errorinfo $errorInfo -errorcode $errorCode $string
-    } else {
-	return -code $code $string
-    }
+    transparent_uplevel [subst_vars {
+	remote_expect host $tmt $expcode
+    }]
 }
 
 # gdb_expect_list TEST SENTINEL LIST -- expect a sequence of outputs
-- 
2.51.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.