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.
7 // NOTE(rsc): _CONTEXT_CONTROL is actually 0x200001 and should include PC, SP, and LR.
8 // However, empirically, LR doesn't come along on Windows 10
9 // unless you also set _CONTEXT_INTEGER (0x200002).
10 // Without LR, we skip over the next-to-bottom function in profiles
11 // when the bottom function is frameless.
12 // So we set both here, to make a working _CONTEXT_CONTROL.
13 const _CONTEXT_CONTROL = 0x200003
53 func (c *context) ip() uintptr { return uintptr(c.pc) }
54 func (c *context) sp() uintptr { return uintptr(c.spr) }
55 func (c *context) lr() uintptr { return uintptr(c.lrr) }
57 func (c *context) set_ip(x uintptr) { c.pc = uint32(x) }
58 func (c *context) set_sp(x uintptr) { c.spr = uint32(x) }
59 func (c *context) set_lr(x uintptr) { c.lrr = uint32(x) }
61 // arm does not have frame pointer register.
62 func (c *context) set_fp(x uintptr) {}
64 func prepareContextForSigResume(c *context) {
69 func dumpregs(r *context) {
70 print("r0 ", hex(r.r0), "\n")
71 print("r1 ", hex(r.r1), "\n")
72 print("r2 ", hex(r.r2), "\n")
73 print("r3 ", hex(r.r3), "\n")
74 print("r4 ", hex(r.r4), "\n")
75 print("r5 ", hex(r.r5), "\n")
76 print("r6 ", hex(r.r6), "\n")
77 print("r7 ", hex(r.r7), "\n")
78 print("r8 ", hex(r.r8), "\n")
79 print("r9 ", hex(r.r9), "\n")
80 print("r10 ", hex(r.r10), "\n")
81 print("r11 ", hex(r.r11), "\n")
82 print("r12 ", hex(r.r12), "\n")
83 print("sp ", hex(r.spr), "\n")
84 print("lr ", hex(r.lrr), "\n")
85 print("pc ", hex(r.pc), "\n")
86 print("cpsr ", hex(r.cpsr), "\n")
90 // TODO: not implemented on ARM
93 type _DISPATCHER_CONTEXT struct {
97 establisherFrame uint32
100 languageHandler uintptr
104 func (c *_DISPATCHER_CONTEXT) ctx() *context {