diff options
| author | Russ Cox <rsc@golang.org> | 2014-09-02 15:12:53 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-09-02 15:12:53 -0400 |
| commit | fa2af441f1d7f2daccf40e1e350e8a8bfdcfb9e8 (patch) | |
| tree | 2595445d11d3cb30ff2a2a054178d8311fc7919d /src/pkg/runtime/stack.c | |
| parent | 8e89f87158eb364330e4334d7084e290e07c66a8 (diff) | |
| download | go-fa2af441f1d7f2daccf40e1e350e8a8bfdcfb9e8.tar.xz | |
runtime: convert traceback*.c to Go
The two converted files were nearly identical.
Instead of continuing that duplication, I merged them
into a single traceback.go.
Tested on arm, amd64, amd64p32, and 386.
LGTM=r
R=golang-codereviews, remyoudompheng, dave, r
CC=dvyukov, golang-codereviews, iant, khr
https://golang.org/cl/134200044
Diffstat (limited to 'src/pkg/runtime/stack.c')
| -rw-r--r-- | src/pkg/runtime/stack.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/pkg/runtime/stack.c b/src/pkg/runtime/stack.c index e589d8d443..1f51e667f2 100644 --- a/src/pkg/runtime/stack.c +++ b/src/pkg/runtime/stack.c @@ -477,6 +477,7 @@ copyabletopsegment(G *gp) Func *f; FuncVal *fn; StackMap *stackmap; + bool (*cb)(Stkframe*, void*); if(gp->stackbase == 0) runtime·throw("stackbase == 0"); @@ -486,7 +487,8 @@ copyabletopsegment(G *gp) // Check that each frame is copyable. As a side effect, // count the frames. - runtime·gentraceback(~(uintptr)0, ~(uintptr)0, 0, gp, 0, nil, 0x7fffffff, checkframecopy, &cinfo, false); + cb = checkframecopy; + runtime·gentraceback(~(uintptr)0, ~(uintptr)0, 0, gp, 0, nil, 0x7fffffff, &cb, &cinfo, false); if(StackDebug >= 1 && cinfo.frames != -1) runtime·printf("copystack: %d copyable frames\n", cinfo.frames); @@ -680,8 +682,10 @@ adjustframe(Stkframe *frame, void *arg) // adjust inargs and outargs if(frame->arglen != 0) { stackmap = runtime·funcdata(f, FUNCDATA_ArgsPointerMaps); - if(stackmap == nil) + if(stackmap == nil) { + runtime·printf("size %d\n", (int32)frame->arglen); runtime·throw("no arg info"); + } bv = runtime·stackmapdata(stackmap, pcdata); if(StackDebug >= 3) runtime·printf(" args\n"); @@ -773,6 +777,7 @@ copystack(G *gp, uintptr nframes, uintptr newsize) AdjustInfo adjinfo; Stktop *oldtop, *newtop; uint32 oldstatus; + bool (*cb)(Stkframe*, void*); if(gp->syscallstack != 0) runtime·throw("can't handle stack copy in syscall yet"); @@ -797,7 +802,8 @@ copystack(G *gp, uintptr nframes, uintptr newsize) adjinfo.oldstk = oldstk; adjinfo.oldbase = oldbase; adjinfo.delta = newbase - oldbase; - runtime·gentraceback(~(uintptr)0, ~(uintptr)0, 0, gp, 0, nil, nframes, adjustframe, &adjinfo, false); + cb = adjustframe; + runtime·gentraceback(~(uintptr)0, ~(uintptr)0, 0, gp, 0, nil, nframes, &cb, &adjinfo, false); // adjust other miscellaneous things that have pointers into stacks. adjustctxt(gp, &adjinfo); |
