]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gprof/symtab.h
* config/sh/tm-sh.h (BELIEVE_PCC_PROMOTION): Define, so that
[thirdparty/binutils-gdb.git] / gprof / symtab.h
CommitLineData
5489fcc3
KR
1#ifndef symtab_h
2#define symtab_h
3
4#include "bfd.h"
5#include "gprof.h"
6
7/*
8 * For a profile to be intelligible to a human user, it is necessary
9 * to map code-addresses into source-code information. Source-code
10 * information can be any combination of: (i) function-name, (ii)
11 * source file-name, and (iii) source line number.
12 *
13 * The symbol table is used to map addresses into source-code
14 * information.
15 */
16
17#include "source.h"
18
7862d7d0
ILT
19#define NBBS 10
20
5489fcc3
KR
21/*
22 * Symbol-entry. For each external in the specified file we gather
23 * its address, the number of calls and compute its share of cpu time.
24 */
12516a37
KR
25typedef struct sym
26 {
5489fcc3
KR
27 /*
28 * Common information:
29 *
30 * In the symbol-table, fields ADDR and FUNC_NAME are guaranteed
31 * to contain valid information. FILE may be 0, if unknown and
32 * LINE_NUM maybe 0 if unknown.
33 */
12516a37
KR
34 bfd_vma addr; /* address of entry point */
35 bfd_vma end_addr; /* end-address */
36 const char *name; /* name of function this sym is from */
37 Source_File *file; /* source file symbol comes from */
38 int line_num; /* source line number */
39 unsigned int is_func:1, /* is this a function entry point? */
40 is_static:1, /* is this a local (static) symbol? */
64c50fc5
JL
41 is_bb_head:1, /* is this the head of a basic-blk? */
42 mapped:1, /* this symbol was mapped to another name */
43 has_been_placed:1; /* have we placed this symbol? */
8c73afb3 44 unsigned long ncalls; /* how many times executed */
64c50fc5
JL
45 int nuses; /* how many times this symbol appears in
46 a particular context */
7862d7d0 47 bfd_vma bb_addr[NBBS]; /* address of basic-block start */
8c73afb3 48 unsigned long bb_calls[NBBS]; /* how many times basic-block was called */
12516a37 49 struct sym *next; /* for building chains of syms */
64c50fc5 50 struct sym *prev; /* for building chains of syms */
5489fcc3
KR
51
52 /* profile-specific information: */
53
54 /* histogram specific info: */
12516a37
KR
55 struct
56 {
57 double time; /* (weighted) ticks in this routine */
58 bfd_vma scaled_addr; /* scaled entry point */
59 }
60 hist;
5489fcc3
KR
61
62 /* call-graph specific info: */
12516a37
KR
63 struct
64 {
8c73afb3 65 unsigned long self_calls; /* how many calls to self */
12516a37
KR
66 double child_time; /* cumulative ticks in children */
67 int index; /* index in the graph list */
68 int top_order; /* graph call chain top-sort order */
69 bool print_flag; /* should this be printed? */
70 struct
71 {
72 double fract; /* what % of time propagates */
73 double self; /* how much self time propagates */
74 double child; /* how much child time propagates */
75 }
76 prop;
77 struct
78 {
79 int num; /* internal number of cycle on */
80 struct sym *head; /* head of cycle */
81 struct sym *next; /* next member of cycle */
82 }
83 cyc;
84 struct arc *parents; /* list of caller arcs */
85 struct arc *children; /* list of callee arcs */
86 }
87 cg;
88 }
89Sym;
5489fcc3
KR
90
91/*
92 * Symbol-tables are always assumed to be sorted in increasing order
93 * of addresses:
94 */
12516a37
KR
95typedef struct
96 {
6b84886a 97 unsigned int len; /* # of symbols in this table */
12516a37
KR
98 Sym *base; /* first element in symbol table */
99 Sym *limit; /* limit = base + len */
100 }
101Sym_Table;
5489fcc3 102
12516a37 103extern Sym_Table symtab; /* the symbol table */
5489fcc3 104
12516a37
KR
105extern void sym_init PARAMS ((Sym * sym));
106extern void symtab_finalize PARAMS ((Sym_Table * symtab));
107extern Sym *sym_lookup PARAMS ((Sym_Table * symtab, bfd_vma address));
5489fcc3 108
1eb9fa9e
ILT
109extern void find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
110
5489fcc3 111#endif /* symtab_h */