summaryrefslogtreecommitdiff
path: root/libgo/go/runtime/testdata/testprogcgo/pprof.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/runtime/testdata/testprogcgo/pprof.go')
-rw-r--r--libgo/go/runtime/testdata/testprogcgo/pprof.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/libgo/go/runtime/testdata/testprogcgo/pprof.go b/libgo/go/runtime/testdata/testprogcgo/pprof.go
index c4fde0251ae..9fa5c1b518a 100644
--- a/libgo/go/runtime/testdata/testprogcgo/pprof.go
+++ b/libgo/go/runtime/testdata/testprogcgo/pprof.go
@@ -28,6 +28,9 @@ void cpuHog() {
salt2 = foo;
}
+void cpuHog2() {
+}
+
static int cpuHogCount;
struct cgoTracebackArg {
@@ -39,10 +42,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;
}