From 00061219f03d666e93947a3cb326256062a7a92c Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 16 Sep 2013 20:27:57 -0400 Subject: [PATCH] cmd/nm: make -S listing a bit more accurate Hide container symbols like text and etext so that the individual pieces inside are shown instead. For example, if text and main.init have the same address, it was a toss-up which name was printed. R=golang-dev, iant CC=golang-dev https://golang.org/cl/13722046 --- src/cmd/nm/nm.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/cmd/nm/nm.c b/src/cmd/nm/nm.c index b5e1ca0b6b..8209424269 100644 --- a/src/cmd/nm/nm.c +++ b/src/cmd/nm/nm.c @@ -299,6 +299,37 @@ psym(Sym *s, void* p) symptr[nsym++] = s; } +const char *skipnames[] = { + "bss", + "data", + "ebss", + "edata", + "egcbss", + "egcdata", + "enoptrbss", + "enoptrdata", + "epclntab", + "erodata", + "esymtab", + "etext", + "etypelink", + "noptrbss", + "noptrdata", + "rodata", + "text", +}; + +int +skipsize(char *name) +{ + int i; + + for(i=0; ivalue); else Bprint(&bout, "%*s ", wid, ""); - if(Sflag) { + if(Sflag && !skipsize(cp)) { vlong siz; siz = 0; for(j=i+1; jtype != 'a' && symptr[j]->type != 'p') { + if(!skipsize(symptr[j]->name) && symptr[j]->type != 'a' && symptr[j]->type != 'p') { siz = symptr[j]->value - s->value; break; } -- 2.50.0