-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/crashmonitor: adjust trap frames
Typically all frames in the middle of a stack trace are calls, and report the "return PC". That is, the instruction following the CALL where the callee will eventually return to. runtime.CallersFrames is aware of this property and will decrement each PC by 1 to "back up" to the location of the CALL, which is the actual line number the user expects. This does not work for traps (such as a SIGSEGV), as a trap is not a call, so the reported PC is not the return PC, but the actual PC of the trap. runtime.Callers is aware of this and will intentionally increment trap PCs in order to correct for the decrement performed by runtime.CallersFrames. See runtime.tracebackPCs and runtume.(*unwinder).symPC. We must emulate the same behavior, otherwise we will report the location of the instruction immediately prior to the trap, which may be on a different line, or even a different inlined functions. Fixes golang/go#70637. Change-Id: I7cd6ffe783a81aa91dcdca313d910341c0bb0440 Reviewed-on: https://go-review.googlesource.com/c/telemetry/+/637755 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
- Loading branch information
Showing
2 changed files
with
217 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters