1
0
mirror of https://github.com/golang/go synced 2024-11-24 10:30:10 -07:00

runtime: avoid potential hang in TestGdbAutotmpTypes

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>
This commit is contained in:
Paul E. Murphy 2021-12-09 16:09:24 -06:00 committed by Paul Murphy
parent a4a0f9b148
commit dac0220841

View 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",