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