From patchwork Wed Jun 11 18:39:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 1444 Received: (qmail 32576 invoked by alias); 11 Jun 2014 18:41:20 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 32492 invoked by uid 89); 11 Jun 2014 18:41:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Jun 2014 18:41:18 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1WunSU-0005i4-3R from Maciej_Rozycki@mentor.com ; Wed, 11 Jun 2014 11:41:14 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 11 Jun 2014 11:41:13 -0700 Received: from localhost (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server (TLS) id 14.2.247.3; Wed, 11 Jun 2014 19:41:11 +0100 Date: Wed, 11 Jun 2014 19:39:42 +0100 From: "Maciej W. Rozycki" To: Tom Tromey CC: Keith Seitz , Eli Zaretskii , Subject: Re: [PATCH] GDB/testsuite: Add a way to send multiple init commands In-Reply-To: <87a99jwj4u.fsf@fleche.redhat.com> Message-ID: References: <87a99jwj4u.fsf@fleche.redhat.com> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 On Wed, 11 Jun 2014, Tom Tromey wrote: > Maciej> 2014-06-10 Maciej W. Rozycki > Maciej> Maciej W. Rozycki > > Maciej> * lib/gdb.exp (gdb_run_cmd): Process `gdb_init_commands'. > Maciej> * lib/mi-support.exp (mi_run_cmd): Process `gdb_init_commands'. > > I like Keith's proposed cleanup. > > Maciej> + set commands [target_info gdb_init_commands]; > > Extraneous ";". There are a few of these. Sigh, it just shows my lack of experience with TCL back in 2005. I've been pondering an update to the change to avoid some code duplication, so given I had to touch it anyway I went ahead and did it. Here's the result. It has been lightly tested with gdb.base/advance.exp, with neither setting defined, with `gdb_init_command' only, with `gdb_init_commands' only having a single element, with `gdb_init_commands' only having two elements and with both `gdb_init_command' and `gdb_init_commands' defined, the latter having two elements. It has been also smoke-tested with gdb.mi/mi-break.exp, with the last arrangement mentioned above only. > I think this patch should also update testsuite/README to document the > new setting. And presumably the old one as well, right? Cc-ing Eli for this part. 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'. 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 {