github.com/miolini/go@v0.0.0-20160405192216-fca68c8cb408/src/runtime/cgo/gcc_traceback.c (about) 1 // Copyright 2016 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // +build cgo 6 // +build linux 7 8 #include <stdint.h> 9 10 struct cgoTracebackArg { 11 uintptr_t Context; 12 uintptr_t* Buf; 13 uintptr_t Max; 14 }; 15 16 // Call the user's traceback function and then call sigtramp. 17 // The runtime signal handler will jump to this code. 18 // We do it this way so that the user's traceback function will be called 19 // by a C function with proper unwind info. 20 void 21 x_cgo_callers(uintptr_t sig, void *info, void *context, void (*cgoTraceback)(struct cgoTracebackArg*), uintptr_t* cgoCallers, void (*sigtramp)(uintptr_t, void*, void*)) { 22 struct cgoTracebackArg arg; 23 24 arg.Context = 0; 25 arg.Buf = cgoCallers; 26 arg.Max = 32; // must match len(runtime.cgoCallers) 27 (*cgoTraceback)(&arg); 28 sigtramp(sig, info, context); 29 }