commit | 8e121b1587bd921ea84c7da49cab3f48dc6b8f36 | [log] [tgz] |
---|---|---|
author | Xiangdong Ji <xiangdong.ji@arm.com> | Fri Mar 27 11:04:21 2020 +0000 |
committer | Ian Lance Taylor <iant@golang.org> | Wed Apr 08 03:46:37 2020 +0000 |
tree | 783c23c4aa58b8a916663e5268d777ac7f0f059e | |
parent | 0a820007e70fdd038950f28254c6269cd9588c02 [diff] |
runtime: fix infinite callstack of cgo on arm64 This change adds CFA information to the assembly function 'crosscall1' and reorgnizes its code to establish well-formed prologue and epilogue. It will fix an infinite callstack issue when debugging cgo program with GDB on arm64. Brief root cause analysis: GDB's aarch64 unwinder parses prologue to determine current frame's size and previous PC&SP if CFA information is not available. The unwinder parses the prologue of 'crosscall1' to determine a frame size of 0x10, then turns to its next frame trying to compute its previous PC&SP as they are not saved on current frame's stack as per its 'traditional frame unwind' rules, which ends up getting an endless frame chain like: [callee] : pc:<pc0>, sp:<sp0> crosscall1: pc:<pc1>, sp:<sp0>+0x10 [caller] : pc:<pc1>, sp:<sp0>+0x10+0x10 [caller] : pc:<pc1>, sp:<sp0>+0x10+0x10+0x10 ... GDB fails to detect the 'caller' frame is same as 'crosscall1' and terminate unwinding since SP increases everytime. Fixes #37238 Change-Id: Ia6bd8555828541a3a61f7dc9b94dfa00775ec52a Reviewed-on: https://go-review.googlesource.com/c/go/+/226999 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Official binary distributions are available at https://golang.org/dl/.
After downloading a binary release, visit https://golang.org/doc/install or load doc/install.html in your web browser for installation instructions.
If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source or load doc/install-source.html in your web browser for source installation instructions.
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.