Commit eac6bee7 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

runtime: fix argument printing during traceback

Current code can print more arguments than necessary
and also incorrectly prints "...".
Update #5723.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/10689043
parent 4f2278d4
......@@ -139,14 +139,14 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip,
if(n > 0 && frame.pc > f->entry && !waspanic)
tracepc -= sizeof(uintptr);
runtime·printf("%S(", f->name);
for(i = 0; i < f->args/sizeof(uintptr); i++) {
if(i != 0)
runtime·prints(", ");
runtime·printhex(((uintptr*)frame.argp)[i]);
if(i >= 4) {
for(i = 0; i < frame.arglen/sizeof(uintptr); i++) {
if(i >= 5) {
runtime·prints(", ...");
break;
}
if(i != 0)
runtime·prints(", ");
runtime·printhex(((uintptr*)frame.argp)[i]);
}
runtime·prints(")\n");
runtime·printf("\t%S:%d", f->src, runtime·funcline(f, tracepc));
......
......@@ -142,14 +142,14 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip,
if(n > 0 && frame.pc > f->entry && !waspanic)
tracepc--;
runtime·printf("%S(", f->name);
for(i = 0; i < f->args/sizeof(uintptr); i++) {
if(i != 0)
runtime·prints(", ");
runtime·printhex(((uintptr*)frame.argp)[i]);
if(i >= 4) {
for(i = 0; i < frame.arglen/sizeof(uintptr); i++) {
if(i >= 5) {
runtime·prints(", ...");
break;
}
if(i != 0)
runtime·prints(", ");
runtime·printhex(((uintptr*)frame.argp)[i]);
}
runtime·prints(")\n");
runtime·printf("\t%S:%d", f->src, runtime·funcline(f, tracepc));
......
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