LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include "runtime.h" | 5 #include "runtime.h" |
6 #include "malloc.h" | 6 #include "malloc.h" |
7 | 7 |
8 // This code is also used for the 386 tracebacks. | 8 // This code is also used for the 386 tracebacks. |
9 // Use uintptr for an appropriate word-sized integer. | 9 // Use uintptr for an appropriate word-sized integer. |
10 | 10 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 if(f->frame < sizeof(uintptr)) // assembly functions lie | 92 if(f->frame < sizeof(uintptr)) // assembly functions lie |
93 sp += sizeof(uintptr); | 93 sp += sizeof(uintptr); |
94 else | 94 else |
95 sp += f->frame; | 95 sp += f->frame; |
96 pc = *((uintptr*)sp - 1); | 96 pc = *((uintptr*)sp - 1); |
97 } | 97 } |
98 return n; | 98 return n; |
99 } | 99 } |
100 | 100 |
101 void | 101 void |
102 traceback(byte *pc0, byte *sp, byte *lr, G *g) | 102 traceback(byte *pc0, byte *sp, byte*, G *g) |
103 { | 103 { |
104 gentraceback(pc0, sp, g, 0, nil, 100); | 104 gentraceback(pc0, sp, g, 0, nil, 100); |
105 } | 105 } |
106 | 106 |
107 int32 | 107 int32 |
108 callers(int32 skip, uintptr *pcbuf, int32 m) | 108 callers(int32 skip, uintptr *pcbuf, int32 m) |
109 { | 109 { |
110 byte *pc, *sp; | 110 byte *pc, *sp; |
111 | 111 |
112 // our caller's pc, sp. | 112 // our caller's pc, sp. |
113 sp = (byte*)&skip; | 113 sp = (byte*)&skip; |
114 pc = ·getcallerpc(&skip); | 114 pc = ·getcallerpc(&skip); |
115 | 115 |
116 return gentraceback(pc, sp, g, skip, pcbuf, m); | 116 return gentraceback(pc, sp, g, skip, pcbuf, m); |
117 } | 117 } |
LEFT | RIGHT |