Re: [PATCH] GDB/testsuite: Add a way to send multiple init commands

Keith Seitz
2014-06-10T18:52:40Z

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