This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] GDB/testsuite: Add a way to send multiple init commands
- From: Keith Seitz <keiths at redhat dot com>
- To: "Maciej W. Rozycki" <macro at codesourcery dot com>, gdb-patches at sourceware dot org
- Date: Tue, 10 Jun 2014 11:52:34 -0700
- Subject: Re: [PATCH] GDB/testsuite: Add a way to send multiple init commands
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 1 dot 10 dot 1406091614210 dot 3047 at tp dot orcam dot me dot uk>
On 06/10/2014 11:22 AM, Maciej W. Rozycki wrote:
Index: gdb-fsf-trunk-quilt/gdb/testsuite/lib/gdb.exp
===================================================================
--- gdb-fsf-trunk-quilt.orig/gdb/testsuite/lib/gdb.exp 2014-06-06 15:04:15.000000000 +0100
+++ gdb-fsf-trunk-quilt/gdb/testsuite/lib/gdb.exp 2014-06-06 15:05:05.867648960 +0100
@@ -219,6 +219,19 @@ proc gdb_run_cmd {args} {
}
}
}
+ if [target_info exists gdb_init_commands] {
+ set commands [target_info gdb_init_commands];
+ for { set x 0; } { $x < [llength $commands] } { incr x } {
+ send_gdb "[lindex $commands $x]\n";
The "normal" Tcl idiom for this is foreach:
foreach cmd $commands {
send_gdb $cmd
# ...
+ gdb_expect 30 {
+ -re "$gdb_prompt $" { }
+ default {
+ perror "gdb_init_command for target failed";
+ return;
+ }
+ }
+ }
+ }
Keith