1 // Copyright 2018 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
14 register("BadTraceback", BadTraceback
)
18 // Disable GC to prevent traceback at unexpected time.
19 debug
.SetGCPercent(-1)
21 // Run badLR1 on its own stack to minimize the stack size and
22 // exercise the stack bounds logic in the hex dump.
29 // We need two frames on LR machines because we'll smash this
35 func badLR2(arg
int) {
36 // Smash the return PC or saved LR.
37 lrOff
:= unsafe
.Sizeof(uintptr(0))
38 if runtime
.GOARCH
== "ppc64" || runtime
.GOARCH
== "ppc64le" {
39 lrOff
= 32 // FIXED_FRAME or sys.MinFrameSize
41 lrPtr
:= (*uintptr)(unsafe
.Pointer(uintptr(unsafe
.Pointer(&arg
)) - lrOff
))
44 // Print a backtrace. This should include diagnostics for the
45 // bad return PC and a hex dump.