2000-07-25 04:59:04 +08:00
|
|
|
|
/* symtab.h
|
2001-03-14 11:14:56 +08:00
|
|
|
|
|
2015-01-01 22:15:26 +08:00
|
|
|
|
Copyright (C) 2000-2015 Free Software Foundation, Inc.
|
2000-07-25 04:59:04 +08:00
|
|
|
|
|
2007-07-06 18:40:34 +08:00
|
|
|
|
This file is part of GNU Binutils.
|
2000-07-25 04:59:04 +08:00
|
|
|
|
|
2007-07-06 18:40:34 +08:00
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
2000-07-25 04:59:04 +08:00
|
|
|
|
|
2007-07-06 18:40:34 +08:00
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
2000-07-25 04:59:04 +08:00
|
|
|
|
|
2007-07-06 18:40:34 +08:00
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
|
MA 02110-1301, USA. */
|
2000-07-25 04:59:04 +08:00
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
|
#ifndef symtab_h
|
|
|
|
|
#define symtab_h
|
|
|
|
|
|
2000-07-25 04:59:04 +08:00
|
|
|
|
/* For a profile to be intelligible to a human user, it is necessary
|
|
|
|
|
to map code-addresses into source-code information. Source-code
|
|
|
|
|
information can be any combination of: (i) function-name, (ii)
|
|
|
|
|
source file-name, and (iii) source line number.
|
2001-03-14 11:14:56 +08:00
|
|
|
|
|
2000-07-25 04:59:04 +08:00
|
|
|
|
The symbol table is used to map addresses into source-code
|
|
|
|
|
information. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
|
|
#define NBBS 10
|
|
|
|
|
|
2000-07-25 04:59:04 +08:00
|
|
|
|
/* Symbol-entry. For each external in the specified file we gather
|
|
|
|
|
its address, the number of calls and compute its share of cpu time. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
typedef struct sym
|
|
|
|
|
{
|
2000-07-25 04:59:04 +08:00
|
|
|
|
/* Common information:
|
2001-03-14 11:14:56 +08:00
|
|
|
|
|
2000-07-25 04:59:04 +08:00
|
|
|
|
In the symbol-table, fields ADDR and FUNC_NAME are guaranteed
|
|
|
|
|
to contain valid information. FILE may be 0, if unknown and
|
|
|
|
|
LINE_NUM maybe 0 if unknown. */
|
2001-03-14 11:14:56 +08:00
|
|
|
|
|
2000-07-25 04:59:04 +08:00
|
|
|
|
bfd_vma addr; /* Address of entry point. */
|
|
|
|
|
bfd_vma end_addr; /* End-address. */
|
|
|
|
|
const char *name; /* Name of function this sym is from. */
|
|
|
|
|
Source_File *file; /* Source file symbol comes from. */
|
|
|
|
|
int line_num; /* Source line number. */
|
|
|
|
|
unsigned int /* Boolean fields: */
|
|
|
|
|
is_func:1, /* Is this a function entry point? */
|
|
|
|
|
is_static:1, /* Is this a local (static) symbol? */
|
|
|
|
|
is_bb_head:1, /* Is this the head of a basic-blk? */
|
|
|
|
|
mapped:1, /* This symbol was mapped to another name. */
|
|
|
|
|
has_been_placed:1; /* Have we placed this symbol? */
|
|
|
|
|
unsigned long ncalls; /* How many times executed */
|
|
|
|
|
int nuses; /* How many times this symbol appears in
|
|
|
|
|
a particular context. */
|
|
|
|
|
bfd_vma bb_addr[NBBS]; /* Address of basic-block start. */
|
|
|
|
|
unsigned long bb_calls[NBBS];/* How many times basic-block was called. */
|
|
|
|
|
struct sym *next; /* For building chains of syms. */
|
|
|
|
|
struct sym *prev; /* For building chains of syms. */
|
|
|
|
|
|
|
|
|
|
/* Profile specific information: */
|
|
|
|
|
|
|
|
|
|
/* Histogram specific information: */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
struct
|
|
|
|
|
{
|
2000-07-25 04:59:04 +08:00
|
|
|
|
double time; /* (Weighted) ticks in this routine. */
|
|
|
|
|
bfd_vma scaled_addr; /* Scaled entry point. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
hist;
|
|
|
|
|
|
2000-07-25 04:59:04 +08:00
|
|
|
|
/* Call-graph specific information: */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
struct
|
|
|
|
|
{
|
2000-07-25 04:59:04 +08:00
|
|
|
|
unsigned long self_calls; /* How many calls to self. */
|
|
|
|
|
double child_time; /* Cumulative ticks in children. */
|
|
|
|
|
int index; /* Index in the graph list. */
|
|
|
|
|
int top_order; /* Graph call chain top-sort order. */
|
2002-11-30 16:39:46 +08:00
|
|
|
|
bfd_boolean print_flag; /* Should this be printed? */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
struct
|
|
|
|
|
{
|
2000-07-25 04:59:04 +08:00
|
|
|
|
double fract; /* What % of time propagates. */
|
|
|
|
|
double self; /* How much self time propagates. */
|
|
|
|
|
double child; /* How much child time propagates. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
prop;
|
|
|
|
|
struct
|
|
|
|
|
{
|
2000-07-25 04:59:04 +08:00
|
|
|
|
int num; /* Internal number of cycle on. */
|
|
|
|
|
struct sym *head; /* Head of cycle. */
|
|
|
|
|
struct sym *next; /* Next member of cycle. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
cyc;
|
2000-07-25 04:59:04 +08:00
|
|
|
|
struct arc *parents; /* List of caller arcs. */
|
|
|
|
|
struct arc *children; /* List of callee arcs. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
cg;
|
|
|
|
|
}
|
|
|
|
|
Sym;
|
|
|
|
|
|
2000-07-25 04:59:04 +08:00
|
|
|
|
/* Symbol-tables are always assumed to be sorted
|
|
|
|
|
in increasing order of addresses. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2000-07-25 04:59:04 +08:00
|
|
|
|
unsigned int len; /* # of symbols in this table. */
|
|
|
|
|
Sym *base; /* First element in symbol table. */
|
|
|
|
|
Sym *limit; /* Limit = base + len. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
}
|
|
|
|
|
Sym_Table;
|
|
|
|
|
|
2000-07-25 04:59:04 +08:00
|
|
|
|
extern Sym_Table symtab; /* The symbol table. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
* alpha.c, basic_blocks.c, basic_blocks.h, bb_exit_func.c,
call_graph.c, call_graph.h, cg_arcs.c, cg_arcs.h, cg_dfn.c,
cg_dfn.h, cg_print.c, cg_print.h, corefile.c, corefile.h,
gmon_io.c, gmon_io.h, gprof.c, gprof.h, hertz.h, hist.c, hist.h,
i386.c, mips.c, search_list.c, search_list.h, source.c, source.h,
sparc.c, sym_ids.c, sym_ids.h, symtab.c, symtab.h, tahoe.c,
utils.c, utils.h, vax.c, gen-c-prog.awk: Convert K&R C to ANSI C.
2004-05-26 12:55:55 +08:00
|
|
|
|
extern void sym_init (Sym *);
|
|
|
|
|
extern void symtab_finalize (Sym_Table *);
|
2002-02-01 16:24:16 +08:00
|
|
|
|
#ifdef DEBUG
|
* alpha.c, basic_blocks.c, basic_blocks.h, bb_exit_func.c,
call_graph.c, call_graph.h, cg_arcs.c, cg_arcs.h, cg_dfn.c,
cg_dfn.h, cg_print.c, cg_print.h, corefile.c, corefile.h,
gmon_io.c, gmon_io.h, gprof.c, gprof.h, hertz.h, hist.c, hist.h,
i386.c, mips.c, search_list.c, search_list.h, source.c, source.h,
sparc.c, sym_ids.c, sym_ids.h, symtab.c, symtab.h, tahoe.c,
utils.c, utils.h, vax.c, gen-c-prog.awk: Convert K&R C to ANSI C.
2004-05-26 12:55:55 +08:00
|
|
|
|
extern Sym *dbg_sym_lookup (Sym_Table *, bfd_vma);
|
2002-02-01 16:24:16 +08:00
|
|
|
|
#endif
|
* alpha.c, basic_blocks.c, basic_blocks.h, bb_exit_func.c,
call_graph.c, call_graph.h, cg_arcs.c, cg_arcs.h, cg_dfn.c,
cg_dfn.h, cg_print.c, cg_print.h, corefile.c, corefile.h,
gmon_io.c, gmon_io.h, gprof.c, gprof.h, hertz.h, hist.c, hist.h,
i386.c, mips.c, search_list.c, search_list.h, source.c, source.h,
sparc.c, sym_ids.c, sym_ids.h, symtab.c, symtab.h, tahoe.c,
utils.c, utils.h, vax.c, gen-c-prog.awk: Convert K&R C to ANSI C.
2004-05-26 12:55:55 +08:00
|
|
|
|
extern Sym *sym_lookup (Sym_Table *, bfd_vma);
|
|
|
|
|
extern void find_call (Sym *, bfd_vma, bfd_vma);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
|
|
#endif /* symtab_h */
|