mirror of
https://github.com/golang/go
synced 2024-11-12 09:50:21 -07:00
runtime: Print elision message if we skipped frames on traceback.
Fixes bug 7180 R=golang-codereviews, dvyukov CC=golang-codereviews, gri https://golang.org/cl/55810044
This commit is contained in:
parent
0ad2cd004c
commit
be5d2d4432
@ -716,6 +716,11 @@ void runtime·traceback(uintptr pc, uintptr sp, uintptr lr, G* gp);
|
||||
void runtime·tracebackothers(G*);
|
||||
bool runtime·haszeroargs(uintptr pc);
|
||||
bool runtime·topofstack(Func*);
|
||||
enum
|
||||
{
|
||||
// The maximum number of frames we print for a traceback
|
||||
TracebackMaxFrames = 100,
|
||||
};
|
||||
|
||||
/*
|
||||
* external data
|
||||
|
@ -231,6 +231,8 @@ runtime·printcreatedby(G *gp)
|
||||
void
|
||||
runtime·traceback(uintptr pc, uintptr sp, uintptr lr, G *gp)
|
||||
{
|
||||
int32 n;
|
||||
|
||||
if(gp->status == Gsyscall) {
|
||||
// Override signal registers if blocked in system call.
|
||||
pc = gp->syscallpc;
|
||||
@ -240,8 +242,11 @@ runtime·traceback(uintptr pc, uintptr sp, uintptr lr, G *gp)
|
||||
|
||||
// Print traceback. By default, omits runtime frames.
|
||||
// If that means we print nothing at all, repeat forcing all frames printed.
|
||||
if(runtime·gentraceback(pc, sp, lr, gp, 0, nil, 100, nil, nil, false) == 0)
|
||||
runtime·gentraceback(pc, sp, lr, gp, 0, nil, 100, nil, nil, true);
|
||||
n = runtime·gentraceback(pc, sp, lr, gp, 0, nil, TracebackMaxFrames, nil, nil, false);
|
||||
if(n == 0)
|
||||
runtime·gentraceback(pc, sp, lr, gp, 0, nil, TracebackMaxFrames, nil, nil, true);
|
||||
if(n == TracebackMaxFrames)
|
||||
runtime·printf("...additional frames elided...\n");
|
||||
runtime·printcreatedby(gp);
|
||||
}
|
||||
|
||||
|
@ -232,6 +232,8 @@ runtime·printcreatedby(G *gp)
|
||||
void
|
||||
runtime·traceback(uintptr pc, uintptr sp, uintptr lr, G *gp)
|
||||
{
|
||||
int32 n;
|
||||
|
||||
USED(lr);
|
||||
|
||||
if(gp->status == Gsyscall) {
|
||||
@ -242,8 +244,11 @@ runtime·traceback(uintptr pc, uintptr sp, uintptr lr, G *gp)
|
||||
|
||||
// Print traceback. By default, omits runtime frames.
|
||||
// If that means we print nothing at all, repeat forcing all frames printed.
|
||||
if(runtime·gentraceback(pc, sp, 0, gp, 0, nil, 100, nil, nil, false) == 0)
|
||||
runtime·gentraceback(pc, sp, 0, gp, 0, nil, 100, nil, nil, true);
|
||||
n = runtime·gentraceback(pc, sp, 0, gp, 0, nil, TracebackMaxFrames, nil, nil, false);
|
||||
if(n == 0)
|
||||
n = runtime·gentraceback(pc, sp, 0, gp, 0, nil, TracebackMaxFrames, nil, nil, true);
|
||||
if(n == TracebackMaxFrames)
|
||||
runtime·printf("...additional frames elided...\n");
|
||||
runtime·printcreatedby(gp);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user