mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: repair gdb printing fix for 7.12, 8.{1,2,3}.1, 9.2
Hand-verified for listed gdb versions. Gdb (apparently) changed the way it names certain Go types, and this change broke the pretty-printer-activating code in runtime-gdb.py runtime-gdb_test.go now checks channel, map, string, and slice printing unconditionally (i.e., no opt-out for old versions). Updates #39368. Change-Id: I98d72e1291c66bd40d970990e1a377ff2ed0c5d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/236164 Run-TryBot: David Chase <drchase@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
9e56bcb9fe
commit
3949cae441
2 changed files with 28 additions and 21 deletions
|
|
@ -55,9 +55,7 @@ func checkGdbEnvironment(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// checkGdbVersion ensures gdb version is supported, and returns major version
|
||||
// to allow testing conditional on gdb version.
|
||||
func checkGdbVersion(t *testing.T) int {
|
||||
func checkGdbVersion(t *testing.T) {
|
||||
// Issue 11214 reports various failures with older versions of gdb.
|
||||
out, err := exec.Command("gdb", "--version").CombinedOutput()
|
||||
if err != nil {
|
||||
|
|
@ -77,7 +75,6 @@ func checkGdbVersion(t *testing.T) int {
|
|||
t.Skipf("skipping: gdb version %d.%d too old", major, minor)
|
||||
}
|
||||
t.Logf("gdb version %d.%d", major, minor)
|
||||
return major
|
||||
}
|
||||
|
||||
func checkGdbPython(t *testing.T) {
|
||||
|
|
@ -170,7 +167,7 @@ func testGdbPython(t *testing.T, cgo bool) {
|
|||
|
||||
checkGdbEnvironment(t)
|
||||
t.Parallel()
|
||||
gdbMajor := checkGdbVersion(t)
|
||||
checkGdbVersion(t)
|
||||
checkGdbPython(t)
|
||||
|
||||
dir, err := ioutil.TempDir("", "go-build")
|
||||
|
|
@ -319,16 +316,14 @@ func testGdbPython(t *testing.T, cgo bool) {
|
|||
t.Fatalf("print slicemap failed: %s", bl)
|
||||
}
|
||||
|
||||
if gdbMajor > 7 {
|
||||
chanIntSfx := `chan int = {99, 11}`
|
||||
if bl := strings.ReplaceAll(blocks["print chanint"], " ", " "); !strings.HasSuffix(bl, chanIntSfx) {
|
||||
t.Fatalf("print chanint failed: %s", bl)
|
||||
}
|
||||
chanIntSfx := `chan int = {99, 11}`
|
||||
if bl := strings.ReplaceAll(blocks["print chanint"], " ", " "); !strings.HasSuffix(bl, chanIntSfx) {
|
||||
t.Fatalf("print chanint failed: %s", bl)
|
||||
}
|
||||
|
||||
chanStrSfx := `chan string = {"spongepants", "squarebob"}`
|
||||
if bl := strings.ReplaceAll(blocks["print chanstr"], " ", " "); !strings.HasSuffix(bl, chanStrSfx) {
|
||||
t.Fatalf("print chanstr failed: %s", bl)
|
||||
}
|
||||
chanStrSfx := `chan string = {"spongepants", "squarebob"}`
|
||||
if bl := strings.ReplaceAll(blocks["print chanstr"], " ", " "); !strings.HasSuffix(bl, chanStrSfx) {
|
||||
t.Fatalf("print chanstr failed: %s", bl)
|
||||
}
|
||||
|
||||
strVarRe := regexp.MustCompile(`^\$[0-9]+ = (0x[0-9a-f]+\s+)?"abc"$`)
|
||||
|
|
@ -407,7 +402,7 @@ func TestGdbBacktrace(t *testing.T) {
|
|||
|
||||
checkGdbEnvironment(t)
|
||||
t.Parallel()
|
||||
_ = checkGdbVersion(t)
|
||||
checkGdbVersion(t)
|
||||
|
||||
dir, err := ioutil.TempDir("", "go-build")
|
||||
if err != nil {
|
||||
|
|
@ -481,7 +476,7 @@ func main() {
|
|||
func TestGdbAutotmpTypes(t *testing.T) {
|
||||
checkGdbEnvironment(t)
|
||||
t.Parallel()
|
||||
_ = checkGdbVersion(t)
|
||||
checkGdbVersion(t)
|
||||
|
||||
if runtime.GOOS == "aix" && testing.Short() {
|
||||
t.Skip("TestGdbAutotmpTypes is too slow on aix/ppc64")
|
||||
|
|
@ -554,7 +549,7 @@ func main() {
|
|||
func TestGdbConst(t *testing.T) {
|
||||
checkGdbEnvironment(t)
|
||||
t.Parallel()
|
||||
_ = checkGdbVersion(t)
|
||||
checkGdbVersion(t)
|
||||
|
||||
dir, err := ioutil.TempDir("", "go-build")
|
||||
if err != nil {
|
||||
|
|
@ -621,7 +616,7 @@ func crash() {
|
|||
func TestGdbPanic(t *testing.T) {
|
||||
checkGdbEnvironment(t)
|
||||
t.Parallel()
|
||||
_ = checkGdbVersion(t)
|
||||
checkGdbVersion(t)
|
||||
|
||||
dir, err := ioutil.TempDir("", "go-build")
|
||||
if err != nil {
|
||||
|
|
@ -699,7 +694,7 @@ func TestGdbInfCallstack(t *testing.T) {
|
|||
}
|
||||
|
||||
t.Parallel()
|
||||
_ = checkGdbVersion(t)
|
||||
checkGdbVersion(t)
|
||||
|
||||
dir, err := ioutil.TempDir("", "go-build")
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue