This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 2/3] test, gcore: move capture_command_output into lib/gdb.exp
- From: Markus Metzger <markus dot t dot metzger at intel dot com>
- To: palves at redhat dot com
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 20 May 2014 14:00:35 +0200
- Subject: [PATCH v2 2/3] test, gcore: move capture_command_output into lib/gdb.exp
- Authentication-results: sourceware.org; auth=none
- References: <1400587236-18836-1-git-send-email-markus dot t dot metzger at intel dot com>
Allow gcore's capture_command_output function to be used by other tests.
2014-05-20 Markus Metzger <markus.t.metzger@intel.com>
testsuite/
* gdb.base/gcore.exp (capture_command_output): Move ...
* lib/gdb.exp (capture_command_output): ... here.
---
gdb/testsuite/gdb.base/gcore.exp | 13 -------------
gdb/testsuite/lib/gdb.exp | 14 ++++++++++++++
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/gdb/testsuite/gdb.base/gcore.exp b/gdb/testsuite/gdb.base/gcore.exp
index 99743a0..c28a9b3 100644
--- a/gdb/testsuite/gdb.base/gcore.exp
+++ b/gdb/testsuite/gdb.base/gcore.exp
@@ -41,19 +41,6 @@ if { ! [ runto_main ] } then {
return -1
}
-proc capture_command_output { command prefix } {
- global gdb_prompt
- global expect_out
-
- set output_string ""
- gdb_test_multiple "$command" "capture_command_output for $command" {
- -re "${command}\[\r\n\]+${prefix}(.*)\[\r\n\]+$gdb_prompt $" {
- set output_string $expect_out(1,string)
- }
- }
- return $output_string
-}
-
gdb_test "break terminal_func" "Breakpoint .* at .*${srcfile}, line .*" \
"set breakpoint at terminal_func"
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 3125e7a..5d6b90c 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4771,5 +4771,19 @@ proc parse_args { argset } {
# number of items expected to be passed into the procedure...
}
+# Capture the output of COMMAND in a string ignoring PREFIX; return that string.
+proc capture_command_output { command prefix } {
+ global gdb_prompt
+ global expect_out
+
+ set output_string ""
+ gdb_test_multiple "$command" "capture_command_output for $command" {
+ -re "${command}\[\r\n\]+${prefix}(.*)\[\r\n\]+$gdb_prompt $" {
+ set output_string $expect_out(1,string)
+ }
+ }
+ return $output_string
+}
+
# Always load compatibility stuff.
load_lib future.exp
--
1.8.3.1