From 2cda191aef7cb94a6f2535aec5de5ad29d7cf31f Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 10 Sep 2010 11:53:51 -0400 Subject: [PATCH] 6c, 8c: show line numbers in -S output R=ken2 CC=golang-dev https://golang.org/cl/2107047 --- src/cmd/6c/list.c | 15 ++++++++------- src/cmd/8c/list.c | 30 +++++++++++++++++++++--------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/cmd/6c/list.c b/src/cmd/6c/list.c index ba517ca0a0..4293203c00 100644 --- a/src/cmd/6c/list.c +++ b/src/cmd/6c/list.c @@ -78,22 +78,23 @@ Pconv(Fmt *fp) p = va_arg(fp->args, Prog*); switch(p->as) { case ADATA: - sprint(str, " %A %D/%d,%D", - p->as, &p->from, p->from.scale, &p->to); + sprint(str, "(%L) %A %D/%d,%D", + p->lineno, p->as, &p->from, p->from.scale, &p->to); break; case ATEXT: if(p->from.scale) { - sprint(str, " %A %D,%d,%lD", - p->as, &p->from, p->from.scale, &p->to); + sprint(str, "(%L) %A %D,%d,%lD", + p->lineno, p->as, &p->from, p->from.scale, &p->to); break; } - sprint(str, " %A %D,%lD", - p->as, &p->from, &p->to); + sprint(str, "(%L) %A %D,%lD", + p->lineno, p->as, &p->from, &p->to); break; default: - sprint(str, " %A %D,%lD", p->as, &p->from, &p->to); + sprint(str, "(%L) %A %D,%lD", + p->lineno, p->as, &p->from, &p->to); break; } return fmtstrcpy(fp, str); diff --git a/src/cmd/8c/list.c b/src/cmd/8c/list.c index 6caafd258a..c422905cd9 100644 --- a/src/cmd/8c/list.c +++ b/src/cmd/8c/list.c @@ -76,15 +76,27 @@ Pconv(Fmt *fp) Prog *p; p = va_arg(fp->args, Prog*); - if(p->as == ADATA) - sprint(str, " %A %D/%d,%D", - p->as, &p->from, p->from.scale, &p->to); - else if(p->as == ATEXT) - sprint(str, " %A %D,%d,%D", - p->as, &p->from, p->from.scale, &p->to); - else - sprint(str, " %A %D,%D", - p->as, &p->from, &p->to); + switch(p->as) { + case ADATA: + sprint(str, "(%L) %A %D/%d,%D", + p->lineno, p->as, &p->from, p->from.scale, &p->to); + break; + + case ATEXT: + if(p->from.scale) { + sprint(str, "(%L) %A %D,%d,%lD", + p->lineno, p->as, &p->from, p->from.scale, &p->to); + break; + } + sprint(str, "(%L) %A %D,%lD", + p->lineno, p->as, &p->from, &p->to); + break; + + default: + sprint(str, "(%L) %A %D,%lD", + p->lineno, p->as, &p->from, &p->to); + break; + } return fmtstrcpy(fp, str); }