github.com/c12o16h1/go/src@v0.0.0-20200114212001-5a151c0f00ed/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,darwin cgo,linux 6 7 #include <stdint.h> 8 #include "libcgo.h" 9 10 // Call the user's traceback function and then call sigtramp. 11 // The runtime signal handler will jump to this code. 12 // We do it this way so that the user's traceback function will be called 13 // by a C function with proper unwind info. 14 void 15 x_cgo_callers(uintptr_t sig, void *info, void *context, void (*cgoTraceback)(struct cgoTracebackArg*), uintptr_t* cgoCallers, void (*sigtramp)(uintptr_t, void*, void*)) { 16 struct cgoTracebackArg arg; 17 18 arg.Context = 0; 19 arg.SigContext = (uintptr_t)(context); 20 arg.Buf = cgoCallers; 21 arg.Max = 32; // must match len(runtime.cgoCallers) 22 (*cgoTraceback)(&arg); 23 sigtramp(sig, info, context); 24 }