Commit | Line | Data |
---|---|---|
ef368dac | 1 | /* symtab.h |
0eee5820 | 2 | |
1355568a | 3 | Copyright 2000, 2001, 2002 Free Software Foundation, Inc. |
ef368dac NC |
4 | |
5 | This file is part of GNU Binutils. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software | |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
20 | \f | |
252b5132 RH |
21 | #ifndef symtab_h |
22 | #define symtab_h | |
23 | ||
ef368dac NC |
24 | /* For a profile to be intelligible to a human user, it is necessary |
25 | to map code-addresses into source-code information. Source-code | |
26 | information can be any combination of: (i) function-name, (ii) | |
27 | source file-name, and (iii) source line number. | |
0eee5820 | 28 | |
ef368dac NC |
29 | The symbol table is used to map addresses into source-code |
30 | information. */ | |
252b5132 | 31 | |
252b5132 RH |
32 | #define NBBS 10 |
33 | ||
ef368dac NC |
34 | /* Symbol-entry. For each external in the specified file we gather |
35 | its address, the number of calls and compute its share of cpu time. */ | |
252b5132 RH |
36 | typedef struct sym |
37 | { | |
ef368dac | 38 | /* Common information: |
0eee5820 | 39 | |
ef368dac NC |
40 | In the symbol-table, fields ADDR and FUNC_NAME are guaranteed |
41 | to contain valid information. FILE may be 0, if unknown and | |
42 | LINE_NUM maybe 0 if unknown. */ | |
0eee5820 | 43 | |
ef368dac NC |
44 | bfd_vma addr; /* Address of entry point. */ |
45 | bfd_vma end_addr; /* End-address. */ | |
46 | const char *name; /* Name of function this sym is from. */ | |
47 | Source_File *file; /* Source file symbol comes from. */ | |
48 | int line_num; /* Source line number. */ | |
49 | unsigned int /* Boolean fields: */ | |
50 | is_func:1, /* Is this a function entry point? */ | |
51 | is_static:1, /* Is this a local (static) symbol? */ | |
52 | is_bb_head:1, /* Is this the head of a basic-blk? */ | |
53 | mapped:1, /* This symbol was mapped to another name. */ | |
54 | has_been_placed:1; /* Have we placed this symbol? */ | |
55 | unsigned long ncalls; /* How many times executed */ | |
56 | int nuses; /* How many times this symbol appears in | |
57 | a particular context. */ | |
58 | bfd_vma bb_addr[NBBS]; /* Address of basic-block start. */ | |
59 | unsigned long bb_calls[NBBS];/* How many times basic-block was called. */ | |
60 | struct sym *next; /* For building chains of syms. */ | |
61 | struct sym *prev; /* For building chains of syms. */ | |
62 | ||
63 | /* Profile specific information: */ | |
64 | ||
65 | /* Histogram specific information: */ | |
252b5132 RH |
66 | struct |
67 | { | |
ef368dac NC |
68 | double time; /* (Weighted) ticks in this routine. */ |
69 | bfd_vma scaled_addr; /* Scaled entry point. */ | |
252b5132 RH |
70 | } |
71 | hist; | |
72 | ||
ef368dac | 73 | /* Call-graph specific information: */ |
252b5132 RH |
74 | struct |
75 | { | |
ef368dac NC |
76 | unsigned long self_calls; /* How many calls to self. */ |
77 | double child_time; /* Cumulative ticks in children. */ | |
78 | int index; /* Index in the graph list. */ | |
79 | int top_order; /* Graph call chain top-sort order. */ | |
b34976b6 | 80 | bfd_boolean print_flag; /* Should this be printed? */ |
252b5132 RH |
81 | struct |
82 | { | |
ef368dac NC |
83 | double fract; /* What % of time propagates. */ |
84 | double self; /* How much self time propagates. */ | |
85 | double child; /* How much child time propagates. */ | |
252b5132 RH |
86 | } |
87 | prop; | |
88 | struct | |
89 | { | |
ef368dac NC |
90 | int num; /* Internal number of cycle on. */ |
91 | struct sym *head; /* Head of cycle. */ | |
92 | struct sym *next; /* Next member of cycle. */ | |
252b5132 RH |
93 | } |
94 | cyc; | |
ef368dac NC |
95 | struct arc *parents; /* List of caller arcs. */ |
96 | struct arc *children; /* List of callee arcs. */ | |
252b5132 RH |
97 | } |
98 | cg; | |
99 | } | |
100 | Sym; | |
101 | ||
ef368dac NC |
102 | /* Symbol-tables are always assumed to be sorted |
103 | in increasing order of addresses. */ | |
252b5132 RH |
104 | typedef struct |
105 | { | |
ef368dac NC |
106 | unsigned int len; /* # of symbols in this table. */ |
107 | Sym *base; /* First element in symbol table. */ | |
108 | Sym *limit; /* Limit = base + len. */ | |
252b5132 RH |
109 | } |
110 | Sym_Table; | |
111 | ||
ef368dac | 112 | extern Sym_Table symtab; /* The symbol table. */ |
252b5132 | 113 | |
ef368dac NC |
114 | extern void sym_init PARAMS ((Sym *)); |
115 | extern void symtab_finalize PARAMS ((Sym_Table *)); | |
1355568a AM |
116 | #ifdef DEBUG |
117 | extern Sym *dbg_sym_lookup PARAMS ((Sym_Table *, bfd_vma)); | |
118 | #endif | |
ef368dac NC |
119 | extern Sym *sym_lookup PARAMS ((Sym_Table *, bfd_vma)); |
120 | extern void find_call PARAMS ((Sym *, bfd_vma, bfd_vma)); | |
252b5132 RH |
121 | |
122 | #endif /* symtab_h */ |