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