annotate leo-obj/tool/profile.c @ 193:37f78f986a0a

grokdsn: tree dump implemented
author Michael Spacefalcon <falcon@ivan.Harhan.ORG>
date Wed, 07 Jan 2015 08:09:30 +0000
parents 87b82398a08b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
119
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 * It is handy to have a "profile" of what functions and variables
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 * a given module defines (presents to the rest of the fw) and what
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 * it references. This profile is constructed from the symbol table.
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 *
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 * Experience indicates that the order of these symbols in the
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 * artifact symtab is often "random", and an alphabetic sort is
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 * expected to improve readability. This module contains the
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 * messy code.
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 */
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 #include <sys/types.h>
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 #include <stdio.h>
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 #include <stdlib.h>
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 #include <string.h>
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 #include <strings.h>
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 #include "intstruct.h"
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 #include "coffconst.h"
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 #include "globals.h"
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 static int
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 is_symbol_text_def(sym)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 struct internal_syment *sym;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 {
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 if (!sym->section)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 return(0);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 if (!strncmp(sym->section->name, ".text", 5))
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 return(1);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 else
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 return(0);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 }
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 static int
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 is_symbol_nontext_def(sym)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 struct internal_syment *sym;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 {
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 if (!sym->section)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 return(0);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 if (!strncmp(sym->section->name, ".text", 5))
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 return(0);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 else
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 return(1);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 }
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 static int
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 is_symbol_extref(sym)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 struct internal_syment *sym;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 {
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 if (sym->section)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 return(0);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 else
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 return(1);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 }
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 static int
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 compare_for_sort(p1, p2)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 struct internal_syment **p1, **p2;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 {
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 return strcmp((*p1)->name, (*p2)->name);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 }
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 static void
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 list_class(firstidx, lastidx, total, checkfunc, printsec)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 unsigned firstidx, lastidx, total;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 int (*checkfunc)();
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 {
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 struct internal_syment **array, *sym;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 unsigned n, m;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 array = malloc(sizeof(void *) * total);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 if (!array) {
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 perror("malloc");
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73 exit(1);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 }
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75 m = 0;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
76 for (n = firstidx; n <= lastidx; n++) {
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 sym = symtab[n];
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
78 if (!sym)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 continue;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
80 if (sym->class != C_EXT)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
81 continue;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
82 if (!checkfunc(sym))
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83 continue;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 array[m++] = sym;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85 }
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 if (m != total) {
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87 fprintf(stderr, "BUG: symbol class miscount in profile gen\n");
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 exit(1);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
89 }
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
90 qsort(array, total, sizeof(void *), compare_for_sort);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
91 for (n = 0; n < total; n++) {
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
92 sym = array[n];
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
93 if (printsec)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
94 printf("%s (%s)\n", sym->name, sym->section->name);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
95 else
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
96 printf("%s\n", sym->name);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
97 }
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
98 free(array);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
99 putchar('\n');
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
100 }
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
101
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
102 extern_profile_report(heading)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
103 char *heading;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
104 {
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
105 unsigned n;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
106 int first_extern = -1, last_extern;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
107 struct internal_syment *sym;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
108 unsigned defs_text = 0, defs_nontext = 0, extrefs = 0;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
109
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
110 for (n = 0; n < nsymtab; n++) {
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
111 sym = symtab[n];
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
112 if (!sym)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
113 continue;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
114 if (sym->class != C_EXT)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
115 continue;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
116 if (first_extern < 0)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
117 first_extern = n;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
118 last_extern = n;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
119 if (sym->scnum < 0) {
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
120 fprintf(stderr,
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
121 "symbol entry #%u: unexpected negative scnum for C_EXT\n", n);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
122 exit(1);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
123 }
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
124 if (sym->scnum == 0)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
125 extrefs++;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
126 else if (!strncmp(sym->section->name, ".text", 5))
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
127 defs_text++;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
128 else
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
129 defs_nontext++;
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
130 }
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
131 if (first_extern < 0) {
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
132 printf("%s has no external symbols!\n", heading);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
133 return(1);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
134 }
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
135 if (defs_text || defs_nontext) {
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
136 printf("%s defines:\n\n", heading);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
137 if (defs_text)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
138 list_class(first_extern, last_extern, defs_text,
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
139 is_symbol_text_def, 1);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
140 if (defs_nontext)
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
141 list_class(first_extern, last_extern, defs_nontext,
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
142 is_symbol_nontext_def, 1);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
143 }
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
144 if (extrefs) {
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
145 printf("%s references:\n\n", heading);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
146 list_class(first_extern, last_extern, extrefs,
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
147 is_symbol_extref, 0);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
148 }
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
149 return(0);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
150 }
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
151
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
152 cmd_profile()
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
153 {
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
154 get_int_section_table();
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
155 get_int_symbol_table();
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
156 extern_profile_report(objfilename);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
157 exit(0);
fb1e47bebe00 tiobjd: sorted profile output
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
158 }