[go-nuts] Creating a crash dump file with Go and C stack traces

2016-08-30 Thread martin . strenge
Hi, I have a Go executable that uses a shared C library which spawns it own threads. In case of a crash (in Go or C code), I want to dump all stacktraces of all C threads and Go routines into a crash dump file. Go does not handle signals in non-Go threads executing non-Go code, so I have to in

Re: [go-nuts] runtime: split stack overflow

2016-08-29 Thread martin . strenge
> > I'm only talking about changing Darwin. > Sorry, I meant pushing the gcc callee-saved registers in the assembly sigtramp functions (for example in sys_darwin_amd64.s) as it is done in crosscall2. I ran into the issue, that the content in the rbx register was overwritten by the sigfwdgo()

Re: [go-nuts] runtime: split stack overflow

2016-08-29 Thread martin . strenge
> > OK, then perhaps we need setsig in os_darwin.go to set > the sigaction field to a new function, written in assembler, like > sigtramp, but taking just the sigaction arguments. Could you please explain, why it is necessary to use sa_tramp with a custom function instead of using the defau

Re: [go-nuts] runtime: split stack overflow

2016-08-26 Thread martin . strenge
> > Interesting. Maybe we need to change this line in setsig in > runtime/os_darwin.go > *(*uintptr)(unsafe.Pointer(&sa.__sigaction_u)) = fn > to be > *(*uintptr)(unsafe.Pointer(&sa.__sigaction_u)) = > unsafe.Pointer(funcPC(sigtramp)) > That's not possible, the signatures of sa_tr

Re: [go-nuts] runtime: split stack overflow

2016-08-26 Thread martin . strenge
Hi, It took a while to understand what's going on. > I'm not sure which part of the os/signal docs you are thinking of. I'm referring to "Go programs that use cgo or SWIG", last paragraph ("If the Go signal handler is invoked on a non-Go thread not running Go code [...]"). I couldn't get a

Re: [go-nuts] runtime: split stack overflow

2016-08-19 Thread martin . strenge
> > It appears as though the signal handler is somehow not running on the > alternate signal stack. I don't know why that would be, though. I > have no other explanation. You'll have to debug it. > > I can see by the stack pointers, that the alt stack is used on both, Linux and Darwin. But I'm

[go-nuts] runtime: split stack overflow

2016-08-18 Thread martin . strenge
Hi, i'm trying to replace a Go signal handler by a C signal handler and try to call the stored Go handler inside that C handler. It works well on Linux, but on Darwin I receive a "runtime: split stack overflow" exception. Is that supposed to work on OSX? Thanks! Martin Example program: packa