testsuite: Persistent gdbserver cleanup
authorMaciej W. Rozycki <macro@codesourcery.com>
Thu, 24 Oct 2013 22:32:30 +0000 (23:32 +0100)
committerTom Tromey <tromey@sourceware.org>
Fri, 25 Oct 2013 14:03:00 +0000 (14:03 +0000)
* lib/gdb.exp (gdb_finish): Send a kill request to `gdbserver'
if in the persistent mode.
* gdb.trace/disconnected-tracing.exp: Reconnect before completion.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.trace/disconnected-tracing.exp
gdb/testsuite/lib/gdb.exp

index 003208dfa6abeda72dc0b2fd037c0080094a732f..40391c9bafc1f77e453906a9fc7cc4ca6c300c1c 100644 (file)
@@ -1,3 +1,9 @@
+2013-10-24  Maciej W. Rozycki  <macro@codesourcery.com>
+
+       * lib/gdb.exp (gdb_finish): Send a kill request to `gdbserver'
+       if in the persistent mode.
+       * gdb.trace/disconnected-tracing.exp: Reconnect before completion.
+
 2013-10-24  Maciej W. Rozycki  <macro@codesourcery.com>
 
        * lib/gdb.exp (gdb_gcore_cmd): Also handle a "Target does not
index 7598d8a7fa03a387b7eaa213e7d9d5ec1051e330..2f443243fb4729b37adb7acde5998dbacf16be42 100644 (file)
@@ -147,3 +147,6 @@ proc disconnected_tfind {  } {
 }
 
 disconnected_tfind
+
+# Reconnect for a clean gdbserver shutdown.
+gdb_reconnect
index e4a613422bbfd80b7d7222ff630f7fc0d9787649..4bfa4b4fe6552bc8c27fdc067544bb7db32ca1d7 100644 (file)
@@ -3612,8 +3612,23 @@ proc gdb_init { args } {
 }
 
 proc gdb_finish { } {
+    global gdbserver_reconnect_p
+    global gdb_prompt
     global cleanfiles
 
+    # Give persistent gdbserver a chance to terminate before GDB is killed.
+    if {[info exists gdbserver_reconnect_p] && $gdbserver_reconnect_p} {
+       send_gdb "kill\n";
+       gdb_expect 10 {
+           -re "y or n" {
+               send_gdb "y\n";
+               exp_continue;
+           }
+           -re "$gdb_prompt $" {
+           }
+       }
+    }
+
     # Exit first, so that the files are no longer in use.
     gdb_exit