142
// Test that the stack can be unwound through a call out and call back
144
func testCallbackCallers(t *testing.T) {
145
if runtime.Compiler != "gc" {
146
// The exact function names are not going to be the same.
147
t.Skip("skipping for non-gc toolchain")
149
pc := make([]uintptr, 100)
153
"runtime.cgocallbackg",
154
"runtime.cgocallback_gofunc",
157
"test._Cfunc_callback",
159
"test.testCallbackCallers",
160
"test.TestCallbackCallers",
165
n = runtime.Callers(2, pc)
168
t.Errorf("expected %d frames, got %d", len(name), n)
170
for i := 0; i < n; i++ {
171
f := runtime.FuncForPC(pc[i])
173
t.Fatalf("expected non-nil Func for pc %p", pc[i])
176
// Remove the prepended pathname from automatically
177
// generated cgo function names.
178
if strings.HasPrefix(fname, "_") {
179
fname = path.Base(f.Name()[1:])
181
if fname != name[i] {
182
t.Errorf("expected function name %s, got %s", name[i], fname)