diff options
| author | Poul-Henning Kamp <phk@FreeBSD.org> | 1995-12-19 08:12:07 +0000 |
|---|---|---|
| committer | Poul-Henning Kamp <phk@FreeBSD.org> | 1995-12-19 08:12:07 +0000 |
| commit | 9e535a67c1770e741fe87874e561f302c8f7fc61 (patch) | |
| tree | acb85f0ec60f6c925cab18c08c6df887bca1cd4c /usr.bin/nm/nm.c | |
| parent | c44b3fc40973cf4a45568d68bd35556753f30340 (diff) | |
Notes
Diffstat (limited to 'usr.bin/nm/nm.c')
| -rw-r--r-- | usr.bin/nm/nm.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/usr.bin/nm/nm.c b/usr.bin/nm/nm.c index 931cbf042326..2dc00c324519 100644 --- a/usr.bin/nm/nm.c +++ b/usr.bin/nm/nm.c @@ -64,7 +64,7 @@ int print_all_symbols; int print_file_each_line; int fcount; -int rev; +int rev, table; int fname(), rname(), value(); int (*sfunc)() = fname; @@ -87,7 +87,7 @@ main(argc, argv) extern int optind; int ch, errors; - while ((ch = getopt(argc, argv, "agnopruw")) != EOF) { + while ((ch = getopt(argc, argv, "agnoprtuw")) != EOF) { switch (ch) { case 'a': print_all_symbols = 1; @@ -107,6 +107,9 @@ main(argc, argv) case 'r': rev = 1; break; + case 't': + table = 1; + break; case 'u': print_only_undefined_symbols = 1; break; @@ -153,7 +156,7 @@ process_file(fname) return(1); } - if (fcount > 1) + if (fcount > 1 && !table) (void)printf("\n%s:\n", fname); /* @@ -270,7 +273,7 @@ show_archive(fname, fp) */ p = name; *p = 0; - if (print_file_each_line) + if (print_file_each_line && !table) { p = scat(p, fname); p = scat(p, ":"); @@ -293,7 +296,7 @@ show_archive(fname, fp) } else { (void)fseek(fp, (long)-sizeof(exec_head), SEEK_CUR); - if (!print_file_each_line) + if (!print_file_each_line && !table) (void)printf("\n%s:\n", name); rval |= show_objfile(name, fp); } @@ -460,6 +463,21 @@ print_symbol(objname, sym) { char *typestring(), typeletter(); + if (table) { + printf("%s|", objname); + if (SYMBOL_TYPE(sym->n_type) != N_UNDF) + (void)printf("%08lx", sym->n_value); + (void)printf("|"); + if (IS_DEBUGGER_SYMBOL(sym->n_type)) + (void)printf("-|%02x %04x %5s|", sym->n_other, + sym->n_desc&0xffff, typestring(sym->n_type)); + else + (void)printf("%c|", typeletter(sym->n_type)); + + /* print the symbol's name */ + (void)printf("%s\n",sym->n_un.n_name); + return; + } if (print_file_each_line) (void)printf("%s:", objname); |
