diff options
| author | Russ Cox <rsc@golang.org> | 2013-10-31 18:15:55 +0000 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2013-10-31 18:15:55 +0000 |
| commit | 2c98a3bc2e733f6973d3153cb28ab456f38cd7f3 (patch) | |
| tree | 21a7fe008acabfd4584dba98a3523e3957099625 /src/pkg/runtime/traceback_arm.c | |
| parent | b88148b9a04e22cc338834ca405fc1333a1bd5d7 (diff) | |
| download | go-2c98a3bc2e733f6973d3153cb28ab456f38cd7f3.tar.xz | |
cmd/5l, runtime: fix divide for profiling tracebacks on ARM
Two bugs:
1. The first iteration of the traceback always uses LR when provided,
which it is (only) during a profiling signal, but in fact LR is correct
only if the stack frame has not been allocated yet. Otherwise an
intervening call may have changed LR, and the saved copy in the stack
frame should be used. Fix in traceback_arm.c.
2. The division runtime call adds 8 bytes to the stack. In order to
keep the traceback routines happy, it must copy the saved LR into
the new 0(SP). Change
SUB $8, SP
into
MOVW 0(SP), R11 // r11 is temporary, for use by linker
MOVW.W R11, -8(SP)
to update SP and 0(SP) atomically, so that the traceback always
sees a saved LR at 0(SP).
Fixes #6681.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/19910044
Diffstat (limited to 'src/pkg/runtime/traceback_arm.c')
| -rw-r--r-- | src/pkg/runtime/traceback_arm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pkg/runtime/traceback_arm.c b/src/pkg/runtime/traceback_arm.c index 02586f036b..341aa20588 100644 --- a/src/pkg/runtime/traceback_arm.c +++ b/src/pkg/runtime/traceback_arm.c @@ -84,7 +84,7 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip, frame.lr = 0; flr = nil; } else { - if(frame.lr == 0) + if((n == 0 && frame.sp < frame.fp) || frame.lr == 0) frame.lr = *(uintptr*)frame.sp; flr = runtime·findfunc(frame.lr); if(flr == nil) { |
