* 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.
This commit is contained in:
parent
37b1bfcd81
commit
3e8f6abf1e
@ -1,3 +1,13 @@
|
||||
2004-05-26 Ben Elliston <bje@au.ibm.com>
|
||||
|
||||
* 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 Ben Elliston <bje@au.ibm.com>
|
||||
|
||||
* corefile.c (core_init): Use a separate local variable,
|
||||
|
@ -78,7 +78,7 @@ alpha_Instruction;
|
||||
|
||||
static Sym indirect_child;
|
||||
|
||||
void alpha_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
|
||||
void alpha_find_call (Sym *, bfd_vma, bfd_vma);
|
||||
|
||||
/*
|
||||
* On the Alpha we can only detect PC relative calls, which are
|
||||
@ -88,10 +88,7 @@ void alpha_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
|
||||
* potentially call integer division routines, for example.)
|
||||
*/
|
||||
void
|
||||
alpha_find_call (parent, p_lowpc, p_highpc)
|
||||
Sym *parent;
|
||||
bfd_vma p_lowpc;
|
||||
bfd_vma p_highpc;
|
||||
alpha_find_call (Sym *parent, bfd_vma p_lowpc, bfd_vma p_highpc)
|
||||
{
|
||||
bfd_vma pc, dest_pc;
|
||||
unsigned int insn;
|
||||
|
@ -32,10 +32,10 @@
|
||||
#include "symtab.h"
|
||||
#include "sym_ids.h"
|
||||
|
||||
static int cmp_bb PARAMS ((const PTR, const PTR));
|
||||
static int cmp_ncalls PARAMS ((const PTR, const PTR));
|
||||
static void fskip_string PARAMS ((FILE *));
|
||||
static void annotate_with_count PARAMS ((char *, unsigned int, int, PTR));
|
||||
static int cmp_bb (const PTR, const PTR);
|
||||
static int cmp_ncalls (const PTR, const PTR);
|
||||
static void fskip_string (FILE *);
|
||||
static void annotate_with_count (char *, unsigned int, int, PTR);
|
||||
|
||||
/* Default option values: */
|
||||
bfd_boolean bb_annotate_all_lines = FALSE;
|
||||
@ -52,9 +52,7 @@ static long num_lines_executed;
|
||||
number, and address (in that order). */
|
||||
|
||||
static int
|
||||
cmp_bb (lp, rp)
|
||||
const PTR lp;
|
||||
const PTR rp;
|
||||
cmp_bb (const PTR lp, const PTR rp)
|
||||
{
|
||||
int r;
|
||||
const Sym *left = *(const Sym **) lp;
|
||||
@ -83,9 +81,7 @@ cmp_bb (lp, rp)
|
||||
/* Helper for sorting. Order basic blocks in decreasing number of
|
||||
calls, ties are broken in increasing order of line numbers. */
|
||||
static int
|
||||
cmp_ncalls (lp, rp)
|
||||
const PTR lp;
|
||||
const PTR rp;
|
||||
cmp_ncalls (const PTR lp, const PTR rp)
|
||||
{
|
||||
const Sym *left = *(const Sym **) lp;
|
||||
const Sym *right = *(const Sym **) rp;
|
||||
@ -105,8 +101,7 @@ cmp_ncalls (lp, rp)
|
||||
|
||||
/* Skip over variable length string. */
|
||||
static void
|
||||
fskip_string (fp)
|
||||
FILE *fp;
|
||||
fskip_string (FILE *fp)
|
||||
{
|
||||
int ch;
|
||||
|
||||
@ -121,9 +116,7 @@ fskip_string (fp)
|
||||
of file IFP and is provided for formatting error-messages only. */
|
||||
|
||||
void
|
||||
bb_read_rec (ifp, filename)
|
||||
FILE *ifp;
|
||||
const char *filename;
|
||||
bb_read_rec (FILE *ifp, const char *filename)
|
||||
{
|
||||
int nblocks, b;
|
||||
bfd_vma addr, ncalls;
|
||||
@ -211,9 +204,7 @@ bb_read_rec (ifp, filename)
|
||||
is the name of OFP and is provided for producing error-messages
|
||||
only. */
|
||||
void
|
||||
bb_write_blocks (ofp, filename)
|
||||
FILE *ofp;
|
||||
const char *filename;
|
||||
bb_write_blocks (FILE *ofp, const char *filename)
|
||||
{
|
||||
unsigned int nblocks = 0;
|
||||
Sym *sym;
|
||||
@ -323,11 +314,7 @@ print_exec_counts ()
|
||||
that starts the basic-block. */
|
||||
|
||||
static void
|
||||
annotate_with_count (buf, width, line_num, arg)
|
||||
char *buf;
|
||||
unsigned int width;
|
||||
int line_num;
|
||||
PTR arg;
|
||||
annotate_with_count (char *buf, unsigned int width, int line_num, PTR arg)
|
||||
{
|
||||
Source_File *sf = arg;
|
||||
Sym *b;
|
||||
|
@ -25,9 +25,9 @@ extern bfd_boolean bb_annotate_all_lines; /* Force annotation of all lines? */
|
||||
extern int bb_table_length; /* Length of most-used bb table. */
|
||||
extern unsigned long bb_min_calls; /* Minimum execution count. */
|
||||
|
||||
extern void bb_read_rec PARAMS ((FILE *, const char *));
|
||||
extern void bb_write_blocks PARAMS ((FILE *, const char *));
|
||||
extern void bb_create_syms PARAMS ((void));
|
||||
extern void print_annotated_source PARAMS ((void));
|
||||
extern void print_exec_counts PARAMS ((void));
|
||||
extern void bb_read_rec (FILE *, const char *);
|
||||
extern void bb_write_blocks (FILE *, const char *);
|
||||
extern void bb_create_syms (void);
|
||||
extern void print_annotated_source (void);
|
||||
extern void print_exec_counts (void);
|
||||
#endif /* basic_blocks_h */
|
||||
|
@ -44,7 +44,7 @@ struct bb *__bb_head = (struct bb *) 0;
|
||||
|
||||
|
||||
void
|
||||
__bb_exit_func (void)
|
||||
__bb_exit_func ()
|
||||
{
|
||||
const int version = GMON_VERSION;
|
||||
struct gmon_hdr ghdr;
|
||||
|
@ -31,10 +31,7 @@
|
||||
#include "sym_ids.h"
|
||||
|
||||
void
|
||||
cg_tally (from_pc, self_pc, count)
|
||||
bfd_vma from_pc;
|
||||
bfd_vma self_pc;
|
||||
unsigned long count;
|
||||
cg_tally (bfd_vma from_pc, bfd_vma self_pc, unsigned long count)
|
||||
{
|
||||
Sym *parent;
|
||||
Sym *child;
|
||||
@ -80,9 +77,7 @@ cg_tally (from_pc, self_pc, count)
|
||||
for formatting error-messages only. */
|
||||
|
||||
void
|
||||
cg_read_rec (ifp, filename)
|
||||
FILE *ifp;
|
||||
const char *filename;
|
||||
cg_read_rec (FILE *ifp, const char *filename)
|
||||
{
|
||||
bfd_vma from_pc, self_pc;
|
||||
unsigned int count;
|
||||
@ -109,9 +104,7 @@ cg_read_rec (ifp, filename)
|
||||
only. */
|
||||
|
||||
void
|
||||
cg_write_arcs (ofp, filename)
|
||||
FILE *ofp;
|
||||
const char *filename;
|
||||
cg_write_arcs (FILE *ofp, const char *filename)
|
||||
{
|
||||
Arc *arc;
|
||||
Sym *sym;
|
||||
|
@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#ifndef call_graph_h
|
||||
#define call_graph_h
|
||||
|
||||
extern void cg_tally PARAMS ((bfd_vma, bfd_vma, unsigned long));
|
||||
extern void cg_read_rec PARAMS ((FILE *, const char *));
|
||||
extern void cg_write_arcs PARAMS ((FILE *, const char *));
|
||||
extern void cg_tally (bfd_vma, bfd_vma, unsigned long);
|
||||
extern void cg_read_rec (FILE *, const char *);
|
||||
extern void cg_write_arcs (FILE *, const char *);
|
||||
|
||||
#endif /* call_graph_h */
|
||||
|
@ -38,13 +38,13 @@
|
||||
#include "utils.h"
|
||||
#include "sym_ids.h"
|
||||
|
||||
static int cmp_topo PARAMS ((const PTR, const PTR));
|
||||
static void propagate_time PARAMS ((Sym *));
|
||||
static void cycle_time PARAMS ((void));
|
||||
static void cycle_link PARAMS ((void));
|
||||
static void inherit_flags PARAMS ((Sym *));
|
||||
static void propagate_flags PARAMS ((Sym **));
|
||||
static int cmp_total PARAMS ((const PTR, const PTR));
|
||||
static int cmp_topo (const PTR, const PTR);
|
||||
static void propagate_time (Sym *);
|
||||
static void cycle_time (void);
|
||||
static void cycle_link (void);
|
||||
static void inherit_flags (Sym *);
|
||||
static void propagate_flags (Sym **);
|
||||
static int cmp_total (const PTR, const PTR);
|
||||
|
||||
Sym *cycle_header;
|
||||
unsigned int num_cycles;
|
||||
@ -56,9 +56,7 @@ unsigned int numarcs;
|
||||
* range covered by CHILD.
|
||||
*/
|
||||
Arc *
|
||||
arc_lookup (parent, child)
|
||||
Sym *parent;
|
||||
Sym *child;
|
||||
arc_lookup (Sym *parent, Sym *child)
|
||||
{
|
||||
Arc *arc;
|
||||
|
||||
@ -87,10 +85,7 @@ arc_lookup (parent, child)
|
||||
* Add (or just increment) an arc:
|
||||
*/
|
||||
void
|
||||
arc_add (parent, child, count)
|
||||
Sym *parent;
|
||||
Sym *child;
|
||||
unsigned long count;
|
||||
arc_add (Sym *parent, Sym *child, unsigned long count)
|
||||
{
|
||||
static unsigned int maxarcs = 0;
|
||||
Arc *arc, **newarcs;
|
||||
@ -156,9 +151,7 @@ arc_add (parent, child, count)
|
||||
|
||||
|
||||
static int
|
||||
cmp_topo (lp, rp)
|
||||
const PTR lp;
|
||||
const PTR rp;
|
||||
cmp_topo (const PTR lp, const PTR rp)
|
||||
{
|
||||
const Sym *left = *(const Sym **) lp;
|
||||
const Sym *right = *(const Sym **) rp;
|
||||
@ -168,8 +161,7 @@ cmp_topo (lp, rp)
|
||||
|
||||
|
||||
static void
|
||||
propagate_time (parent)
|
||||
Sym *parent;
|
||||
propagate_time (Sym *parent)
|
||||
{
|
||||
Arc *arc;
|
||||
Sym *child;
|
||||
@ -365,8 +357,7 @@ cycle_link ()
|
||||
* fractions from parents.
|
||||
*/
|
||||
static void
|
||||
inherit_flags (child)
|
||||
Sym *child;
|
||||
inherit_flags (Sym *child)
|
||||
{
|
||||
Sym *head, *parent, *member;
|
||||
Arc *arc;
|
||||
@ -444,8 +435,7 @@ inherit_flags (child)
|
||||
* and while we're here, sum time for functions.
|
||||
*/
|
||||
static void
|
||||
propagate_flags (symbols)
|
||||
Sym **symbols;
|
||||
propagate_flags (Sym **symbols)
|
||||
{
|
||||
int index;
|
||||
Sym *old_head, *child;
|
||||
@ -545,9 +535,7 @@ propagate_flags (symbols)
|
||||
* first. All else being equal, compare by names.
|
||||
*/
|
||||
static int
|
||||
cmp_total (lp, rp)
|
||||
const PTR lp;
|
||||
const PTR rp;
|
||||
cmp_total (const PTR lp, const PTR rp)
|
||||
{
|
||||
const Sym *left = *(const Sym **) lp;
|
||||
const Sym *right = *(const Sym **) rp;
|
||||
|
@ -24,9 +24,9 @@ Arc;
|
||||
extern unsigned int num_cycles; /* number of cycles discovered */
|
||||
extern Sym *cycle_header; /* cycle headers */
|
||||
|
||||
extern void arc_add PARAMS ((Sym * parent, Sym * child, unsigned long count));
|
||||
extern Arc *arc_lookup PARAMS ((Sym * parent, Sym * child));
|
||||
extern Sym **cg_assemble PARAMS ((void));
|
||||
extern void arc_add (Sym * parent, Sym * child, unsigned long count);
|
||||
extern Arc *arc_lookup (Sym * parent, Sym * child);
|
||||
extern Sym **cg_assemble (void);
|
||||
extern Arc **arcs;
|
||||
extern unsigned int numarcs;
|
||||
|
||||
|
@ -44,11 +44,11 @@ typedef struct
|
||||
}
|
||||
DFN_Stack;
|
||||
|
||||
static bfd_boolean is_numbered PARAMS ((Sym *));
|
||||
static bfd_boolean is_busy PARAMS ((Sym *));
|
||||
static void find_cycle PARAMS ((Sym *));
|
||||
static void pre_visit PARAMS ((Sym *));
|
||||
static void post_visit PARAMS ((Sym *));
|
||||
static bfd_boolean is_numbered (Sym *);
|
||||
static bfd_boolean is_busy (Sym *);
|
||||
static void find_cycle (Sym *);
|
||||
static void pre_visit (Sym *);
|
||||
static void post_visit (Sym *);
|
||||
|
||||
DFN_Stack *dfn_stack = NULL;
|
||||
int dfn_maxdepth = 0;
|
||||
@ -60,8 +60,7 @@ int dfn_counter = DFN_NAN;
|
||||
* Is CHILD already numbered?
|
||||
*/
|
||||
static bfd_boolean
|
||||
is_numbered (child)
|
||||
Sym *child;
|
||||
is_numbered (Sym *child)
|
||||
{
|
||||
return child->cg.top_order != DFN_NAN && child->cg.top_order != DFN_BUSY;
|
||||
}
|
||||
@ -71,8 +70,7 @@ is_numbered (child)
|
||||
* Is CHILD already busy?
|
||||
*/
|
||||
static bfd_boolean
|
||||
is_busy (child)
|
||||
Sym *child;
|
||||
is_busy (Sym *child)
|
||||
{
|
||||
if (child->cg.top_order == DFN_NAN)
|
||||
{
|
||||
@ -89,8 +87,7 @@ is_busy (child)
|
||||
* depth-first number).
|
||||
*/
|
||||
static void
|
||||
find_cycle (child)
|
||||
Sym *child;
|
||||
find_cycle (Sym *child)
|
||||
{
|
||||
Sym *head = 0;
|
||||
Sym *tail;
|
||||
@ -213,8 +210,7 @@ find_cycle (child)
|
||||
* the stack and mark it busy.
|
||||
*/
|
||||
static void
|
||||
pre_visit (parent)
|
||||
Sym *parent;
|
||||
pre_visit (Sym *parent)
|
||||
{
|
||||
++dfn_depth;
|
||||
|
||||
@ -238,8 +234,7 @@ pre_visit (parent)
|
||||
* and number functions if PARENT is head of a cycle.
|
||||
*/
|
||||
static void
|
||||
post_visit (parent)
|
||||
Sym *parent;
|
||||
post_visit (Sym *parent)
|
||||
{
|
||||
Sym *member;
|
||||
|
||||
@ -273,8 +268,7 @@ post_visit (parent)
|
||||
* Given this PARENT, depth first number its children.
|
||||
*/
|
||||
void
|
||||
cg_dfn (parent)
|
||||
Sym *parent;
|
||||
cg_dfn (Sym *parent)
|
||||
{
|
||||
Arc *arc;
|
||||
|
||||
|
@ -12,6 +12,6 @@
|
||||
* Depth-first numbering of a call-graph.
|
||||
*/
|
||||
|
||||
extern void cg_dfn PARAMS ((Sym * root));
|
||||
extern void cg_dfn (Sym * root);
|
||||
|
||||
#endif /* cg_dfn_h */
|
||||
|
@ -35,26 +35,26 @@
|
||||
#define EQUALTO 0
|
||||
#define GREATERTHAN 1
|
||||
|
||||
static void print_header PARAMS ((void));
|
||||
static void print_cycle PARAMS ((Sym *));
|
||||
static int cmp_member PARAMS ((Sym *, Sym *));
|
||||
static void sort_members PARAMS ((Sym *));
|
||||
static void print_members PARAMS ((Sym *));
|
||||
static int cmp_arc PARAMS ((Arc *, Arc *));
|
||||
static void sort_parents PARAMS ((Sym *));
|
||||
static void print_parents PARAMS ((Sym *));
|
||||
static void sort_children PARAMS ((Sym *));
|
||||
static void print_children PARAMS ((Sym *));
|
||||
static void print_line PARAMS ((Sym *));
|
||||
static int cmp_name PARAMS ((const PTR, const PTR));
|
||||
static int cmp_arc_count PARAMS ((const PTR, const PTR));
|
||||
static int cmp_fun_nuses PARAMS ((const PTR, const PTR));
|
||||
static void print_header (void);
|
||||
static void print_cycle (Sym *);
|
||||
static int cmp_member (Sym *, Sym *);
|
||||
static void sort_members (Sym *);
|
||||
static void print_members (Sym *);
|
||||
static int cmp_arc (Arc *, Arc *);
|
||||
static void sort_parents (Sym *);
|
||||
static void print_parents (Sym *);
|
||||
static void sort_children (Sym *);
|
||||
static void print_children (Sym *);
|
||||
static void print_line (Sym *);
|
||||
static int cmp_name (const PTR, const PTR);
|
||||
static int cmp_arc_count (const PTR, const PTR);
|
||||
static int cmp_fun_nuses (const PTR, const PTR);
|
||||
static void order_and_dump_functions_by_arcs
|
||||
PARAMS ((Arc **, unsigned long, int, Arc **, unsigned long *));
|
||||
(Arc **, unsigned long, int, Arc **, unsigned long *);
|
||||
|
||||
/* Declarations of automatically generated functions to output blurbs. */
|
||||
extern void bsd_callg_blurb PARAMS ((FILE * fp));
|
||||
extern void fsf_callg_blurb PARAMS ((FILE * fp));
|
||||
extern void bsd_callg_blurb (FILE * fp);
|
||||
extern void fsf_callg_blurb (FILE * fp);
|
||||
|
||||
double print_time = 0.0;
|
||||
|
||||
@ -109,8 +109,7 @@ print_header ()
|
||||
/* Print a cycle header. */
|
||||
|
||||
static void
|
||||
print_cycle (cyc)
|
||||
Sym *cyc;
|
||||
print_cycle (Sym *cyc)
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
|
||||
@ -133,9 +132,7 @@ print_cycle (cyc)
|
||||
CG.PROP.SELF+CG.PROP.CHILD, secondary key is NCALLS+CG.SELF_CALLS. */
|
||||
|
||||
static int
|
||||
cmp_member (left, right)
|
||||
Sym *left;
|
||||
Sym *right;
|
||||
cmp_member (Sym *left, Sym *right)
|
||||
{
|
||||
double left_time = left->cg.prop.self + left->cg.prop.child;
|
||||
double right_time = right->cg.prop.self + right->cg.prop.child;
|
||||
@ -160,8 +157,7 @@ cmp_member (left, right)
|
||||
/* Sort members of a cycle. */
|
||||
|
||||
static void
|
||||
sort_members (cyc)
|
||||
Sym *cyc;
|
||||
sort_members (Sym *cyc)
|
||||
{
|
||||
Sym *todo, *doing, *prev;
|
||||
|
||||
@ -188,8 +184,7 @@ sort_members (cyc)
|
||||
/* Print the members of a cycle. */
|
||||
|
||||
static void
|
||||
print_members (cyc)
|
||||
Sym *cyc;
|
||||
print_members (Sym *cyc)
|
||||
{
|
||||
Sym *member;
|
||||
|
||||
@ -223,9 +218,7 @@ print_members (cyc)
|
||||
arc count as minor key. */
|
||||
|
||||
static int
|
||||
cmp_arc (left, right)
|
||||
Arc *left;
|
||||
Arc *right;
|
||||
cmp_arc (Arc *left, Arc *right)
|
||||
{
|
||||
Sym *left_parent = left->parent;
|
||||
Sym *left_child = left->child;
|
||||
@ -311,8 +304,7 @@ cmp_arc (left, right)
|
||||
|
||||
|
||||
static void
|
||||
sort_parents (child)
|
||||
Sym * child;
|
||||
sort_parents (Sym * child)
|
||||
{
|
||||
Arc *arc, *detached, sorted, *prev;
|
||||
|
||||
@ -345,8 +337,7 @@ sort_parents (child)
|
||||
|
||||
|
||||
static void
|
||||
print_parents (child)
|
||||
Sym *child;
|
||||
print_parents (Sym *child)
|
||||
{
|
||||
Sym *parent;
|
||||
Arc *arc;
|
||||
@ -400,8 +391,7 @@ print_parents (child)
|
||||
|
||||
|
||||
static void
|
||||
sort_children (parent)
|
||||
Sym *parent;
|
||||
sort_children (Sym *parent)
|
||||
{
|
||||
Arc *arc, *detached, sorted, *prev;
|
||||
|
||||
@ -434,8 +424,7 @@ sort_children (parent)
|
||||
|
||||
|
||||
static void
|
||||
print_children (parent)
|
||||
Sym *parent;
|
||||
print_children (Sym *parent)
|
||||
{
|
||||
Sym *child;
|
||||
Arc *arc;
|
||||
@ -474,8 +463,7 @@ print_children (parent)
|
||||
|
||||
|
||||
static void
|
||||
print_line (np)
|
||||
Sym *np;
|
||||
print_line (Sym *np)
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
|
||||
@ -508,8 +496,7 @@ print_line (np)
|
||||
/* Print dynamic call graph. */
|
||||
|
||||
void
|
||||
cg_print (timesortsym)
|
||||
Sym ** timesortsym;
|
||||
cg_print (Sym ** timesortsym)
|
||||
{
|
||||
unsigned int index;
|
||||
Sym *parent;
|
||||
@ -560,9 +547,7 @@ cg_print (timesortsym)
|
||||
|
||||
|
||||
static int
|
||||
cmp_name (left, right)
|
||||
const PTR left;
|
||||
const PTR right;
|
||||
cmp_name (const PTR left, const PTR right)
|
||||
{
|
||||
const Sym **npp1 = (const Sym **) left;
|
||||
const Sym **npp2 = (const Sym **) right;
|
||||
@ -686,9 +671,7 @@ cg_print_index ()
|
||||
We want to sort in descending order. */
|
||||
|
||||
static int
|
||||
cmp_arc_count (left, right)
|
||||
const PTR left;
|
||||
const PTR right;
|
||||
cmp_arc_count (const PTR left, const PTR right)
|
||||
{
|
||||
const Arc **npp1 = (const Arc **) left;
|
||||
const Arc **npp2 = (const Arc **) right;
|
||||
@ -705,9 +688,7 @@ cmp_arc_count (left, right)
|
||||
We want to sort in descending order. */
|
||||
|
||||
static int
|
||||
cmp_fun_nuses (left, right)
|
||||
const PTR left;
|
||||
const PTR right;
|
||||
cmp_fun_nuses (const PTR left, const PTR right)
|
||||
{
|
||||
const Sym **npp1 = (const Sym **) left;
|
||||
const Sym **npp2 = (const Sym **) right;
|
||||
|
@ -23,9 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
extern double print_time; /* Total of time being printed. */
|
||||
|
||||
extern void cg_print PARAMS ((Sym **));
|
||||
extern void cg_print_index PARAMS ((void));
|
||||
extern void cg_print_file_ordering PARAMS ((void));
|
||||
extern void cg_print_function_ordering PARAMS ((void));
|
||||
extern void cg_print (Sym **);
|
||||
extern void cg_print_index (void);
|
||||
extern void cg_print_file_ordering (void);
|
||||
extern void cg_print_function_ordering (void);
|
||||
|
||||
#endif /* cg_print_h */
|
||||
|
@ -39,21 +39,20 @@ int offset_to_code;
|
||||
struct function_map *symbol_map;
|
||||
unsigned int symbol_map_count;
|
||||
|
||||
static void read_function_mappings PARAMS ((const char *));
|
||||
static int core_sym_class PARAMS ((asymbol *));
|
||||
static void read_function_mappings (const char *);
|
||||
static int core_sym_class (asymbol *);
|
||||
static bfd_boolean get_src_info
|
||||
PARAMS ((bfd_vma, const char **, const char **, int *));
|
||||
(bfd_vma, const char **, const char **, int *);
|
||||
|
||||
extern void i386_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
|
||||
extern void alpha_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
|
||||
extern void vax_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
|
||||
extern void tahoe_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
|
||||
extern void sparc_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
|
||||
extern void mips_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
|
||||
extern void i386_find_call (Sym *, bfd_vma, bfd_vma);
|
||||
extern void alpha_find_call (Sym *, bfd_vma, bfd_vma);
|
||||
extern void vax_find_call (Sym *, bfd_vma, bfd_vma);
|
||||
extern void tahoe_find_call (Sym *, bfd_vma, bfd_vma);
|
||||
extern void sparc_find_call (Sym *, bfd_vma, bfd_vma);
|
||||
extern void mips_find_call (Sym *, bfd_vma, bfd_vma);
|
||||
|
||||
static void
|
||||
read_function_mappings (filename)
|
||||
const char *filename;
|
||||
read_function_mappings (const char *filename)
|
||||
{
|
||||
FILE *file = fopen (filename, "r");
|
||||
char dummy[1024];
|
||||
@ -139,8 +138,7 @@ read_function_mappings (filename)
|
||||
|
||||
|
||||
void
|
||||
core_init (aout_name)
|
||||
const char *aout_name;
|
||||
core_init (const char *aout_name)
|
||||
{
|
||||
int core_sym_bytes;
|
||||
core_bfd = bfd_openr (aout_name, 0);
|
||||
@ -216,8 +214,7 @@ core_init (aout_name)
|
||||
/* Read in the text space of an a.out file. */
|
||||
|
||||
void
|
||||
core_get_text_space (cbfd)
|
||||
bfd *cbfd;
|
||||
core_get_text_space (bfd *cbfd)
|
||||
{
|
||||
core_text_space = (PTR) malloc ((unsigned int) core_text_sect->_raw_size);
|
||||
|
||||
@ -242,10 +239,7 @@ core_get_text_space (cbfd)
|
||||
|
||||
|
||||
void
|
||||
find_call (parent, p_lowpc, p_highpc)
|
||||
Sym *parent;
|
||||
bfd_vma p_lowpc;
|
||||
bfd_vma p_highpc;
|
||||
find_call (Sym *parent, bfd_vma p_lowpc, bfd_vma p_highpc)
|
||||
{
|
||||
switch (bfd_get_arch (core_bfd))
|
||||
{
|
||||
@ -288,8 +282,7 @@ find_call (parent, p_lowpc, p_highpc)
|
||||
't' -> symbol is a local (static) name. */
|
||||
|
||||
static int
|
||||
core_sym_class (sym)
|
||||
asymbol *sym;
|
||||
core_sym_class (asymbol *sym)
|
||||
{
|
||||
symbol_info syminfo;
|
||||
const char *name;
|
||||
@ -372,11 +365,7 @@ core_sym_class (sym)
|
||||
/* Get whatever source info we can get regarding address ADDR. */
|
||||
|
||||
static bfd_boolean
|
||||
get_src_info (addr, filename, name, line_num)
|
||||
bfd_vma addr;
|
||||
const char **filename;
|
||||
const char **name;
|
||||
int *line_num;
|
||||
get_src_info (bfd_vma addr, const char **filename, const char **name, int *line_num)
|
||||
{
|
||||
const char *fname = 0, *func_name = 0;
|
||||
int l = 0;
|
||||
|
@ -39,9 +39,9 @@ extern int min_insn_size; /* Size of smallest instruction, in bytes. */
|
||||
extern int offset_to_code; /* Offset (in bytes) of code from entry
|
||||
address of routine. */
|
||||
|
||||
extern void core_init PARAMS ((const char *));
|
||||
extern void core_get_text_space PARAMS ((bfd *));
|
||||
extern void core_create_function_syms PARAMS ((void));
|
||||
extern void core_create_line_syms PARAMS ((void));
|
||||
extern void core_init (const char *);
|
||||
extern void core_get_text_space (bfd *);
|
||||
extern void core_create_function_syms (void);
|
||||
extern void core_create_line_syms (void);
|
||||
|
||||
#endif /* corefile_h */
|
||||
|
@ -13,7 +13,7 @@ NR == 1 {
|
||||
print "}"
|
||||
curfun = FUNCTION
|
||||
print ""
|
||||
print "void ", FUNCTION, "PARAMS ((FILE *));"
|
||||
print "void ", FUNCTION, "(FILE *);"
|
||||
print "void";
|
||||
printf "%s (file)\n", FUNCTION
|
||||
print " FILE *file;";
|
||||
|
@ -44,17 +44,17 @@ enum gmon_ptr_signedness {
|
||||
ptr_unsigned
|
||||
};
|
||||
|
||||
static enum gmon_ptr_size gmon_get_ptr_size PARAMS ((void));
|
||||
static enum gmon_ptr_signedness gmon_get_ptr_signedness PARAMS ((void));
|
||||
static enum gmon_ptr_size gmon_get_ptr_size (void);
|
||||
static enum gmon_ptr_signedness gmon_get_ptr_signedness (void);
|
||||
|
||||
#ifdef BFD_HOST_U_64_BIT
|
||||
static int gmon_io_read_64 PARAMS ((FILE *, BFD_HOST_U_64_BIT *));
|
||||
static int gmon_io_write_64 PARAMS ((FILE *, BFD_HOST_U_64_BIT));
|
||||
static int gmon_io_read_64 (FILE *, BFD_HOST_U_64_BIT *);
|
||||
static int gmon_io_write_64 (FILE *, BFD_HOST_U_64_BIT);
|
||||
#endif
|
||||
static int gmon_read_raw_arc
|
||||
PARAMS ((FILE *, bfd_vma *, bfd_vma *, unsigned long *));
|
||||
(FILE *, bfd_vma *, bfd_vma *, unsigned long *);
|
||||
static int gmon_write_raw_arc
|
||||
PARAMS ((FILE *, bfd_vma, bfd_vma, unsigned long));
|
||||
(FILE *, bfd_vma, bfd_vma, unsigned long);
|
||||
|
||||
int gmon_input = 0;
|
||||
int gmon_file_version = 0; /* 0 == old (non-versioned) file format. */
|
||||
@ -98,9 +98,7 @@ gmon_get_ptr_signedness ()
|
||||
}
|
||||
|
||||
int
|
||||
gmon_io_read_32 (ifp, valp)
|
||||
FILE *ifp;
|
||||
unsigned int *valp;
|
||||
gmon_io_read_32 (FILE *ifp, unsigned int *valp)
|
||||
{
|
||||
char buf[4];
|
||||
|
||||
@ -112,9 +110,7 @@ gmon_io_read_32 (ifp, valp)
|
||||
|
||||
#ifdef BFD_HOST_U_64_BIT
|
||||
static int
|
||||
gmon_io_read_64 (ifp, valp)
|
||||
FILE *ifp;
|
||||
BFD_HOST_U_64_BIT *valp;
|
||||
gmon_io_read_64 (FILE *ifp, BFD_HOST_U_64_BIT *valp)
|
||||
{
|
||||
char buf[8];
|
||||
|
||||
@ -126,9 +122,7 @@ gmon_io_read_64 (ifp, valp)
|
||||
#endif
|
||||
|
||||
int
|
||||
gmon_io_read_vma (ifp, valp)
|
||||
FILE *ifp;
|
||||
bfd_vma *valp;
|
||||
gmon_io_read_vma (FILE *ifp, bfd_vma *valp)
|
||||
{
|
||||
unsigned int val32;
|
||||
#ifdef BFD_HOST_U_64_BIT
|
||||
@ -163,10 +157,7 @@ gmon_io_read_vma (ifp, valp)
|
||||
}
|
||||
|
||||
int
|
||||
gmon_io_read (ifp, buf, n)
|
||||
FILE *ifp;
|
||||
char *buf;
|
||||
size_t n;
|
||||
gmon_io_read (FILE *ifp, char *buf, size_t n)
|
||||
{
|
||||
if (fread (buf, 1, n, ifp) != n)
|
||||
return 1;
|
||||
@ -174,9 +165,7 @@ gmon_io_read (ifp, buf, n)
|
||||
}
|
||||
|
||||
int
|
||||
gmon_io_write_32 (ofp, val)
|
||||
FILE *ofp;
|
||||
unsigned int val;
|
||||
gmon_io_write_32 (FILE *ofp, unsigned int val)
|
||||
{
|
||||
char buf[4];
|
||||
|
||||
@ -188,9 +177,7 @@ gmon_io_write_32 (ofp, val)
|
||||
|
||||
#ifdef BFD_HOST_U_64_BIT
|
||||
static int
|
||||
gmon_io_write_64 (ofp, val)
|
||||
FILE *ofp;
|
||||
BFD_HOST_U_64_BIT val;
|
||||
gmon_io_write_64 (FILE *ofp, BFD_HOST_U_64_BIT val)
|
||||
{
|
||||
char buf[8];
|
||||
|
||||
@ -202,9 +189,7 @@ gmon_io_write_64 (ofp, val)
|
||||
#endif
|
||||
|
||||
int
|
||||
gmon_io_write_vma (ofp, val)
|
||||
FILE *ofp;
|
||||
bfd_vma val;
|
||||
gmon_io_write_vma (FILE *ofp, bfd_vma val)
|
||||
{
|
||||
|
||||
switch (gmon_get_ptr_size ())
|
||||
@ -225,9 +210,7 @@ gmon_io_write_vma (ofp, val)
|
||||
}
|
||||
|
||||
int
|
||||
gmon_io_write_8 (ofp, val)
|
||||
FILE *ofp;
|
||||
unsigned int val;
|
||||
gmon_io_write_8 (FILE *ofp, unsigned int val)
|
||||
{
|
||||
char buf[1];
|
||||
|
||||
@ -238,10 +221,7 @@ gmon_io_write_8 (ofp, val)
|
||||
}
|
||||
|
||||
int
|
||||
gmon_io_write (ofp, buf, n)
|
||||
FILE *ofp;
|
||||
char *buf;
|
||||
size_t n;
|
||||
gmon_io_write (FILE *ofp, char *buf, size_t n)
|
||||
{
|
||||
if (fwrite (buf, 1, n, ofp) != n)
|
||||
return 1;
|
||||
@ -249,11 +229,7 @@ gmon_io_write (ofp, buf, n)
|
||||
}
|
||||
|
||||
static int
|
||||
gmon_read_raw_arc (ifp, fpc, spc, cnt)
|
||||
FILE *ifp;
|
||||
bfd_vma *fpc;
|
||||
bfd_vma *spc;
|
||||
unsigned long *cnt;
|
||||
gmon_read_raw_arc (FILE *ifp, bfd_vma *fpc, bfd_vma *spc, unsigned long *cnt)
|
||||
{
|
||||
#ifdef BFD_HOST_U_64_BIT
|
||||
BFD_HOST_U_64_BIT cnt64;
|
||||
@ -284,11 +260,7 @@ gmon_read_raw_arc (ifp, fpc, spc, cnt)
|
||||
}
|
||||
|
||||
static int
|
||||
gmon_write_raw_arc (ofp, fpc, spc, cnt)
|
||||
FILE *ofp;
|
||||
bfd_vma fpc;
|
||||
bfd_vma spc;
|
||||
unsigned long cnt;
|
||||
gmon_write_raw_arc (FILE *ofp, bfd_vma fpc, bfd_vma spc, unsigned long cnt)
|
||||
{
|
||||
|
||||
if (gmon_io_write_vma (ofp, fpc)
|
||||
@ -313,8 +285,7 @@ gmon_write_raw_arc (ofp, fpc, spc, cnt)
|
||||
}
|
||||
|
||||
void
|
||||
gmon_out_read (filename)
|
||||
const char *filename;
|
||||
gmon_out_read (const char *filename)
|
||||
{
|
||||
FILE *ifp;
|
||||
struct gmon_hdr ghdr;
|
||||
@ -619,8 +590,7 @@ gmon_out_read (filename)
|
||||
|
||||
|
||||
void
|
||||
gmon_out_write (filename)
|
||||
const char *filename;
|
||||
gmon_out_write (const char *filename)
|
||||
{
|
||||
FILE *ofp;
|
||||
struct gmon_hdr ghdr;
|
||||
|
@ -46,15 +46,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
extern int gmon_input; /* What input did we see? */
|
||||
extern int gmon_file_version; /* File version are we dealing with. */
|
||||
|
||||
extern int gmon_io_read_vma PARAMS ((FILE *ifp, bfd_vma *valp));
|
||||
extern int gmon_io_read_32 PARAMS ((FILE *ifp, unsigned int *valp));
|
||||
extern int gmon_io_read PARAMS ((FILE *ifp, char *buf, size_t n));
|
||||
extern int gmon_io_write_vma PARAMS ((FILE *ifp, bfd_vma val));
|
||||
extern int gmon_io_write_32 PARAMS ((FILE *ifp, unsigned int val));
|
||||
extern int gmon_io_write_8 PARAMS ((FILE *ifp, unsigned int val));
|
||||
extern int gmon_io_write PARAMS ((FILE *ifp, char *buf, size_t n));
|
||||
extern int gmon_io_read_vma (FILE *ifp, bfd_vma *valp);
|
||||
extern int gmon_io_read_32 (FILE *ifp, unsigned int *valp);
|
||||
extern int gmon_io_read (FILE *ifp, char *buf, size_t n);
|
||||
extern int gmon_io_write_vma (FILE *ifp, bfd_vma val);
|
||||
extern int gmon_io_write_32 (FILE *ifp, unsigned int val);
|
||||
extern int gmon_io_write_8 (FILE *ifp, unsigned int val);
|
||||
extern int gmon_io_write (FILE *ifp, char *buf, size_t n);
|
||||
|
||||
extern void gmon_out_read PARAMS ((const char *));
|
||||
extern void gmon_out_write PARAMS ((const char *));
|
||||
extern void gmon_out_read (const char *);
|
||||
extern void gmon_out_write (const char *);
|
||||
|
||||
#endif /* gmon_io_h */
|
||||
|
@ -44,8 +44,8 @@
|
||||
#include "demangle.h"
|
||||
#include "getopt.h"
|
||||
|
||||
static void usage PARAMS ((FILE *, int)) ATTRIBUTE_NORETURN;
|
||||
int main PARAMS ((int, char **));
|
||||
static void usage (FILE *, int) ATTRIBUTE_NORETURN;
|
||||
int main (int, char **);
|
||||
|
||||
const char *whoami;
|
||||
const char *function_mapping_file;
|
||||
@ -156,9 +156,7 @@ static struct option long_options[] =
|
||||
|
||||
|
||||
static void
|
||||
usage (stream, status)
|
||||
FILE *stream;
|
||||
int status;
|
||||
usage (FILE *stream, int status)
|
||||
{
|
||||
fprintf (stream, _("\
|
||||
Usage: %s [-[abcDhilLsTvwxyz]] [-[ACeEfFJnNOpPqQZ][name]] [-I dirs]\n\
|
||||
@ -182,9 +180,7 @@ Usage: %s [-[abcDhilLsTvwxyz]] [-[ACeEfFJnNOpPqQZ][name]] [-I dirs]\n\
|
||||
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char **sp, *str;
|
||||
Sym **cg = 0;
|
||||
@ -650,8 +646,7 @@ This program is free software. This program has absolutely no warranty.\n"));
|
||||
}
|
||||
|
||||
void
|
||||
done (status)
|
||||
int status;
|
||||
done (int status)
|
||||
{
|
||||
exit (status);
|
||||
}
|
||||
|
@ -134,6 +134,6 @@ extern File_Format file_format; /* requested file format */
|
||||
|
||||
extern bfd_boolean first_output; /* no output so far? */
|
||||
|
||||
extern void done PARAMS ((int status)) ATTRIBUTE_NORETURN;
|
||||
extern void done (int status) ATTRIBUTE_NORETURN;
|
||||
|
||||
#endif /* gprof_h */
|
||||
|
@ -8,6 +8,6 @@
|
||||
* we return HZ_WRONG, an impossible sampling frequency.
|
||||
*/
|
||||
|
||||
extern int hertz PARAMS ((void));
|
||||
extern int hertz (void);
|
||||
|
||||
#endif /* hertz_h */
|
||||
|
29
gprof/hist.c
29
gprof/hist.c
@ -33,13 +33,13 @@
|
||||
|
||||
#define UNITS_TO_CODE (offset_to_code / sizeof(UNIT))
|
||||
|
||||
static void scale_and_align_entries PARAMS ((void));
|
||||
static void print_header PARAMS ((int));
|
||||
static void print_line PARAMS ((Sym *, double));
|
||||
static int cmp_time PARAMS ((const PTR, const PTR));
|
||||
static void scale_and_align_entries (void);
|
||||
static void print_header (int);
|
||||
static void print_line (Sym *, double);
|
||||
static int cmp_time (const PTR, const PTR);
|
||||
|
||||
/* Declarations of automatically generated functions to output blurbs. */
|
||||
extern void flat_blurb PARAMS ((FILE * fp));
|
||||
extern void flat_blurb (FILE * fp);
|
||||
|
||||
bfd_vma s_lowpc; /* Lowest address in .text. */
|
||||
bfd_vma s_highpc = 0; /* Highest address in .text. */
|
||||
@ -80,9 +80,7 @@ SItab[] =
|
||||
is provided for formatting error messages only. */
|
||||
|
||||
void
|
||||
hist_read_rec (ifp, filename)
|
||||
FILE * ifp;
|
||||
const char *filename;
|
||||
hist_read_rec (FILE * ifp, const char *filename)
|
||||
{
|
||||
bfd_vma n_lowpc, n_highpc;
|
||||
int i, ncnt, profrate;
|
||||
@ -157,9 +155,7 @@ hist_read_rec (ifp, filename)
|
||||
of OFP and is provided for formatting error-messages only. */
|
||||
|
||||
void
|
||||
hist_write_hist (ofp, filename)
|
||||
FILE * ofp;
|
||||
const char *filename;
|
||||
hist_write_hist (FILE * ofp, const char *filename)
|
||||
{
|
||||
UNIT count;
|
||||
int i;
|
||||
@ -351,8 +347,7 @@ hist_assign_samples ()
|
||||
/* Print header for flag histogram profile. */
|
||||
|
||||
static void
|
||||
print_header (prefix)
|
||||
int prefix;
|
||||
print_header (int prefix)
|
||||
{
|
||||
char unit[64];
|
||||
|
||||
@ -391,9 +386,7 @@ print_header (prefix)
|
||||
|
||||
|
||||
static void
|
||||
print_line (sym, scale)
|
||||
Sym *sym;
|
||||
double scale;
|
||||
print_line (Sym *sym, double scale)
|
||||
{
|
||||
if (ignore_zeros && sym->ncalls == 0 && sym->hist.time == 0)
|
||||
return;
|
||||
@ -430,9 +423,7 @@ print_line (sym, scale)
|
||||
lexicographic order of the function names. */
|
||||
|
||||
static int
|
||||
cmp_time (lp, rp)
|
||||
const PTR lp;
|
||||
const PTR rp;
|
||||
cmp_time (const PTR lp, const PTR rp)
|
||||
{
|
||||
const Sym *left = *(const Sym **) lp;
|
||||
const Sym *right = *(const Sym **) rp;
|
||||
|
@ -32,9 +32,9 @@ extern int *hist_sample; /* Code histogram. */
|
||||
extern double hist_scale;
|
||||
|
||||
|
||||
extern void hist_read_rec PARAMS ((FILE *, const char *));
|
||||
extern void hist_write_hist PARAMS ((FILE *, const char *));
|
||||
extern void hist_assign_samples PARAMS ((void));
|
||||
extern void hist_print PARAMS ((void));
|
||||
extern void hist_read_rec (FILE *, const char *);
|
||||
extern void hist_write_hist (FILE *, const char *);
|
||||
extern void hist_assign_samples (void);
|
||||
extern void hist_print (void);
|
||||
|
||||
#endif /* hist_h */
|
||||
|
12
gprof/i386.c
12
gprof/i386.c
@ -34,12 +34,11 @@
|
||||
#include "corefile.h"
|
||||
#include "hist.h"
|
||||
|
||||
static int i386_iscall PARAMS ((unsigned char *));
|
||||
void i386_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
|
||||
static int i386_iscall (unsigned char *);
|
||||
void i386_find_call (Sym *, bfd_vma, bfd_vma);
|
||||
|
||||
static int
|
||||
i386_iscall (ip)
|
||||
unsigned char *ip;
|
||||
i386_iscall (unsigned char *ip)
|
||||
{
|
||||
if (*ip == 0xe8)
|
||||
return 1;
|
||||
@ -48,10 +47,7 @@ i386_iscall (ip)
|
||||
|
||||
|
||||
void
|
||||
i386_find_call (parent, p_lowpc, p_highpc)
|
||||
Sym *parent;
|
||||
bfd_vma p_lowpc;
|
||||
bfd_vma p_highpc;
|
||||
i386_find_call (Sym *parent, bfd_vma p_lowpc, bfd_vma p_highpc)
|
||||
{
|
||||
unsigned char *instructp;
|
||||
Sym *child;
|
||||
|
@ -36,13 +36,10 @@
|
||||
|
||||
static Sym indirect_child;
|
||||
|
||||
void mips_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
|
||||
void mips_find_call (Sym *, bfd_vma, bfd_vma);
|
||||
|
||||
void
|
||||
mips_find_call (parent, p_lowpc, p_highpc)
|
||||
Sym *parent;
|
||||
bfd_vma p_lowpc;
|
||||
bfd_vma p_highpc;
|
||||
mips_find_call (Sym *parent, bfd_vma p_lowpc, bfd_vma p_highpc)
|
||||
{
|
||||
bfd_vma pc, dest_pc;
|
||||
unsigned int op;
|
||||
|
@ -25,9 +25,7 @@
|
||||
|
||||
|
||||
void
|
||||
search_list_append (list, paths)
|
||||
Search_List *list;
|
||||
const char *paths;
|
||||
search_list_append (Search_List *list, const char *paths)
|
||||
{
|
||||
Search_List_Elem *new_el;
|
||||
const char *beg, *colon;
|
||||
|
@ -43,6 +43,6 @@ typedef struct
|
||||
}
|
||||
Search_List;
|
||||
|
||||
extern void search_list_append PARAMS ((Search_List *, const char *));
|
||||
extern void search_list_append (Search_List *, const char *);
|
||||
|
||||
#endif /* search_list_h */
|
||||
|
@ -35,8 +35,7 @@ Source_File *first_src_file = 0;
|
||||
|
||||
|
||||
Source_File *
|
||||
source_file_lookup_path (path)
|
||||
const char *path;
|
||||
source_file_lookup_path (const char *path)
|
||||
{
|
||||
Source_File *sf;
|
||||
|
||||
@ -63,8 +62,7 @@ source_file_lookup_path (path)
|
||||
|
||||
|
||||
Source_File *
|
||||
source_file_lookup_name (filename)
|
||||
const char *filename;
|
||||
source_file_lookup_name (const char *filename)
|
||||
{
|
||||
const char *fname;
|
||||
Source_File *sf;
|
||||
@ -91,11 +89,9 @@ source_file_lookup_name (filename)
|
||||
|
||||
|
||||
FILE *
|
||||
annotate_source (sf, max_width, annote, arg)
|
||||
Source_File *sf;
|
||||
unsigned int max_width;
|
||||
void (*annote) PARAMS ((char *, unsigned int, int, void *));
|
||||
void *arg;
|
||||
annotate_source (Source_File *sf, unsigned int max_width,
|
||||
void (*annote) (char *, unsigned int, int, void *),
|
||||
void *arg)
|
||||
{
|
||||
static bfd_boolean first_file = TRUE;
|
||||
int i, line_num, nread;
|
||||
|
@ -44,8 +44,8 @@ extern Search_List src_search_list;
|
||||
extern Source_File *first_src_file;
|
||||
|
||||
/* Returns pointer to source file descriptor for PATH/FILENAME. */
|
||||
extern Source_File *source_file_lookup_path PARAMS ((const char *));
|
||||
extern Source_File *source_file_lookup_name PARAMS ((const char *));
|
||||
extern Source_File *source_file_lookup_path (const char *);
|
||||
extern Source_File *source_file_lookup_name (const char *);
|
||||
|
||||
/* Read source file SF output annotated source. The annotation is at
|
||||
MAX_WIDTH characters wide and for each source-line an annotation is
|
||||
@ -56,7 +56,7 @@ extern Source_File *source_file_lookup_name PARAMS ((const char *));
|
||||
that summary statistics can be printed. If the returned file
|
||||
is not stdout, it should be closed when done with it. */
|
||||
extern FILE *annotate_source
|
||||
PARAMS ((Source_File *sf, unsigned int max_width,
|
||||
(Source_File *sf, unsigned int max_width,
|
||||
void (*annote) (char *, unsigned int, int, PTR arg),
|
||||
PTR arg));
|
||||
PTR arg);
|
||||
#endif /* source_h */
|
||||
|
@ -39,13 +39,10 @@
|
||||
*/
|
||||
#define CALL (0xc0000000)
|
||||
|
||||
void sparc_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
|
||||
void sparc_find_call (Sym *, bfd_vma, bfd_vma);
|
||||
|
||||
void
|
||||
sparc_find_call (parent, p_lowpc, p_highpc)
|
||||
Sym *parent;
|
||||
bfd_vma p_lowpc;
|
||||
bfd_vma p_highpc;
|
||||
sparc_find_call (Sym *parent, bfd_vma p_lowpc, bfd_vma p_highpc)
|
||||
{
|
||||
bfd_vma pc, dest_pc;
|
||||
unsigned int insn;
|
||||
|
@ -47,13 +47,13 @@ struct sym_id
|
||||
*id_list;
|
||||
|
||||
static void parse_spec
|
||||
PARAMS ((char *, Sym *));
|
||||
(char *, Sym *);
|
||||
static void parse_id
|
||||
PARAMS ((struct sym_id *));
|
||||
(struct sym_id *);
|
||||
static bfd_boolean match
|
||||
PARAMS ((Sym *, Sym *));
|
||||
(Sym *, Sym *);
|
||||
static void extend_match
|
||||
PARAMS ((struct match *, Sym *, Sym_Table *, bfd_boolean));
|
||||
(struct match *, Sym *, Sym_Table *, bfd_boolean);
|
||||
|
||||
|
||||
Sym_Table syms[NUM_TABLES];
|
||||
@ -84,9 +84,7 @@ static Source_File non_existent_file =
|
||||
|
||||
|
||||
void
|
||||
sym_id_add (spec, which_table)
|
||||
const char *spec;
|
||||
Table_Id which_table;
|
||||
sym_id_add (const char *spec, Table_Id which_table)
|
||||
{
|
||||
struct sym_id *id;
|
||||
int len = strlen (spec);
|
||||
@ -114,9 +112,7 @@ sym_id_add (spec, which_table)
|
||||
FILENAME not containing a dot can be specified by FILENAME. */
|
||||
|
||||
static void
|
||||
parse_spec (spec, sym)
|
||||
char *spec;
|
||||
Sym *sym;
|
||||
parse_spec (char *spec, Sym *sym)
|
||||
{
|
||||
char *colon;
|
||||
|
||||
@ -171,8 +167,7 @@ parse_spec (spec, sym)
|
||||
by parse_spec(). */
|
||||
|
||||
static void
|
||||
parse_id (id)
|
||||
struct sym_id *id;
|
||||
parse_id (struct sym_id *id)
|
||||
{
|
||||
char *slash;
|
||||
|
||||
@ -221,9 +216,7 @@ parse_id (id)
|
||||
/* Return TRUE iff PATTERN matches SYM. */
|
||||
|
||||
static bfd_boolean
|
||||
match (pattern, sym)
|
||||
Sym *pattern;
|
||||
Sym *sym;
|
||||
match (Sym *pattern, Sym *sym)
|
||||
{
|
||||
return (pattern->file ? pattern->file == sym->file : TRUE)
|
||||
&& (pattern->line_num ? pattern->line_num == sym->line_num : TRUE)
|
||||
@ -235,11 +228,7 @@ match (pattern, sym)
|
||||
|
||||
|
||||
static void
|
||||
extend_match (m, sym, tab, second_pass)
|
||||
struct match *m;
|
||||
Sym *sym;
|
||||
Sym_Table *tab;
|
||||
bfd_boolean second_pass;
|
||||
extend_match (struct match *m, Sym *sym, Sym_Table *tab, bfd_boolean second_pass)
|
||||
{
|
||||
if (m->prev_match != sym - 1)
|
||||
{
|
||||
@ -373,10 +362,7 @@ sym_id_parse ()
|
||||
very big (the user has to type them!), so a linear search is probably
|
||||
tolerable. */
|
||||
bfd_boolean
|
||||
sym_id_arc_is_present (sym_tab, from, to)
|
||||
Sym_Table *sym_tab;
|
||||
Sym *from;
|
||||
Sym *to;
|
||||
sym_id_arc_is_present (Sym_Table *sym_tab, Sym *from, Sym *to)
|
||||
{
|
||||
Sym *sym;
|
||||
|
||||
|
@ -35,8 +35,8 @@ Table_Id;
|
||||
|
||||
extern Sym_Table syms[NUM_TABLES];
|
||||
|
||||
extern void sym_id_add PARAMS ((const char *, Table_Id));
|
||||
extern void sym_id_parse PARAMS ((void));
|
||||
extern bfd_boolean sym_id_arc_is_present PARAMS ((Sym_Table *, Sym *, Sym *));
|
||||
extern void sym_id_add (const char *, Table_Id);
|
||||
extern void sym_id_parse (void);
|
||||
extern bfd_boolean sym_id_arc_is_present (Sym_Table *, Sym *, Sym *);
|
||||
|
||||
#endif /* sym_ids_h */
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "cg_arcs.h"
|
||||
#include "corefile.h"
|
||||
|
||||
static int cmp_addr PARAMS ((const PTR, const PTR));
|
||||
static int cmp_addr (const PTR, const PTR);
|
||||
|
||||
Sym_Table symtab;
|
||||
|
||||
@ -34,8 +34,7 @@ Sym_Table symtab;
|
||||
/* Initialize a symbol (so it's empty). */
|
||||
|
||||
void
|
||||
sym_init (sym)
|
||||
Sym *sym;
|
||||
sym_init (Sym *sym)
|
||||
{
|
||||
memset (sym, 0, sizeof (*sym));
|
||||
|
||||
@ -59,9 +58,7 @@ sym_init (sym)
|
||||
the global symbol survives. */
|
||||
|
||||
static int
|
||||
cmp_addr (lp, rp)
|
||||
const PTR lp;
|
||||
const PTR rp;
|
||||
cmp_addr (const PTR lp, const PTR rp)
|
||||
{
|
||||
const Sym *left = (const Sym *) lp;
|
||||
const Sym *right = (const Sym *) rp;
|
||||
@ -79,8 +76,7 @@ cmp_addr (lp, rp)
|
||||
|
||||
|
||||
void
|
||||
symtab_finalize (tab)
|
||||
Sym_Table *tab;
|
||||
symtab_finalize (Sym_Table *tab)
|
||||
{
|
||||
Sym *src, *dst;
|
||||
bfd_vma prev_addr;
|
||||
@ -177,9 +173,7 @@ symtab_finalize (tab)
|
||||
#ifdef DEBUG
|
||||
|
||||
Sym *
|
||||
dbg_sym_lookup (sym_tab, address)
|
||||
Sym_Table *sym_tab;
|
||||
bfd_vma address;
|
||||
dbg_sym_lookup (Sym_Table *sym_tab, bfd_vma address)
|
||||
{
|
||||
long low, mid, high;
|
||||
Sym *sym;
|
||||
@ -218,9 +212,7 @@ dbg_sym_lookup (sym_tab, address)
|
||||
/* Look up an address in the symbol-table that is sorted by address.
|
||||
If address does not hit any symbol, 0 is returned. */
|
||||
Sym *
|
||||
sym_lookup (sym_tab, address)
|
||||
Sym_Table *sym_tab;
|
||||
bfd_vma address;
|
||||
sym_lookup (Sym_Table *sym_tab, bfd_vma address)
|
||||
{
|
||||
long low, high;
|
||||
long mid = -1;
|
||||
|
@ -111,12 +111,12 @@ Sym_Table;
|
||||
|
||||
extern Sym_Table symtab; /* The symbol table. */
|
||||
|
||||
extern void sym_init PARAMS ((Sym *));
|
||||
extern void symtab_finalize PARAMS ((Sym_Table *));
|
||||
extern void sym_init (Sym *);
|
||||
extern void symtab_finalize (Sym_Table *);
|
||||
#ifdef DEBUG
|
||||
extern Sym *dbg_sym_lookup PARAMS ((Sym_Table *, bfd_vma));
|
||||
extern Sym *dbg_sym_lookup (Sym_Table *, bfd_vma);
|
||||
#endif
|
||||
extern Sym *sym_lookup PARAMS ((Sym_Table *, bfd_vma));
|
||||
extern void find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
|
||||
extern Sym *sym_lookup (Sym_Table *, bfd_vma);
|
||||
extern void find_call (Sym *, bfd_vma, bfd_vma);
|
||||
|
||||
#endif /* symtab_h */
|
||||
|
@ -58,15 +58,14 @@ typedef enum tahoe_opermodes tahoe_operandenum;
|
||||
*/
|
||||
static Sym indirectchild;
|
||||
|
||||
static tahoe_operandenum tahoe_operandmode PARAMS ((unsigned char *));
|
||||
static char *tahoe_operandname PARAMS ((tahoe_operandenum));
|
||||
static long tahoe_operandlength PARAMS ((unsigned char *));
|
||||
static bfd_signed_vma tahoe_offset PARAMS ((unsigned char *));
|
||||
void tahoe_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
|
||||
static tahoe_operandenum tahoe_operandmode (unsigned char *);
|
||||
static char *tahoe_operandname (tahoe_operandenum);
|
||||
static long tahoe_operandlength (unsigned char *);
|
||||
static bfd_signed_vma tahoe_offset (unsigned char *);
|
||||
void tahoe_find_call (Sym *, bfd_vma, bfd_vma);
|
||||
|
||||
static tahoe_operandenum
|
||||
tahoe_operandmode (modep)
|
||||
unsigned char *modep;
|
||||
tahoe_operandmode (unsigned char *modep)
|
||||
{
|
||||
long usesreg = *modep & 0xf;
|
||||
|
||||
@ -107,8 +106,7 @@ tahoe_operandmode (modep)
|
||||
}
|
||||
|
||||
static char *
|
||||
tahoe_operandname (mode)
|
||||
tahoe_operandenum mode;
|
||||
tahoe_operandname (tahoe_operandenum mode)
|
||||
{
|
||||
|
||||
switch (mode)
|
||||
@ -161,8 +159,8 @@ tahoe_operandname (mode)
|
||||
}
|
||||
|
||||
static long
|
||||
tahoe_operandlength (modep)
|
||||
unsigned char *modep;
|
||||
tahoe_operandlength (unsigned char *modep
|
||||
)
|
||||
{
|
||||
|
||||
switch (tahoe_operandmode (modep))
|
||||
@ -199,8 +197,7 @@ tahoe_operandlength (modep)
|
||||
}
|
||||
|
||||
static bfd_signed_vma
|
||||
tahoe_offset (modep)
|
||||
unsigned char *modep;
|
||||
tahoe_offset (unsigned char *modep)
|
||||
{
|
||||
tahoe_operandenum mode = tahoe_operandmode (modep);
|
||||
|
||||
@ -220,10 +217,7 @@ tahoe_offset (modep)
|
||||
}
|
||||
|
||||
void
|
||||
tahoe_find_call (parent, p_lowpc, p_highpc)
|
||||
Sym *parent;
|
||||
bfd_vma p_lowpc;
|
||||
bfd_vma p_highpc;
|
||||
tahoe_find_call (Sym *parent, bfd_vma p_lowpc, bfd_vma p_highpc)
|
||||
{
|
||||
unsigned char *instructp;
|
||||
long length;
|
||||
|
@ -39,8 +39,7 @@
|
||||
* Print name of symbol. Return number of characters printed.
|
||||
*/
|
||||
int
|
||||
print_name_only (self)
|
||||
Sym *self;
|
||||
print_name_only (Sym *self)
|
||||
{
|
||||
const char *name = self->name;
|
||||
const char *filename;
|
||||
@ -99,8 +98,7 @@ print_name_only (self)
|
||||
|
||||
|
||||
void
|
||||
print_name (self)
|
||||
Sym *self;
|
||||
print_name (Sym *self)
|
||||
{
|
||||
print_name_only (self);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef utils_h
|
||||
#define utils_h
|
||||
|
||||
extern int print_name_only PARAMS ((Sym * self));
|
||||
extern void print_name PARAMS ((Sym * self));
|
||||
extern int print_name_only (Sym * self);
|
||||
extern void print_name (Sym * self);
|
||||
|
||||
#endif /* utils_h */
|
||||
|
27
gprof/vax.c
27
gprof/vax.c
@ -68,15 +68,14 @@ struct modebyte
|
||||
*/
|
||||
static Sym indirectchild;
|
||||
|
||||
static operandenum vax_operandmode PARAMS ((unsigned char *));
|
||||
static char *vax_operandname PARAMS ((operandenum));
|
||||
static long vax_operandlength PARAMS ((unsigned char *));
|
||||
static bfd_signed_vma vax_offset PARAMS ((unsigned char *));
|
||||
void vax_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
|
||||
static operandenum vax_operandmode (unsigned char *);
|
||||
static char *vax_operandname (operandenum);
|
||||
static long vax_operandlength (unsigned char *);
|
||||
static bfd_signed_vma vax_offset (unsigned char *);
|
||||
void vax_find_call (Sym *, bfd_vma, bfd_vma);
|
||||
|
||||
static operandenum
|
||||
vax_operandmode (modep)
|
||||
unsigned char *modep;
|
||||
vax_operandmode (unsigned char *modep)
|
||||
{
|
||||
int usesreg = *modep & 0xf;
|
||||
|
||||
@ -117,8 +116,7 @@ vax_operandmode (modep)
|
||||
}
|
||||
|
||||
static char *
|
||||
vax_operandname (mode)
|
||||
operandenum mode;
|
||||
vax_operandname (operandenum mode)
|
||||
{
|
||||
|
||||
switch (mode)
|
||||
@ -171,8 +169,7 @@ vax_operandname (mode)
|
||||
}
|
||||
|
||||
static long
|
||||
vax_operandlength (modep)
|
||||
unsigned char *modep;
|
||||
vax_operandlength (unsigned char *modep)
|
||||
{
|
||||
|
||||
switch (vax_operandmode (modep))
|
||||
@ -209,8 +206,7 @@ vax_operandlength (modep)
|
||||
}
|
||||
|
||||
static bfd_signed_vma
|
||||
vax_offset (modep)
|
||||
unsigned char *modep;
|
||||
vax_offset (unsigned char *modep)
|
||||
{
|
||||
operandenum mode = vax_operandmode (modep);
|
||||
|
||||
@ -231,10 +227,7 @@ vax_offset (modep)
|
||||
|
||||
|
||||
void
|
||||
vax_find_call (parent, p_lowpc, p_highpc)
|
||||
Sym *parent;
|
||||
bfd_vma p_lowpc;
|
||||
bfd_vma p_highpc;
|
||||
vax_find_call (Sym *parent, bfd_vma p_lowpc, bfd_vma p_highpc)
|
||||
{
|
||||
unsigned char *instructp;
|
||||
long length;
|
||||
|
Loading…
x
Reference in New Issue
Block a user