OLD | NEW |
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 "arch_GOARCH.h" | 6 #include "arch_GOARCH.h" |
7 #include "malloc.h" | 7 #include "malloc.h" |
8 #include "funcdata.h" | 8 #include "funcdata.h" |
9 | 9 |
10 void runtime·sigpanic(void); | 10 void runtime·sigpanic(void); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 runtime·throw("unknown caller pc"); | 95 runtime·throw("unknown caller pc"); |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 frame.varp = (byte*)frame.fp; | 99 frame.varp = (byte*)frame.fp; |
100 | 100 |
101 // Derive size of arguments. | 101 // Derive size of arguments. |
102 // Most functions have a fixed-size argument block, | 102 // Most functions have a fixed-size argument block, |
103 // so we can use metadata about the function f. | 103 // so we can use metadata about the function f. |
104 // Not all, though: there are some variadic functions | 104 // Not all, though: there are some variadic functions |
105 » » // in package runtime, and for those we use call-specific | 105 » » // in package runtime and reflect, and for those we use call-spe
cific |
106 // metadata recorded by f's caller. | 106 // metadata recorded by f's caller. |
107 if(callback != nil || printing) { | 107 if(callback != nil || printing) { |
108 frame.argp = (byte*)frame.fp + sizeof(uintptr); | 108 frame.argp = (byte*)frame.fp + sizeof(uintptr); |
109 if(f->args != ArgsSizeUnknown) | 109 if(f->args != ArgsSizeUnknown) |
110 frame.arglen = f->args; | 110 frame.arglen = f->args; |
111 else if(flr == nil) | 111 else if(flr == nil) |
112 frame.arglen = 0; | 112 frame.arglen = 0; |
113 else if(frame.lr == (uintptr)runtime·lessstack) | 113 else if(frame.lr == (uintptr)runtime·lessstack) |
114 frame.arglen = stk->argsize; | 114 frame.arglen = stk->argsize; |
115 else if((i = runtime·funcarglen(flr, frame.lr)) >= 0) | 115 else if((i = runtime·funcarglen(flr, frame.lr)) >= 0) |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 int32 | 238 int32 |
239 runtime·callers(int32 skip, uintptr *pcbuf, int32 m) | 239 runtime·callers(int32 skip, uintptr *pcbuf, int32 m) |
240 { | 240 { |
241 uintptr pc, sp; | 241 uintptr pc, sp; |
242 ········ | 242 ········ |
243 sp = runtime·getcallersp(&skip); | 243 sp = runtime·getcallersp(&skip); |
244 pc = (uintptr)runtime·getcallerpc(&skip); | 244 pc = (uintptr)runtime·getcallerpc(&skip); |
245 | 245 |
246 return runtime·gentraceback(pc, sp, 0, g, skip, pcbuf, m, nil, nil, fals
e); | 246 return runtime·gentraceback(pc, sp, 0, g, skip, pcbuf, m, nil, nil, fals
e); |
247 } | 247 } |
OLD | NEW |