diff options
| author | Russ Cox <rsc@golang.org> | 2008-11-20 17:32:18 -0800 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2008-11-20 17:32:18 -0800 |
| commit | 67addd4e11f147125952b0d4b50c1ed2563129e9 (patch) | |
| tree | e96b789dcf10a35bece45394915ee1cb372a9cfb /src/cmd/nm | |
| parent | ec913c42b3d1a0a7f380aee5c1ce597f0d2f0f07 (diff) | |
| download | go-67addd4e11f147125952b0d4b50c1ed2563129e9.tar.xz | |
symbol table changes
* add gotype string to symbol table
* fill in gotype in 6l for known funcs/vars
* print gotype with nm -t
* load symbol and pc/ln tables into memory at magic address 0x99<<32.
* add sys.symdat() to retrieve raw bytes of symbol table
and pc/ln table.
most of this should be considered experimental
and subject to change.
R=r
DELTA=157 (128 added, 0 deleted, 29 changed)
OCL=19746
CL=19750
Diffstat (limited to 'src/cmd/nm')
| -rw-r--r-- | src/cmd/nm/nm.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/cmd/nm/nm.c b/src/cmd/nm/nm.c index 7c77f66c61..63c77bd921 100644 --- a/src/cmd/nm/nm.c +++ b/src/cmd/nm/nm.c @@ -52,6 +52,7 @@ int nflag; int sflag; int uflag; int Tflag; +int tflag; Sym **fnames; /* file path translation table */ Sym **symptr; @@ -90,6 +91,7 @@ main(int argc, char *argv[]) case 'n': nflag = 1; break; case 's': sflag = 1; break; case 'u': uflag = 1; break; + case 't': tflag = 1; break; case 'T': Tflag = 1; break; } ARGEND if (argc == 0) @@ -298,7 +300,7 @@ printsyms(Sym **symptr, long nsym) if(!sflag) qsort(symptr, nsym, sizeof(*symptr), (void*)cmp); - + wid = 0; for (i=0; i<nsym; i++) { s = symptr[i]; @@ -306,7 +308,7 @@ printsyms(Sym **symptr, long nsym) wid = 8; else if (s->value >= 0x100000000LL && wid == 8) wid = 16; - } + } for (i=0; i<nsym; i++) { s = symptr[i]; if (multifile && !hflag) @@ -322,7 +324,10 @@ printsyms(Sym **symptr, long nsym) Bprint(&bout, "%*llux ", wid, s->value); else Bprint(&bout, "%*s ", wid, ""); - Bprint(&bout, "%c %s\n", s->type, cp); + Bprint(&bout, "%c %s", s->type, cp); + if(tflag && s->gotype && s->gotype[0]) + Bprint(&bout, " %s", s->gotype); + Bprint(&bout, "\n"); } } |
