Commit c40480dd authored by Russ Cox's avatar Russ Cox

runtime: print up to 10 words of arguments

The old limit of 5 was chosen because we didn't actually know how
many bytes of arguments there were; 5 was a halfway point between
printing some useful information and looking ridiculous.

Now we know how many bytes of arguments there are, and we stop
the printing when we reach that point, so the "looking ridiculous" case
doesn't happen anymore: we only print actual argument words.
The cutoff now serves only to truncate very long (but real) argument lists.

In multiple debugging sessions recently (completely unrelated bugs)
I have been frustrated by not seeing more of the long argument lists:
5 words is only 2.5 interface values or strings, and not even 2 slices.
Double the max amount we'll show.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews, iant, r
https://golang.org/cl/83850043
parent 059c10b5
...@@ -156,7 +156,7 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip, ...@@ -156,7 +156,7 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip,
tracepc -= sizeof(uintptr); tracepc -= sizeof(uintptr);
runtime·printf("%s(", runtime·funcname(f)); runtime·printf("%s(", runtime·funcname(f));
for(i = 0; i < frame.arglen/sizeof(uintptr); i++) { for(i = 0; i < frame.arglen/sizeof(uintptr); i++) {
if(i >= 5) { if(i >= 10) {
runtime·prints(", ..."); runtime·prints(", ...");
break; break;
} }
......
...@@ -217,7 +217,7 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip, ...@@ -217,7 +217,7 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip,
tracepc--; tracepc--;
runtime·printf("%s(", runtime·funcname(f)); runtime·printf("%s(", runtime·funcname(f));
for(i = 0; i < frame.arglen/sizeof(uintptr); i++) { for(i = 0; i < frame.arglen/sizeof(uintptr); i++) {
if(i >= 5) { if(i >= 10) {
runtime·prints(", ..."); runtime·prints(", ...");
break; break;
} }
......
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