gdb/testsuite: make some tests in gdb.base enable non-stop using GDBFLAGS
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 16 Dec 2020 21:43:18 +0000 (16:43 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 16 Dec 2020 21:46:53 +0000 (16:46 -0500)
For the same reason as explained in commit 7cb2893dfab1 ("gdb/testsuite:
gdb.mi/mi-nonstop-exit.exp: enable non-stop using GDBFLAGS").

Note that the use of

    set GDBFLAGS "$GDBFLAGS ..."

instead of

    append GDBFLAGS "..."

is intentional.  "append" is silent when appending to a non-existent
variable.  So if this code if moved to a proc (as is the case already
for step-sw-breakpoint-adjust-pc.exp) and we forget to add "global
GDBFLAGS", the flag won't be added to the global GDBFLAGS, and we won't
actually enable non-stop, and it might go unnoticed.  Using the "set"
version will turn into an error if we forget the "global".

This makes these test work correctly with native-extended-gdbserver.
Some of them were silently failing because we runto_main is silent when
it fails.

gdb/testsuite/ChangeLog:

* gdb.base/async-shell.exp: Enable non-stop through GDBFLAGS.
* gdb.base/continue-all-already-running.exp: Likewise.
* gdb.base/moribund-step.exp: Likewise.
* gdb.base/step-sw-breakpoint-adjust-pc.exp: Likewise.

Change-Id: I19ef05d07a0ec4a9c9476af2ba6e1ea1159ee437

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/async-shell.exp
gdb/testsuite/gdb.base/continue-all-already-running.exp
gdb/testsuite/gdb.base/moribund-step.exp
gdb/testsuite/gdb.base/step-sw-breakpoint-adjust-pc.exp

index 3a7fc0c9030242a9225d0a69500c0b79c5b7dd7e..e48a6fe0ec1fc13590134b57cedd06646902c3c5 100644 (file)
@@ -1,3 +1,10 @@
+2020-12-16  Simon Marchi  <simon.marchi@efficios.com>
+
+       * gdb.base/async-shell.exp: Enable non-stop through GDBFLAGS.
+       * gdb.base/continue-all-already-running.exp: Likewise.
+       * gdb.base/moribund-step.exp: Likewise.
+       * gdb.base/step-sw-breakpoint-adjust-pc.exp: Likewise.
+
 2020-12-16  Tom de Vries  <tdevries@suse.de>
 
        * gdb.base/batch-preserve-term-settings.exp:
index 001a9ed05a22ae2354912a0757d3a2a2fcecd476..ad7813aac71ba0aaef7dc1911535ccb52a7a5cb5 100644 (file)
@@ -25,13 +25,15 @@ if [use_gdb_stub] {
     return 0
 }
 
-if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } {
-    return -1
+save_vars { GDBFLAGS } {
+    set GDBFLAGS "$GDBFLAGS -ex \"set non-stop on\""
+    if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } {
+       return -1
+    }
 }
 
 set gdbindex_warning_re "warning: Skipping \[^\r\n\]+ \\.gdb_index section \[^\r\n\]*\r\nDo \"set use-deprecated-index-sections on\" before the file is read\r\nto use the section anyway\\."
 
-gdb_test_no_output "set non-stop on"
 gdb_test "run &" "Starting program: \[^\r\n\]*(\r\n$gdbindex_warning_re)?"
 
 # `sleep 5' here would workaround the bug, do not sleep here.
index cfd586ff990635b973050257f7c460cef5150723..39435814d2bf34f9f00a94b953d913bc81e8a8d9 100644 (file)
 
 standard_testfile
 
-if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } {
-    return -1
+save_vars { GDBFLAGS } {
+    set GDBFLAGS "$GDBFLAGS -ex \"set non-stop on\""
+    if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } {
+       return -1
+    }
 }
 
-gdb_test_no_output "set non-stop on"
-
 if ![runto_main] {
     return
 }
index 2e783d3aebba497fa16e93596273bf0b59d6d073..24ffb61b029316e42d2a632c0528a66a02611b9d 100644 (file)
@@ -20,12 +20,13 @@ if { ![support_displaced_stepping] } {
     return -1
 }
 
-if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } {
-    return -1
+save_vars { GDBFLAGS } {
+    set GDBFLAGS "$GDBFLAGS -ex \"set non-stop on\""
+    if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } {
+       return -1
+    }
 }
 
-gdb_test_no_output "set non-stop on"
-
 if ![runto_main] {
     return
 }
index 7b9a02c91be42b4193b0f0092f3117e35639b7cb..528200826bbec227623d8e04a3d9f3a28f73b101 100644 (file)
@@ -32,10 +32,13 @@ proc test {non_stop displaced always_inserted} {
     global binfile
     global linenum_for_user_bp
     global linenum_for_step_resume
+    global GDBFLAGS
 
-    clean_restart $binfile
+    save_vars { GDBFLAGS } {
+       set GDBFLAGS "$GDBFLAGS -ex \"set non-stop $non_stop\""
+       clean_restart $binfile
+    }
 
-    gdb_test_no_output "set non-stop $non_stop"
     gdb_test_no_output "set displaced-stepping $displaced"
     gdb_test_no_output "set breakpoint always-inserted $always_inserted"