On Tue, Aug 30, 2016 at 6:06 AM, <martin.stre...@gmail.com> wrote: > > From my point of view, a better solution would be, when Go has an option > (maybe via GOTRACEBACK env var) to trace C threads as well, for example by > using the cgo traceback functions introduced in Go 1.7.
I don't see how that would work. The Go code has no idea what C threads exist. I'm not aware of any portable API that would let it determine that. > Also setting a file > descriptor/handle as target for a dump should be allowed (maybe in addition > to the dump on STDERR). To me that sounds like something to be handled when invoking the Go program, e.g., feed stderr into tee. > In addition to the cgo traceback functions, there > might be one or more functions for gathering additional information, which > will be printed in the crash dump. A use case for that would be a list of > loaded modules/libraries or environment variables. > I can imagine that it's easier said than done, but that's what I would > prefer. Calling a user Go function while crashing definitely sounds problematic. If we are crashing because we have run out of memory or because the heap has been corrupted, there isn't anything reasonable that the user function can do. I'm impressed that your code works as well as it sounds, but in general Go is focused on dumping Go state. I can imagine adding another callback, along the lines of SetCgoTraceback, that would provide a C function that would be invoked when crashing, immediately before exiting. Perhaps in dieFromSignal or perhaps in runtime.exit. Would that help your case? If so, please open an issue and we can think about it. Of course such a function would be restricted to async-signal-safe function calls, so I don't know if that would really help. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.