diff options
Diffstat (limited to 'src/runtime/testdata')
| -rw-r--r-- | src/runtime/testdata/testprogcgo/pprof.go | 8 | ||||
| -rw-r--r-- | src/runtime/testdata/testprogcgo/threadpprof.go | 6 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/runtime/testdata/testprogcgo/pprof.go b/src/runtime/testdata/testprogcgo/pprof.go index 4460b9304e..00f2c42e93 100644 --- a/src/runtime/testdata/testprogcgo/pprof.go +++ b/src/runtime/testdata/testprogcgo/pprof.go @@ -26,6 +26,9 @@ void cpuHog() { salt2 = foo; } +void cpuHog2() { +} + static int cpuHogCount; struct cgoTracebackArg { @@ -37,10 +40,13 @@ struct cgoTracebackArg { // pprofCgoTraceback is passed to runtime.SetCgoTraceback. // For testing purposes it pretends that all CPU hits in C code are in cpuHog. +// Issue #29034: At least 2 frames are required to verify all frames are captured +// since runtime/pprof ignores the runtime.goexit base frame if it exists. void pprofCgoTraceback(void* parg) { struct cgoTracebackArg* arg = (struct cgoTracebackArg*)(parg); arg->buf[0] = (uintptr_t)(cpuHog) + 0x10; - arg->buf[1] = 0; + arg->buf[1] = (uintptr_t)(cpuHog2) + 0x4; + arg->buf[2] = 0; ++cpuHogCount; } diff --git a/src/runtime/testdata/testprogcgo/threadpprof.go b/src/runtime/testdata/testprogcgo/threadpprof.go index 3da82961b9..37a2a1ab65 100644 --- a/src/runtime/testdata/testprogcgo/threadpprof.go +++ b/src/runtime/testdata/testprogcgo/threadpprof.go @@ -30,6 +30,9 @@ void cpuHogThread() { threadSalt2 = foo; } +void cpuHogThread2() { +} + static int cpuHogThreadCount; struct cgoTracebackArg { @@ -44,7 +47,8 @@ struct cgoTracebackArg { void pprofCgoThreadTraceback(void* parg) { struct cgoTracebackArg* arg = (struct cgoTracebackArg*)(parg); arg->buf[0] = (uintptr_t)(cpuHogThread) + 0x10; - arg->buf[1] = 0; + arg->buf[1] = (uintptr_t)(cpuHogThread2) + 0x4; + arg->buf[2] = 0; __sync_add_and_fetch(&cpuHogThreadCount, 1); } |
