]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix traceback of crash before LR is stored
authorRuss Cox <rsc@golang.org>
Mon, 2 Mar 2015 02:29:25 +0000 (21:29 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 2 Mar 2015 05:32:05 +0000 (05:32 +0000)
This fixes runtime's TestBreakpoint on ppc64:
the Breakpoint frame was not showing up in the trace.

It seems like f.frame should be either the frame size
including the saved LR (if any) or the frame size
not including the saved LR.

On ppc64, f.frame is the frame size not including the saved LR.

On arm, f.frame is the frame size not including the saved LR,
except when that's -4, f.frame is 0 instead.

The code here in the runtime expects that f.frame is the frame
size including the saved LR.

Since all three disagree and nothing else uses f.frame anymore,
stop using it here too. Use funcspdelta, which tells us the exact
difference between the FP and SP. If it's zero, LR has not been
saved yet, so the one saved for sigpanic should be recorded.

This fixes TestBreakpoint on both ppc64 and ppc64le.
I don't really understand how it ever worked there.

Change-Id: I2d2c580d5c0252cc8471e828980aeedcab76858d
Reviewed-on: https://go-review.googlesource.com/6430
Reviewed-by: Minux Ma <minux@golang.org>
src/runtime/traceback.go

index 92dddfdb03542d320af098c746e6e7bffcbf105a..c7e3b0b474876d65eb2df186b5c35c1dc8a733d5 100644 (file)
@@ -361,7 +361,7 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
                        frame.fn = f
                        if f == nil {
                                frame.pc = x
-                       } else if f.frame == 0 {
+                       } else if funcspdelta(f, frame.pc) == 0 {
                                frame.lr = x
                        }
                }