]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: avoid potential hang in TestGdbAutotmpTypes
authorPaul E. Murphy <murp@ibm.com>
Thu, 9 Dec 2021 22:09:24 +0000 (16:09 -0600)
committerPaul Murphy <murp@ibm.com>
Tue, 29 Mar 2022 22:06:31 +0000 (22:06 +0000)
If a GC related task preempts between hitting the main.main breakpoint
and stepping, the test program may halt forever waiting on a GC
operation. This happens if gdb is configured to halt other threads
while executing a step.

Configure gdb to continue running all threads during a step by
setting the scheduler-locking option to off.

Fixes #49852

Change-Id: Iacc9732cbd23526bde0a295e6fa8a0d90f733f59
Reviewed-on: https://go-review.googlesource.com/c/go/+/370775
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Cherry Mui <cherryyz@google.com>

src/runtime/runtime-gdb_test.go

index bb76116ee90a7be1494579cf540c22c8abcf9dd1..063b9a7d4524ee11241318e05fc1f6cba8130638 100644 (file)
@@ -500,6 +500,10 @@ func TestGdbAutotmpTypes(t *testing.T) {
        args := []string{"-nx", "-batch",
                "-iex", "add-auto-load-safe-path " + filepath.Join(testenv.GOROOT(t), "src", "runtime"),
                "-ex", "set startup-with-shell off",
+               // Some gdb may set scheduling-locking as "step" by default. This prevents background tasks
+               // (e.g GC) from completing which may result in a hang when executing the step command.
+               // See #49852.
+               "-ex", "set scheduler-locking off",
                "-ex", "break main.main",
                "-ex", "run",
                "-ex", "step",