Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arm cannot unwind stack frames through cgo call out and call backs #5124

Closed
lexprfuncall opened this issue Mar 25, 2013 · 2 comments
Closed

Comments

@lexprfuncall
Copy link

A function that calls out into native and calls back into Go should be able to have its
stack unwound by gentraceback.  This works on 386 and amd64 but does not work on arm.

There appear to be 2 problems with the arm that make unwinding impossible.  

The first is that the runtime.cgocallback_gofunc does not abide by the function linkage
convention for the arm.  While the convention expects the return address for a frame to
be stored on the top of the stack, this function stores its return address following the
386 and amd64 convention which stores the return address between the locals and the
args.  When the unwind reaches runtime.cgocallback_gofunc it will find junk on the stack
and terminates prematurely.

The second is that some frames seem to have the wrong size preventing the unwind from
finding the procedure linkage.  One such example is runtime.cgocall.  When the unwind
reaches runtime.cgocall it will miss the word with linkage information by 4 bytes.

I will be adding a test named TestCallbackCallers to the cgo test suite that
demonstrates this issue.
@lexprfuncall
Copy link
Author

Comment 1:

This issue was updated by revision 4cb921b.

This CL fixes first part of the ARM issues and added the unwind test.
R=golang-dev, bradfitz, minux.ma, cshapiro, rsc
CC=golang-dev
https://golang.org/cl/7728045

@lexprfuncall
Copy link
Author

Comment 2:

This issue was closed by revision 8480e6f.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants