From: "Maciej W. Rozycki" <macro@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH] GDB/testsuite: Add a way to send multiple init commands
Date: Tue, 10 Jun 2014 18:24:00 -0000 [thread overview]
Message-ID: <alpine.DEB.1.10.1406091614210.3047@tp.orcam.me.uk> (raw)
Hi,
We've been using this change since time immemorial, in fact our recorded
original internal ChangeLog entry date is 2005-08-15. I've thought this
piece might be useful for other people so I'm sharing it here.
Right now we provide a board info entry, `gdb_init_command', that allows
one to send a single command to GDB before the program to be debugged is
started. This is useful e.g. for slow remote targets to change the
default "remotetimeout" setting. Occasionally I found a need to send
multiple commands instead, however this cannot be achieved with
`gdb_init_command'.
This change therefore extends the mechanism by adding a TCL list of GDB
commands to send, via a board info entry called `gdb_init_commands'.
There is no limit as to the number of commands put there. The old
`gdb_init_command' mechanism remains supported for compatibility with
existing people's environments. I have a separate change for DejaGNU too,
being posted right away, that adds an `add_board_info' procedure that
makes it easy to append entries there; it's not strictly needed here or
anywhere in our testsuite though.
There's nothing really to regression-test here, beside checking that TCL
doesn't choke on it (it doesn't), it's worked for me in real uses for
years too. OK to apply?
2014-06-10 Maciej W. Rozycki <macro@mips.com>
Maciej W. Rozycki <macro@codesourcery.com>
* lib/gdb.exp (gdb_run_cmd): Process `gdb_init_commands'.
* lib/mi-support.exp (mi_run_cmd): Process `gdb_init_commands'.
Maciej
gdb-init-commands.diff
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";
+ gdb_expect 30 {
+ -re "$gdb_prompt $" { }
+ default {
+ perror "gdb_init_command for target failed";
+ return;
+ }
+ }
+ }
+ }
if $use_gdb_stub {
if [target_info exists gdb,do_reload_on_run] {
Index: gdb-fsf-trunk-quilt/gdb/testsuite/lib/mi-support.exp
===================================================================
--- gdb-fsf-trunk-quilt.orig/gdb/testsuite/lib/mi-support.exp 2014-06-03 15:23:23.000000000 +0100
+++ gdb-fsf-trunk-quilt/gdb/testsuite/lib/mi-support.exp 2014-06-06 15:05:05.867648960 +0100
@@ -869,6 +869,19 @@ proc mi_run_cmd_full {use_mi_command arg
}
}
}
+ 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";
+ gdb_expect 30 {
+ -re "$mi_gdb_prompt$" { }
+ default {
+ perror "gdb_init_command for target failed";
+ return -1;
+ }
+ }
+ }
+ }
if { [mi_gdb_target_load] < 0 } {
return -1
next reply other threads:[~2014-06-10 18:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-10 18:24 Maciej W. Rozycki [this message]
2014-06-10 18:52 ` Keith Seitz
2014-06-11 15:39 ` Tom Tromey
2014-06-11 18:41 ` Maciej W. Rozycki
2014-06-19 23:39 ` [PING][PATCH] " Maciej W. Rozycki
2014-06-20 7:14 ` Eli Zaretskii
2014-06-20 22:53 ` Maciej W. Rozycki
2014-06-21 7:14 ` Eli Zaretskii
2014-06-23 14:03 ` Joel Brobecker
2014-06-20 8:50 ` [PATCH] " Pedro Alves
2014-07-10 0:17 ` [PATCH v2] " Maciej W. Rozycki
2014-07-10 16:15 ` Pedro Alves
2014-07-12 4:38 ` Maciej W. Rozycki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.1.10.1406091614210.3047@tp.orcam.me.uk \
--to=macro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox