TestMemoryProfiler uses a too restrictive pattern that fails to match backtraces that contain two tabs after the function address. That can happen when the formatted addresses are of different length:
0: 0 [1: 2097152] @ 0x1746c 0x134a00 0x13450e 0x134fd8 0x84396 0x84892 0x17526 0x17628 0xf863a 0xbe3d8 # 0x1746b pprof.allocateReflectTransient+0x21 /suse/schwab/src/gcc/n-riscv64/riscv64-suse-linux/libgo/gotest32110/test/mprof_test.go:48 # 0x1349ff ffi_call_asm+0x51 ../../../gcc/libffi/src/riscv/sysv.S:124 # 0x13450d ffi_call_int+0xf7 ../../../gcc/libffi/src/riscv/ffi.c:372 # 0x134fd7 reflect.call+0xab ../../../gcc/libgo/runtime/go-reflect-call.c:232 # 0x84395 reflect.Value.call+0x58d ../../../gcc/libgo/go/reflect/value.go:458 # 0x84891 reflect.Value.Call+0x4b ../../../gcc/libgo/go/reflect/value.go:306 # 0x17525 pprof.allocateReflect+0x4b /suse/schwab/src/gcc/n-riscv64/riscv64-suse-linux/libgo/gotest32110/test/mprof_test.go:53 # 0x17627 runtime_pprof.TestMemoryProfiler+0xf7 /suse/schwab/src/gcc/n-riscv64/riscv64-suse-linux/libgo/gotest32110/test/mprof_test.go:75 # 0xf8639 testing.tRunner+0x89 ../../../gcc/libgo/go/testing/testing.go:777 Andreas. diff --git a/libgo/go/runtime/pprof/mprof_test.go b/libgo/go/runtime/pprof/mprof_test.go index 5d77a1d898..ffa0591de2 100644 --- a/libgo/go/runtime/pprof/mprof_test.go +++ b/libgo/go/runtime/pprof/mprof_test.go @@ -86,26 +86,26 @@ func TestMemoryProfiler(t *testing.T) { tests := []string{ fmt.Sprintf(`%v: %v \[%v: %v\] @ 0x[0-9,a-f x]+ -# 0x[0-9,a-f]+ pprof\.allocatePersistent1K\+0x[0-9,a-f]+ .*/mprof_test\.go:40 -# 0x[0-9,a-f]+ runtime_pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/mprof_test\.go:74 +# 0x[0-9,a-f]+ +pprof\.allocatePersistent1K\+0x[0-9,a-f]+ .*/mprof_test\.go:40 +# 0x[0-9,a-f]+ +runtime_pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/mprof_test\.go:74 `, 32*memoryProfilerRun, 1024*memoryProfilerRun, 32*memoryProfilerRun, 1024*memoryProfilerRun), fmt.Sprintf(`0: 0 \[%v: %v\] @ 0x[0-9,a-f x]+ -# 0x[0-9,a-f]+ pprof\.allocateTransient1M\+0x[0-9,a-f]+ .*/mprof_test.go:21 -# 0x[0-9,a-f]+ runtime_pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/mprof_test.go:72 +# 0x[0-9,a-f]+ +pprof\.allocateTransient1M\+0x[0-9,a-f]+ .*/mprof_test.go:21 +# 0x[0-9,a-f]+ +runtime_pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/mprof_test.go:72 `, (1<<10)*memoryProfilerRun, (1<<20)*memoryProfilerRun), // This should start with "0: 0" but gccgo's imprecise // GC means that sometimes the value is not collected. fmt.Sprintf(`(0|%v): (0|%v) \[%v: %v\] @ 0x[0-9,a-f x]+ -# 0x[0-9,a-f]+ pprof\.allocateTransient2M\+0x[0-9,a-f]+ .*/mprof_test.go:27 -# 0x[0-9,a-f]+ runtime_pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/mprof_test.go:73 +# 0x[0-9,a-f]+ +pprof\.allocateTransient2M\+0x[0-9,a-f]+ .*/mprof_test.go:27 +# 0x[0-9,a-f]+ +runtime_pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/mprof_test.go:73 `, memoryProfilerRun, (2<<20)*memoryProfilerRun, memoryProfilerRun, (2<<20)*memoryProfilerRun), // This should start with "0: 0" but gccgo's imprecise // GC means that sometimes the value is not collected. fmt.Sprintf(`(0|%v): (0|%v) \[%v: %v\] @( 0x[0-9,a-f]+)+ -# 0x[0-9,a-f]+ pprof\.allocateReflectTransient\+0x[0-9,a-f]+ .*/mprof_test.go:48 +# 0x[0-9,a-f]+ +pprof\.allocateReflectTransient\+0x[0-9,a-f]+ .*/mprof_test.go:48 `, memoryProfilerRun, (2<<20)*memoryProfilerRun, memoryProfilerRun, (2<<20)*memoryProfilerRun), } -- 2.18.0 -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."