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