aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2019-05-17 16:38:02 +0100
committerAlan Hayward <alan.hayward@arm.com>2019-05-17 16:38:02 +0100
commit408e9b8b9ebeb854baea9aac52fa8df4d41eb53d (patch)
treee36e2bb0fd1758359e041ffb1ca5f34dfa64c348 /gdb
parentf9e2e39d23495844d998f54a0fccb9d6be7edb0e (diff)
downloadbinutils-408e9b8b9ebeb854baea9aac52fa8df4d41eb53d.zip
binutils-408e9b8b9ebeb854baea9aac52fa8df4d41eb53d.tar.gz
binutils-408e9b8b9ebeb854baea9aac52fa8df4d41eb53d.tar.bz2
testsuite: Create .cmd files for gdb and gdbserver
When spawning gdb or gdbserver create a .cmd file in the test output directory containing the full command line, ensuring the current gdb instance is appended to the files so that they can be quickly matched to the corresponding gdb.in file. gdb/testsuite/ChangeLog: * lib/gdb.exp (default_gdb_spawn): Call gdb_write_cmd_file. (gdb_write_cmd_file): New procedure. * lib/gdbserver-support.exp (gdbserver_start): Call gdbserver_write_cmd_file. (gdbserver_write_cmd_file): New proedure.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/lib/gdb.exp10
-rw-r--r--gdb/testsuite/lib/gdbserver-support.exp11
3 files changed, 29 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index b3cc028..057c71b 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,13 @@
2019-05-17 Alan Hayward <alan.hayward@arm.com>
+ * lib/gdb.exp (default_gdb_spawn): Call gdb_write_cmd_file.
+ (gdb_write_cmd_file): New procedure.
+ * lib/gdbserver-support.exp (gdbserver_start): Call
+ gdbserver_write_cmd_file.
+ (gdbserver_write_cmd_file): New procedure.
+
+2019-05-17 Alan Hayward <alan.hayward@arm.com>
+
* lib/gdb.exp (gdb_unload): Mark Y as an answer.
(delete_breakpoints): Likewise.
(gdb_run_cmd): Likewise.
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index d00f1ce..be90ba9 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1664,6 +1664,7 @@ proc default_gdb_spawn { } {
set use_gdb_stub [target_info exists use_gdb_stub]
verbose "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS"
+ gdb_write_cmd_file "$GDB $INTERNAL_GDBFLAGS $GDBFLAGS"
if [info exists gdb_spawn_id] {
return 0
@@ -6540,5 +6541,14 @@ proc gdb_stdin_log_write { message {type standard} } {
puts -nonewline $in_file "$message"
}
+# Write the command line used to invocate gdb to the cmd file.
+
+proc gdb_write_cmd_file { cmdline } {
+ set logfile [standard_output_file_with_gdb_instance gdb.cmd]
+ set cmd_file [open $logfile w]
+ puts $cmd_file $cmdline
+ catch "close $cmd_file"
+}
+
# Always load compatibility stuff.
load_lib future.exp
diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
index 164a1d1..54aa557 100644
--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -319,6 +319,8 @@ proc gdbserver_start { options arguments } {
append gdbserver_command " $arguments"
}
+ gdbserver_write_cmd_file $gdbserver_command
+
global server_spawn_id
set server_spawn_id [remote_spawn target $gdbserver_command]
@@ -597,3 +599,12 @@ proc gdbserver_debug_enabled { } {
return [expr { $gdbserverdebug == "debug" || $gdbserverdebug == "remote"
|| $gdbserverdebug == "all" }]
}
+
+# Write the command line used to invocate gdbserver to the cmd file.
+
+proc gdbserver_write_cmd_file { cmdline } {
+ set logfile [standard_output_file_with_gdb_instance gdbserver.cmd]
+ set cmd_file [open $logfile w]
+ puts $cmd_file $cmdline
+ catch "close $cmd_file"
+}