1
0
mirror of https://github.com/golang/go synced 2024-11-23 19:50:06 -07:00

cmd/gc: restore stack frame debugging

Dump frames of functions.
Add function name and var width to output.

Change-Id: Ida06b8def96178fa550ca90836eb4a2509b9e13f
Reviewed-on: https://go-review.googlesource.com/3870
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Dmitry Vyukov 2015-02-04 11:26:22 +03:00
parent ed8cc5cf9b
commit aed88be021
2 changed files with 13 additions and 18 deletions

View File

@ -327,7 +327,7 @@ compile(Node *fn)
defframe(ptxt);
if(0)
if(debug['f'])
frame(0);
// Remove leftover instrumentation from the instruction stream.

View File

@ -1703,36 +1703,31 @@ ptrto(Type *t)
void
frame(int context)
{
char *p;
NodeList *l;
Node *n;
int flag;
vlong w;
p = "stack";
l = nil;
if(curfn)
l = curfn->dcl;
if(context) {
p = "external";
print("--- external frame ---\n");
l = externdcl;
}
} else if(curfn) {
print("--- %S frame ---\n", curfn->nname->sym);
l = curfn->dcl;
} else
return;
flag = 1;
for(; l; l=l->next) {
n = l->n;
w = -1;
if(n->type)
w = n->type->width;
switch(n->op) {
case ONAME:
if(flag)
print("--- %s frame ---\n", p);
print("%O %S G%d %T\n", n->op, n->sym, n->vargen, n->type);
flag = 0;
print("%O %S G%d %T width=%lld\n", n->op, n->sym, n->vargen, n->type, w);
break;
case OTYPE:
if(flag)
print("--- %s frame ---\n", p);
print("%O %T\n", n->op, n->type);
flag = 0;
print("%O %T width=%lld\n", n->op, n->type, w);
break;
}
}