Commit be5d2d44 authored by Keith Randall's avatar Keith Randall

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
parent 0ad2cd00
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment