struct cgoTracebackArg {
uintptr_t Context;
+ uintptr_t SigContext;
uintptr_t* Buf;
uintptr_t Max;
};
struct cgoTracebackArg arg;
arg.Context = 0;
+ arg.SigContext = (uintptr_t)(context);
arg.Buf = cgoCallers;
arg.Max = 32; // must match len(runtime.cgoCallers)
(*cgoTraceback)(&arg);
// pointer to a struct:
//
// struct {
-// Context uintptr
-// Buf *uintptr
-// Max uintptr
+// Context uintptr
+// SigContext uintptr
+// Buf *uintptr
+// Max uintptr
// }
//
// In C syntax, this struct will be
//
// struct {
// uintptr_t Context;
+// uintptr_t SigContext;
// uintptr_t* Buf;
// uintptr_t Max;
// };
// result, if possible, the first time this is called for a specific
// context value.
//
+// If the traceback function is called from a signal handler on a Unix
+// system, SigContext will be the signal context argument passed to
+// the signal handler (a C ucontext_t* cast to uintptr_t). This may be
+// used to start tracing at the point where the signal occurred. If
+// the traceback function is not called from a signal handler,
+// SigContext will be zero.
+//
// Buf is where the traceback information should be stored. It should
// be PC values, such that Buf[0] is the PC of the caller, Buf[1] is
// the PC of that function's caller, and so on. Max is the maximum
// cgoTracebackArg is the type passed to cgoTraceback.
type cgoTracebackArg struct {
- context uintptr
- buf *uintptr
- max uintptr
+ context uintptr
+ sigContext uintptr
+ buf *uintptr
+ max uintptr
}
// cgoContextArg is the type passed to the context function.