aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib/gdb.exp
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@codesourcery.com>2014-07-12 01:22:25 +0100
committerMaciej W. Rozycki <macro@codesourcery.com>2014-07-12 01:39:40 +0100
commita25eb0280d6ae5a791e0e613f42e3197c82d3030 (patch)
tree7816d90bd5741ce6edbf90953f16833ba7920249 /gdb/testsuite/lib/gdb.exp
parent2836d43109bdad96f14b405b8996011b5f8879a9 (diff)
downloadgdb-a25eb0280d6ae5a791e0e613f42e3197c82d3030.zip
gdb-a25eb0280d6ae5a791e0e613f42e3197c82d3030.tar.gz
gdb-a25eb0280d6ae5a791e0e613f42e3197c82d3030.tar.bz2
gdb/testsuite: Add a way to send multiple init commands
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. * lib/gdb-utils.exp: New file. * lib/gdb.exp (gdb_run_cmd): Call gdb_init_commands, replacing inline `gdb_init_command' processing. (gdb_start_cmd): Likewise. * lib/mi-support.exp (mi_run_cmd): Likewise. * README: Document `gdb_init_command' and `gdb_init_commands'.
Diffstat (limited to 'gdb/testsuite/lib/gdb.exp')
-rw-r--r--gdb/testsuite/lib/gdb.exp9
1 files changed, 5 insertions, 4 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 30463a9..3388e1f 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -27,6 +27,7 @@ if {$tool == ""} {
load_lib libgloss.exp
load_lib cache.exp
+load_lib gdb-utils.exp
global GDB
@@ -209,8 +210,8 @@ proc delete_breakpoints {} {
proc gdb_run_cmd {args} {
global gdb_prompt use_gdb_stub
- if [target_info exists gdb_init_command] {
- send_gdb "[target_info gdb_init_command]\n"
+ foreach command [gdb_init_commands] {
+ send_gdb "$command\n"
gdb_expect 30 {
-re "$gdb_prompt $" { }
default {
@@ -311,8 +312,8 @@ proc gdb_run_cmd {args} {
proc gdb_start_cmd {args} {
global gdb_prompt use_gdb_stub
- if [target_info exists gdb_init_command] {
- send_gdb "[target_info gdb_init_command]\n"
+ foreach command [gdb_init_commands] {
+ send_gdb "$command\n"
gdb_expect 30 {
-re "$gdb_prompt $" { }
default {