Re: [go-nuts] Issue with Adding Exception Vector Handler in Go

2025-01-19 Thread Jason E. Aten
I would strongly advise avoiding unix-signals from CGO. I've done it and can recommend against it (it needs very elaborate signal masking to avoid crashing the Go runtime); it was still very fraught and probably not supported :) Just catch C-side exceptions in C, turn them into strings, pass t

Re: [go-nuts] Issue with Adding Exception Vector Handler in Go

2025-01-19 Thread Robert Engels
After more reading, if you install the vectored exception handler it should work as it can receive the exceptions outside its own stack frames. On Jan 19, 2025, at 7:47 AM, Robert Engels wrote:Read this section: Go handles the exceptions listed otherwise this is the process:Raising an exception c

Re: [go-nuts] Issue with Adding Exception Vector Handler in Go

2025-01-19 Thread Robert Engels
Read this section: Go handles the exceptions listed otherwise this is the process:Raising an exception causes the exception dispatcher to go through the following search for an exception handler:The system first attempts to notify the process's debugger, if any.If the process is not being debugged,

Re: [go-nuts] Issue with Adding Exception Vector Handler in Go

2025-01-19 Thread Robert Engels
You need to install a handler using CGO. When it is not a Go exception it uses “continue” - eventually your handler will be called. You handle it in the native Go and communicate the signal back to Go using a channel of some other means. A lot depends on what you are trying to do and why? Why not j

Re: [go-nuts] Issue with Adding Exception Vector Handler in Go

2025-01-19 Thread rudeus greyrat
I investigated a little bit and got lost :p Basically I raise a windows exception with RaiseException windows API to simulate my exception (https://learn.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-raiseexception) >From what I understand, Go search the exception hand

Re: [go-nuts] Issue with Adding Exception Vector Handler in Go

2025-01-18 Thread rudeus greyrat
I will try to do that later in CGO !! If I remember correctly (tell me if I am wrong) The thing is I noticed when I compile with CGO the binary is much bigger ... So I avoid using CGO whenever it is possible and always try to rely on go assembler and go :) Le samedi 18 janvier 2025 à 19:28:13 U

Re: [go-nuts] Issue with Adding Exception Vector Handler in Go

2025-01-18 Thread robert engels
Rather than modifying the Go runtime, why not install the exception handler using CGO, and then report back to go and fire the signal there using the signals package? Although reading the signals package, https://pkg.go.dev/os/signal I would expect that this exception - since it is unrelated to

[go-nuts] Issue with Adding Exception Vector Handler in Go

2025-01-17 Thread rudeus greyrat
I want to be able to catch windows exception and do stuff with it (mainly for hardware break point later). I created a custom function to add a Vectored Exception Handler using the windows API call AddVectoredExceptionHandler: ``` func AddVEH(myHandler PVECTORED_EXCEPTION_HANDLER) error { ke