CGO and setjmp/longjmp

220 views
Skip to first unread message

alanct...@gmail.com

unread,
Feb 19, 2016, 5:12:14 PM2/19/16
to golang-nuts
I'm seeing some frustrating behaviour trying to write a Golang wrapper for an older C codebase that uses setjmp/longjmp for exception handling - and I'm on Windows. Hooray. There are two issues, one still open, but neither lines up with what I'm seeing: https://github.com/golang/go/issues/9754 and https://github.com/golang/go/issues/13672.

The setjmp/longjmp pair always happens within a single cgo call - I'm not trying to call a C method and then jump back to it with Go in the middle.

There are a few methods in the codebase which are almost identical - some of them can always successfully longjmp, but others always stacktrace.

Changing the codebase (by adding printf statements, for example) will cause the methods which always succeed to always fail - maybe it's an issue with the layout of the PE binary?

Does it make sense that the position of a method within the binary would cause longjmp to fail? 

Can someone recommend a tool for disassembling the binaries and comparing the methods which fail and succeed?

Thanks,
Alan
Reply all
Reply to author
Forward
0 new messages