aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2018-07-11 16:58:47 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2018-07-28 20:21:50 +0100
commitc708f4d256f1f1a92310fcb323a108d95d5fd5da (patch)
treec0d2dbead0308d12bb35b78f4b10e072901226c3
parent37cc0caeca4c9a8552370040f4cfeaeceaa03369 (diff)
downloadgdb-c708f4d256f1f1a92310fcb323a108d95d5fd5da.zip
gdb-c708f4d256f1f1a92310fcb323a108d95d5fd5da.tar.gz
gdb-c708f4d256f1f1a92310fcb323a108d95d5fd5da.tar.bz2
gdb: Don't call gdb_load_shlib unless GDB is running
The gdb_load_shlib function will, on remote targets, try to run some GDB commands. This obviously isn't going to work unless GDB is running. The gdb.trace/tspeed.exp test calls gdb_load_shlib before starting GDB. Don't do that. The failure that's triggered is actually DeJaGNU complaining that the variable $use_gdb_stub doesn't exist, this is only created when GDB is started. Something like this should trigger a failure: make check-gdb \ RUNTESTFLAGS="--target_board=remote-gdbserver-on-localhost \ gdb.trace/tspeed.exp" This commit also adds a check to gdb_load_shlib that GDB is running. The check is always performed, so this should catch cases where a GDB developer adds a use of gdb_load_shlib but doesn't test their code with a remote target. gdb/testsuite/ChangeLog: * gdb.trace/tspeed.exp: Only call gdb_load_shlib after gdb has started. * lib/gdb.exp (gdb_load_shlib): Call perror if GDB is not running.
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.trace/tspeed.exp4
-rw-r--r--gdb/testsuite/lib/gdb.exp6
3 files changed, 15 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index f3d212c..671164c 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-28 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gdb.trace/tspeed.exp: Only call gdb_load_shlib after gdb has
+ started.
+ * lib/gdb.exp (gdb_load_shlib): Call perror if GDB is not running.
+
2018-07-28 Tom de Vries <tdevries@suse.de>
* gdb.base/vla-optimized-out-o3-strict.exp: New file.
diff --git a/gdb/testsuite/gdb.trace/tspeed.exp b/gdb/testsuite/gdb.trace/tspeed.exp
index ecd36d2..47a8250 100644
--- a/gdb/testsuite/gdb.trace/tspeed.exp
+++ b/gdb/testsuite/gdb.trace/tspeed.exp
@@ -19,7 +19,6 @@ standard_testfile
set executable $testfile
set ipalib [get_in_proc_agent]
-gdb_load_shlib $ipalib
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
executable [concat {debug nowarnings c} shlib=$ipalib]] != "" } {
@@ -41,6 +40,7 @@ proc prepare_for_trace_test {} {
global executable
clean_restart $executable
+ gdb_load_shlib $ipalib
runto_main
@@ -126,6 +126,8 @@ proc gdb_trace_collection_test {} {
}
clean_restart $executable
+gdb_load_shlib $ipalib
+
runto_main
if { ![gdb_target_supports_trace] } then {
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index aef580b..3e2f755 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4483,6 +4483,12 @@ proc gdb_remote_download {dest fromfile {tofile {}}} {
# Copy the listed library to the target.
proc gdb_load_shlib { file } {
+ global gdb_spawn_id
+
+ if ![info exists gdb_spawn_id] {
+ perror "gdb_load_shlib: GDB is not running"
+ }
+
set dest [gdb_remote_download target [shlib_target_file $file]]
if {[is_remote target]} {