From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4894 invoked by alias); 20 Jun 2014 08:50:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 4881 invoked by uid 89); 20 Jun 2014 08:50:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 20 Jun 2014 08:50:14 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5K8o9dd030443 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Jun 2014 04:50:09 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5K8o6PY018701; Fri, 20 Jun 2014 04:50:07 -0400 Message-ID: <53A3F5BD.2030709@redhat.com> Date: Fri, 20 Jun 2014 08:50:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: "Maciej W. Rozycki" , Tom Tromey CC: Keith Seitz , Eli Zaretskii , gdb-patches@sourceware.org Subject: Re: [PATCH] GDB/testsuite: Add a way to send multiple init commands References: <87a99jwj4u.fsf@fleche.redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-06/txt/msg00726.txt.bz2 On 06/11/2014 07:39 PM, Maciej W. Rozycki wrote: > 2014-06-11 Maciej W. Rozycki > Maciej W. Rozycki > > * lib/gdb.exp (gdb_run_cmd): Process `gdb_init_commands'. > * lib/mi-support.exp (mi_run_cmd): Process `gdb_init_commands'. > * README (Board Settings): Document `gdb_init_command' and > `gdb_init_commands'. I don't particularly see much need for this -- I do this in my boards instead: set GDBFLAGS "" set GDBFLAGS "${GDBFLAGS} -ex \"set breakpoint always-inserted on\"" set GDBFLAGS "${GDBFLAGS} -ex \"set target-async 1\"" See: https://sourceware.org/gdb/wiki/TestingGDB#Passing_an_option_to_GDB_.2BAC8_Running_the_whole_test_suite_in_a_non-default_mode But, given gdb_init_command exists and this can be made non-intrusive, it's fine with me to add the new option. Thought, I'd much prefer if this code that appears twice: > + set commands "" > if [target_info exists gdb_init_command] { > - send_gdb "[target_info gdb_init_command]\n" > + lappend commands [target_info gdb_init_command] > + } > + if [target_info exists gdb_init_commands] { > + set commands [concat $commands [target_info gdb_init_commands]] > + } > + foreach command $commands { was factored out to a procedure that returns the command list. Like: # Comment here proc gdb_init_commands {} { set commands {} if [target_info exists gdb_init_command] { lappend commands [target_info gdb_init_command] } if [target_info exists gdb_init_commands] { set commands [concat $commands [target_info gdb_init_commands]] } return commands } And then, both users can do foreach command [gdb_init_commands] { -- Pedro Alves > > Maciej > > gdb-init-commands.diff > Index: gdb-fsf-trunk-quilt/gdb/testsuite/README > =================================================================== > --- gdb-fsf-trunk-quilt.orig/gdb/testsuite/README 2014-06-03 15:23:24.000000000 +0100 > +++ gdb-fsf-trunk-quilt/gdb/testsuite/README 2014-06-11 19:29:49.538972371 +0100 > @@ -271,6 +271,16 @@ gdb,use_precord > > The board supports process record. > > +gdb_init_command > +gdb_init_commands > + > + Commands to send to GDB every time a program is about to be run. The > + first of these settings defines a single command as a string. The > + second defines a TCL list of commands being a string each. The commands > + are sent one by one in a sequence, first from `gdb_init_command', if any, > + followed by individual commands from `gdb_init_command', if any, in this > + list's order. > + > gdb_server_prog > > The location of GDBserver. If GDBserver somewhere other than its > Index: gdb-fsf-trunk-quilt/gdb/testsuite/lib/gdb.exp > =================================================================== > --- gdb-fsf-trunk-quilt.orig/gdb/testsuite/lib/gdb.exp 2014-06-07 18:27:52.000000000 +0100 > +++ gdb-fsf-trunk-quilt/gdb/testsuite/lib/gdb.exp 2014-06-11 19:05:45.388928853 +0100 > @@ -209,8 +209,15 @@ proc delete_breakpoints {} { > proc gdb_run_cmd {args} { > global gdb_prompt use_gdb_stub > > + set commands "" > if [target_info exists gdb_init_command] { > - send_gdb "[target_info gdb_init_command]\n" > + lappend commands [target_info gdb_init_command] > + } > + if [target_info exists gdb_init_commands] { > + set commands [concat $commands [target_info gdb_init_commands]] > + } > + foreach command $commands { > + send_gdb "$command\n" > gdb_expect 30 { > -re "$gdb_prompt $" { } > default { > Index: gdb-fsf-trunk-quilt/gdb/testsuite/lib/mi-support.exp > =================================================================== > --- gdb-fsf-trunk-quilt.orig/gdb/testsuite/lib/mi-support.exp 2014-06-07 18:27:50.000000000 +0100 > +++ gdb-fsf-trunk-quilt/gdb/testsuite/lib/mi-support.exp 2014-06-11 19:06:27.888927573 +0100 > @@ -859,8 +859,15 @@ proc mi_run_cmd_full {use_mi_command arg > set run_match "" > } > > + set commands "" > if [target_info exists gdb_init_command] { > - send_gdb "[target_info gdb_init_command]\n" > + lappend commands [target_info gdb_init_command] > + } > + if [target_info exists gdb_init_commands] { > + set commands [concat $commands [target_info gdb_init_commands]] > + } > + foreach command $commands { > + send_gdb "$command\n" > gdb_expect 30 { > -re "$mi_gdb_prompt$" { } > default { >