Commit aed88be0 authored by Dmitry Vyukov's avatar Dmitry Vyukov

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/3870Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
parent ed8cc5cf
......@@ -327,7 +327,7 @@ compile(Node *fn)
defframe(ptxt);
if(0)
if(debug['f'])
frame(0);
// Remove leftover instrumentation from the instruction stream.
......
......@@ -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;
}
}
......
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