source: trunk/src/binutils/gprof/symtab.h@ 10

Last change on this file since 10 was 10, checked in by bird, 22 years ago

Initial revision

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