aboutsummaryrefslogtreecommitdiff
path: root/gprof
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2002-02-01 08:24:16 +0000
committerAlan Modra <amodra@gmail.com>2002-02-01 08:24:16 +0000
commit1355568ab48a9dcfd079493f7deb5e1c5e88015b (patch)
tree9b1cc576a383708096f9c89c5800bd25f6126768 /gprof
parent48fa4a5def1116273c2c2a236939e96eb9b6231a (diff)
downloadgdb-1355568ab48a9dcfd079493f7deb5e1c5e88015b.zip
gdb-1355568ab48a9dcfd079493f7deb5e1c5e88015b.tar.gz
gdb-1355568ab48a9dcfd079493f7deb5e1c5e88015b.tar.bz2
* alpha.c (alpha_find_call): Warning fixes.
* mips.c (mips_find_call): Likewise. * sparc.c (sparc_find_call): Likewise. * basic_blocks.c: Warning fixes. Eliminate DEFUN. * call_graph.c: Likewise. * cg_arcs.c: Likewise. * cg_dfn.cp: Likewise. * gprof.c: Likewise. * gprof.h: Likewise. * hist.c: Likewise. * search_list.c: Likewise. * source.c: Likewise. * source.h: Likewise. * sym_ids.c: Likewise. * symtab.c: Likewise. * symtab.h: Likewise. * utils.c: Likewise. * cg_print.c: Likewise. (struct function_map, symbol_map, symbol_map_count): Move declaration to.. * corefile: ..here. * corefile.c: Warning fixes. Eliminate DEFUN. (struct function_map): Remove declaration. * gmon_io.c: Warning fixes. Eliminate DEFUN. (gmon_io_read_64): Make static. (gmon_io_write_64): Likewise. (gmon_read_raw_arc): Likewise. (gmon_write_raw_arc): Likewise. (gmon_io_write_8): Don't pass char, pass int param. * gmon_io.h (gmon_io_write_8): Likewise. and a few copyright dates that should have been done previously.
Diffstat (limited to 'gprof')
-rw-r--r--gprof/ChangeLog31
-rw-r--r--gprof/alpha.c4
-rw-r--r--gprof/basic_blocks.c51
-rw-r--r--gprof/basic_blocks.h2
-rw-r--r--gprof/call_graph.c18
-rw-r--r--gprof/cg_arcs.c41
-rw-r--r--gprof/cg_dfn.c24
-rw-r--r--gprof/cg_print.c142
-rw-r--r--gprof/corefile.c79
-rw-r--r--gprof/corefile.h11
-rw-r--r--gprof/gmon_io.c82
-rw-r--r--gprof/gmon_io.h4
-rw-r--r--gprof/gprof.c11
-rw-r--r--gprof/gprof.h2
-rw-r--r--gprof/hist.c30
-rw-r--r--gprof/mips.c2
-rw-r--r--gprof/search_list.c9
-rw-r--r--gprof/source.c17
-rw-r--r--gprof/source.h10
-rw-r--r--gprof/sparc.c4
-rw-r--r--gprof/sym_ids.c41
-rw-r--r--gprof/sym_ids.h2
-rw-r--r--gprof/symtab.c40
-rw-r--r--gprof/symtab.h5
-rw-r--r--gprof/utils.c7
25 files changed, 446 insertions, 223 deletions
diff --git a/gprof/ChangeLog b/gprof/ChangeLog
index 97577a5..89df97f 100644
--- a/gprof/ChangeLog
+++ b/gprof/ChangeLog
@@ -1,5 +1,36 @@
2002-02-01 Alan Modra <amodra@bigpond.net.au>
+ * alpha.c (alpha_find_call): Warning fixes.
+ * mips.c (mips_find_call): Likewise.
+ * sparc.c (sparc_find_call): Likewise.
+ * basic_blocks.c: Warning fixes. Eliminate DEFUN.
+ * call_graph.c: Likewise.
+ * cg_arcs.c: Likewise.
+ * cg_dfn.cp: Likewise.
+ * gprof.c: Likewise.
+ * gprof.h: Likewise.
+ * hist.c: Likewise.
+ * search_list.c: Likewise.
+ * source.c: Likewise.
+ * source.h: Likewise.
+ * sym_ids.c: Likewise.
+ * symtab.c: Likewise.
+ * symtab.h: Likewise.
+ * utils.c: Likewise.
+ * cg_print.c: Likewise.
+ (struct function_map, symbol_map, symbol_map_count): Move
+ declaration to..
+ * corefile: ..here.
+ * corefile.c: Warning fixes. Eliminate DEFUN.
+ (struct function_map): Remove declaration.
+ * gmon_io.c: Warning fixes. Eliminate DEFUN.
+ (gmon_io_read_64): Make static.
+ (gmon_io_write_64): Likewise.
+ (gmon_read_raw_arc): Likewise.
+ (gmon_write_raw_arc): Likewise.
+ (gmon_io_write_8): Don't pass char, pass int param.
+ * gmon_io.h (gmon_io_write_8): Likewise.
+
* Makefile.am: Run "make dep-am"
* Makefile.in: Regenerate.
diff --git a/gprof/alpha.c b/gprof/alpha.c
index 978f2ab..bcb4d9d 100644
--- a/gprof/alpha.c
+++ b/gprof/alpha.c
@@ -84,7 +84,7 @@ alpha_find_call (parent, p_lowpc, p_highpc)
bfd_vma p_highpc;
{
bfd_vma pc, dest_pc;
- unsigned long insn;
+ unsigned int insn;
Sym *child;
if (indirect_child.name == NULL)
@@ -110,7 +110,7 @@ alpha_find_call (parent, p_lowpc, p_highpc)
DBG (CALLDEBUG, printf (_("[find_call] %s: 0x%lx to 0x%lx\n"),
parent->name, (unsigned long) p_lowpc,
(unsigned long) p_highpc));
- for (pc = (p_lowpc + 3) & ~3; pc < p_highpc; pc += 4)
+ for (pc = (p_lowpc + 3) & ~(bfd_vma) 3; pc < p_highpc; pc += 4)
{
insn = bfd_get_32 (core_bfd, ((unsigned char *) core_text_space
+ pc - core_text_sect->vma));
diff --git a/gprof/basic_blocks.c b/gprof/basic_blocks.c
index d1bd3f0..74f29a0 100644
--- a/gprof/basic_blocks.c
+++ b/gprof/basic_blocks.c
@@ -2,7 +2,7 @@
of basic-block info to/from gmon.out; computing and formatting of
basic-block related statistics.
- Copyright 2000, 2001 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -32,6 +32,11 @@
#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));
+
/* Default option values: */
boolean bb_annotate_all_lines = false;
unsigned long bb_min_calls = 1;
@@ -47,7 +52,9 @@ static long num_lines_executed;
number, and address (in that order). */
static int
-DEFUN (cmp_bb, (lp, rp), const void *lp AND const void *rp)
+cmp_bb (lp, rp)
+ const PTR lp;
+ const PTR rp;
{
int r;
const Sym *left = *(const Sym **) lp;
@@ -76,7 +83,9 @@ DEFUN (cmp_bb, (lp, rp), const void *lp AND const void *rp)
/* Helper for sorting. Order basic blocks in decreasing number of
calls, ties are broken in increasing order of line numbers. */
static int
-DEFUN (cmp_ncalls, (lp, rp), const void *lp AND const void *rp)
+cmp_ncalls (lp, rp)
+ const PTR lp;
+ const PTR rp;
{
const Sym *left = *(const Sym **) lp;
const Sym *right = *(const Sym **) rp;
@@ -96,7 +105,8 @@ DEFUN (cmp_ncalls, (lp, rp), const void *lp AND const void *rp)
/* Skip over variable length string. */
static void
-DEFUN (fskip_string, (fp), FILE * fp)
+fskip_string (fp)
+ FILE *fp;
{
int ch;
@@ -111,7 +121,9 @@ DEFUN (fskip_string, (fp), FILE * fp)
of file IFP and is provided for formatting error-messages only. */
void
-DEFUN (bb_read_rec, (ifp, filename), FILE * ifp AND const char *filename)
+bb_read_rec (ifp, filename)
+ FILE *ifp;
+ const char *filename;
{
int nblocks, b;
bfd_vma addr, ncalls;
@@ -199,9 +211,11 @@ DEFUN (bb_read_rec, (ifp, filename), FILE * ifp AND const char *filename)
is the name of OFP and is provided for producing error-messages
only. */
void
-DEFUN (bb_write_blocks, (ofp, filename), FILE * ofp AND const char *filename)
+bb_write_blocks (ofp, filename)
+ FILE *ofp;
+ const char *filename;
{
- int nblocks = 0;
+ unsigned int nblocks = 0;
Sym *sym;
int i;
@@ -227,7 +241,7 @@ DEFUN (bb_write_blocks, (ofp, filename), FILE * ofp AND const char *filename)
for (i = 0; i < NBBS && sym->bb_addr[i]; i++)
{
if (gmon_io_write_vma (ofp, sym->bb_addr[i])
- || gmon_io_write_vma (ofp, sym->bb_calls[i]))
+ || gmon_io_write_vma (ofp, (bfd_vma) sym->bb_calls[i]))
{
perror (filename);
done (1);
@@ -242,10 +256,10 @@ DEFUN (bb_write_blocks, (ofp, filename), FILE * ofp AND const char *filename)
<filename>:<line-number>: (<function-name>:<bb-addr): <ncalls> */
void
-DEFUN_VOID (print_exec_counts)
+print_exec_counts ()
{
Sym **sorted_bbs, *sym;
- int i, j, len;
+ unsigned int i, j, len;
if (first_output)
first_output = false;
@@ -309,12 +323,15 @@ DEFUN_VOID (print_exec_counts)
that starts the basic-block. */
static void
-DEFUN (annotate_with_count, (buf, width, line_num, arg),
- char *buf AND int width AND int line_num AND void *arg)
+annotate_with_count (buf, width, line_num, arg)
+ char *buf;
+ unsigned int width;
+ int line_num;
+ PTR arg;
{
Source_File *sf = arg;
Sym *b;
- int i;
+ unsigned int i;
static unsigned long last_count;
unsigned long last_print = (unsigned long) -1;
@@ -335,7 +352,7 @@ DEFUN (annotate_with_count, (buf, width, line_num, arg),
char *p;
unsigned long ncalls;
int ncalls_set;
- int len;
+ unsigned int len;
++num_executable_lines;
@@ -411,7 +428,7 @@ DEFUN (annotate_with_count, (buf, width, line_num, arg),
if (! ncalls_set)
{
- int c;
+ unsigned int c;
for (c = 0; c < width; c++)
buf[c] = ' ';
@@ -438,7 +455,7 @@ DEFUN (annotate_with_count, (buf, width, line_num, arg),
}
else
{
- int c;
+ unsigned int c;
strcpy (buf + width - len, tmpbuf);
for (c = 0; c < width - len; ++c)
@@ -452,7 +469,7 @@ DEFUN (annotate_with_count, (buf, width, line_num, arg),
regarding that source file are printed. */
void
-DEFUN_VOID (print_annotated_source)
+print_annotated_source ()
{
Sym *sym, *line_stats, *new_line;
Source_File *sf;
diff --git a/gprof/basic_blocks.h b/gprof/basic_blocks.h
index cc24092..70a65bb 100644
--- a/gprof/basic_blocks.h
+++ b/gprof/basic_blocks.h
@@ -1,5 +1,5 @@
/* basic_blocks.h
- Copyright 2000 Free Software Foundation, Inc.
+ Copyright 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Binutils.
diff --git a/gprof/call_graph.c b/gprof/call_graph.c
index 20977f9..e798a0e 100644
--- a/gprof/call_graph.c
+++ b/gprof/call_graph.c
@@ -1,6 +1,6 @@
/* call_graph.c - Create call graphs.
- Copyright 2000, 2001 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -30,9 +30,11 @@
#include "gmon_out.h"
#include "sym_ids.h"
-extern void
-DEFUN (cg_tally, (from_pc, self_pc, count),
- bfd_vma from_pc AND bfd_vma self_pc AND unsigned long count)
+void
+cg_tally (from_pc, self_pc, count)
+ bfd_vma from_pc;
+ bfd_vma self_pc;
+ unsigned long count;
{
Sym *parent;
Sym *child;
@@ -78,7 +80,9 @@ DEFUN (cg_tally, (from_pc, self_pc, count),
for formatting error-messages only. */
void
-DEFUN (cg_read_rec, (ifp, filename), FILE * ifp AND CONST char *filename)
+cg_read_rec (ifp, filename)
+ FILE *ifp;
+ const char *filename;
{
bfd_vma from_pc, self_pc;
unsigned int count;
@@ -105,7 +109,9 @@ DEFUN (cg_read_rec, (ifp, filename), FILE * ifp AND CONST char *filename)
only. */
void
-DEFUN (cg_write_arcs, (ofp, filename), FILE * ofp AND const char *filename)
+cg_write_arcs (ofp, filename)
+ FILE *ofp;
+ const char *filename;
{
Arc *arc;
Sym *sym;
diff --git a/gprof/cg_arcs.c b/gprof/cg_arcs.c
index 8ebaa7f..f663954 100644
--- a/gprof/cg_arcs.c
+++ b/gprof/cg_arcs.c
@@ -28,6 +28,14 @@
#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));
+
Sym *cycle_header;
unsigned int num_cycles;
Arc **arcs;
@@ -38,7 +46,9 @@ unsigned int numarcs;
* range covered by CHILD.
*/
Arc *
-DEFUN (arc_lookup, (parent, child), Sym * parent AND Sym * child)
+arc_lookup (parent, child)
+ Sym *parent;
+ Sym *child;
{
Arc *arc;
@@ -67,8 +77,10 @@ DEFUN (arc_lookup, (parent, child), Sym * parent AND Sym * child)
* Add (or just increment) an arc:
*/
void
-DEFUN (arc_add, (parent, child, count),
- Sym * parent AND Sym * child AND unsigned long count)
+arc_add (parent, child, count)
+ Sym *parent;
+ Sym *child;
+ unsigned long count;
{
static unsigned int maxarcs = 0;
Arc *arc, **newarcs;
@@ -134,7 +146,9 @@ DEFUN (arc_add, (parent, child, count),
static int
-DEFUN (cmp_topo, (lp, rp), const PTR lp AND const PTR rp)
+cmp_topo (lp, rp)
+ const PTR lp;
+ const PTR rp;
{
const Sym *left = *(const Sym **) lp;
const Sym *right = *(const Sym **) rp;
@@ -144,7 +158,8 @@ DEFUN (cmp_topo, (lp, rp), const PTR lp AND const PTR rp)
static void
-DEFUN (propagate_time, (parent), Sym * parent)
+propagate_time (parent)
+ Sym *parent;
{
Arc *arc;
Sym *child;
@@ -228,7 +243,7 @@ DEFUN (propagate_time, (parent), Sym * parent)
* its members.
*/
static void
-DEFUN_VOID (cycle_time)
+cycle_time ()
{
Sym *member, *cyc;
@@ -252,7 +267,7 @@ DEFUN_VOID (cycle_time)
static void
-DEFUN_VOID (cycle_link)
+cycle_link ()
{
Sym *sym, *cyc, *member;
Arc *arc;
@@ -340,7 +355,8 @@ DEFUN_VOID (cycle_link)
* fractions from parents.
*/
static void
-DEFUN (inherit_flags, (child), Sym * child)
+inherit_flags (child)
+ Sym *child;
{
Sym *head, *parent, *member;
Arc *arc;
@@ -418,7 +434,8 @@ DEFUN (inherit_flags, (child), Sym * child)
* and while we're here, sum time for functions.
*/
static void
-DEFUN (propagate_flags, (symbols), Sym ** symbols)
+propagate_flags (symbols)
+ Sym **symbols;
{
int index;
Sym *old_head, *child;
@@ -518,7 +535,9 @@ DEFUN (propagate_flags, (symbols), Sym ** symbols)
* first. All else being equal, compare by names.
*/
static int
-DEFUN (cmp_total, (lp, rp), const PTR lp AND const PTR rp)
+cmp_total (lp, rp)
+ const PTR lp;
+ const PTR rp;
{
const Sym *left = *(const Sym **) lp;
const Sym *right = *(const Sym **) rp;
@@ -575,7 +594,7 @@ DEFUN (cmp_total, (lp, rp), const PTR lp AND const PTR rp)
* time bottom up and flags top down.
*/
Sym **
-DEFUN_VOID (cg_assemble)
+cg_assemble ()
{
Sym *parent, **time_sorted_syms, **top_sorted_syms;
unsigned int index;
diff --git a/gprof/cg_dfn.c b/gprof/cg_dfn.c
index ace8328..463f22e 100644
--- a/gprof/cg_dfn.c
+++ b/gprof/cg_dfn.c
@@ -34,6 +34,12 @@ typedef struct
}
DFN_Stack;
+static boolean is_numbered PARAMS ((Sym *));
+static boolean is_busy PARAMS ((Sym *));
+static void find_cycle PARAMS ((Sym *));
+static void pre_visit PARAMS ((Sym *));
+static void post_visit PARAMS ((Sym *));
+
DFN_Stack *dfn_stack = NULL;
int dfn_maxdepth = 0;
int dfn_depth = 0;
@@ -44,7 +50,8 @@ int dfn_counter = DFN_NAN;
* Is CHILD already numbered?
*/
static boolean
-DEFUN (is_numbered, (child), Sym * child)
+is_numbered (child)
+ Sym *child;
{
return child->cg.top_order != DFN_NAN && child->cg.top_order != DFN_BUSY;
}
@@ -54,7 +61,8 @@ DEFUN (is_numbered, (child), Sym * child)
* Is CHILD already busy?
*/
static boolean
-DEFUN (is_busy, (child), Sym * child)
+is_busy (child)
+ Sym *child;
{
if (child->cg.top_order == DFN_NAN)
{
@@ -71,7 +79,8 @@ DEFUN (is_busy, (child), Sym * child)
* depth-first number).
*/
static void
-DEFUN (find_cycle, (child), Sym * child)
+find_cycle (child)
+ Sym *child;
{
Sym *head = 0;
Sym *tail;
@@ -194,7 +203,8 @@ DEFUN (find_cycle, (child), Sym * child)
* the stack and mark it busy.
*/
static void
-DEFUN (pre_visit, (parent), Sym * parent)
+pre_visit (parent)
+ Sym *parent;
{
++dfn_depth;
@@ -218,7 +228,8 @@ DEFUN (pre_visit, (parent), Sym * parent)
* and number functions if PARENT is head of a cycle.
*/
static void
-DEFUN (post_visit, (parent), Sym * parent)
+post_visit (parent)
+ Sym *parent;
{
Sym *member;
@@ -252,7 +263,8 @@ DEFUN (post_visit, (parent), Sym * parent)
* Given this PARENT, depth first number its children.
*/
void
-DEFUN (cg_dfn, (parent), Sym * parent)
+cg_dfn (parent)
+ Sym *parent;
{
Arc *arc;
diff --git a/gprof/cg_print.c b/gprof/cg_print.c
index 260a876..4aa445b 100644
--- a/gprof/cg_print.c
+++ b/gprof/cg_print.c
@@ -28,15 +28,30 @@
#include "cg_print.h"
#include "hist.h"
#include "utils.h"
+#include "corefile.h"
/* Return value of comparison functions used to sort tables. */
#define LESSTHAN -1
#define EQUALTO 0
#define GREATERTHAN 1
-static void order_and_dump_functions_by_arcs PARAMS ((Arc **, unsigned long,
- int, Arc **,
- unsigned long *));
+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 order_and_dump_functions_by_arcs
+ PARAMS ((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));
@@ -45,7 +60,7 @@ double print_time = 0.0;
static void
-DEFUN_VOID (print_header)
+print_header ()
{
if (first_output)
first_output = false;
@@ -94,7 +109,8 @@ DEFUN_VOID (print_header)
/* Print a cycle header. */
static void
-DEFUN (print_cycle, (cyc), Sym * cyc)
+print_cycle (cyc)
+ Sym *cyc;
{
char buf[BUFSIZ];
@@ -117,7 +133,9 @@ DEFUN (print_cycle, (cyc), Sym * cyc)
CG.PROP.SELF+CG.PROP.CHILD, secondary key is NCALLS+CG.SELF_CALLS. */
static int
-DEFUN (cmp_member, (left, right), Sym * left AND Sym * right)
+cmp_member (left, right)
+ 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;
@@ -142,7 +160,8 @@ DEFUN (cmp_member, (left, right), Sym * left AND Sym * right)
/* Sort members of a cycle. */
static void
-DEFUN (sort_members, (cyc), Sym * cyc)
+sort_members (cyc)
+ Sym *cyc;
{
Sym *todo, *doing, *prev;
@@ -169,7 +188,8 @@ DEFUN (sort_members, (cyc), Sym * cyc)
/* Print the members of a cycle. */
static void
-DEFUN (print_members, (cyc), Sym * cyc)
+print_members (cyc)
+ Sym *cyc;
{
Sym *member;
@@ -203,7 +223,9 @@ DEFUN (print_members, (cyc), Sym * cyc)
arc count as minor key. */
static int
-DEFUN (cmp_arc, (left, right), Arc * left AND Arc * right)
+cmp_arc (left, right)
+ Arc *left;
+ Arc *right;
{
Sym *left_parent = left->parent;
Sym *left_child = left->child;
@@ -289,7 +311,8 @@ DEFUN (cmp_arc, (left, right), Arc * left AND Arc * right)
static void
-DEFUN (sort_parents, (child), Sym * child)
+sort_parents (child)
+ Sym * child;
{
Arc *arc, *detached, sorted, *prev;
@@ -322,7 +345,8 @@ DEFUN (sort_parents, (child), Sym * child)
static void
-DEFUN (print_parents, (child), Sym * child)
+print_parents (child)
+ Sym *child;
{
Sym *parent;
Arc *arc;
@@ -376,7 +400,8 @@ DEFUN (print_parents, (child), Sym * child)
static void
-DEFUN (sort_children, (parent), Sym * parent)
+sort_children (parent)
+ Sym *parent;
{
Arc *arc, *detached, sorted, *prev;
@@ -409,7 +434,8 @@ DEFUN (sort_children, (parent), Sym * parent)
static void
-DEFUN (print_children, (parent), Sym * parent)
+print_children (parent)
+ Sym *parent;
{
Sym *child;
Arc *arc;
@@ -448,7 +474,8 @@ DEFUN (print_children, (parent), Sym * parent)
static void
-DEFUN (print_line, (np), Sym * np)
+print_line (np)
+ Sym *np;
{
char buf[BUFSIZ];
@@ -481,7 +508,8 @@ DEFUN (print_line, (np), Sym * np)
/* Print dynamic call graph. */
void
-DEFUN (cg_print, (timesortsym), Sym ** timesortsym)
+cg_print (timesortsym)
+ Sym ** timesortsym;
{
unsigned int index;
Sym *parent;
@@ -532,7 +560,9 @@ DEFUN (cg_print, (timesortsym), Sym ** timesortsym)
static int
-DEFUN (cmp_name, (left, right), const PTR left AND const PTR right)
+cmp_name (left, right)
+ const PTR left;
+ const PTR right;
{
const Sym **npp1 = (const Sym **) left;
const Sym **npp2 = (const Sym **) right;
@@ -542,7 +572,7 @@ DEFUN (cmp_name, (left, right), const PTR left AND const PTR right)
void
-DEFUN_VOID (cg_print_index)
+cg_print_index ()
{
unsigned int index;
unsigned int nnames, todo, i, j;
@@ -656,7 +686,9 @@ DEFUN_VOID (cg_print_index)
We want to sort in descending order. */
static int
-DEFUN (cmp_arc_count, (left, right), const PTR left AND const PTR right)
+cmp_arc_count (left, right)
+ const PTR left;
+ const PTR right;
{
const Arc **npp1 = (const Arc **) left;
const Arc **npp2 = (const Arc **) right;
@@ -673,7 +705,9 @@ DEFUN (cmp_arc_count, (left, right), const PTR left AND const PTR right)
We want to sort in descending order. */
static int
-DEFUN (cmp_fun_nuses, (left, right), const PTR left AND const PTR right)
+cmp_fun_nuses (left, right)
+ const PTR left;
+ const PTR right;
{
const Sym **npp1 = (const Sym **) left;
const Sym **npp2 = (const Sym **) right;
@@ -755,7 +789,7 @@ DEFUN (cmp_fun_nuses, (left, right), const PTR left AND const PTR right)
of function ordering). */
void
-DEFUN_VOID (cg_print_function_ordering)
+cg_print_function_ordering ()
{
unsigned long index, used, unused, scratch_index;
unsigned long unplaced_arc_count, high_arc_count, scratch_arc_count;
@@ -960,18 +994,18 @@ DEFUN_VOID (cg_print_function_ordering)
free (unplaced_arcs);
}
-/* Place functions based on the arcs in ARCS with NUMARCS entries;
+/* Place functions based on the arcs in THE_ARCS with ARC_COUNT entries;
place unused arcs into UNPLACED_ARCS/UNPLACED_ARC_COUNT.
- If ALL is nonzero, then place all functions referenced by ARCS,
- else only place those referenced in the top 99% of the arcs in ARCS. */
+ If ALL is nonzero, then place all functions referenced by THE_ARCS,
+ else only place those referenced in the top 99% of the arcs in THE_ARCS. */
#define MOST 0.99
static void
-order_and_dump_functions_by_arcs (arcs, numarcs, all,
+order_and_dump_functions_by_arcs (the_arcs, arc_count, all,
unplaced_arcs, unplaced_arc_count)
- Arc **arcs;
- unsigned long numarcs;
+ Arc **the_arcs;
+ unsigned long arc_count;
int all;
Arc **unplaced_arcs;
unsigned long *unplaced_arc_count;
@@ -989,27 +1023,27 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
if (! all)
{
total_arcs = 0;
- for (index = 0; index < numarcs; index++)
- total_arcs += arcs[index]->count;
+ for (index = 0; index < arc_count; index++)
+ total_arcs += the_arcs[index]->count;
}
else
total_arcs = 0;
tmp_arcs = 0;
- for (index = 0; index < numarcs; index++)
+ for (index = 0; index < arc_count; index++)
{
Sym *sym1, *sym2;
Sym *child, *parent;
- tmp_arcs += arcs[index]->count;
+ tmp_arcs += the_arcs[index]->count;
/* Ignore this arc if it's already been placed. */
- if (arcs[index]->has_been_placed)
+ if (the_arcs[index]->has_been_placed)
continue;
- child = arcs[index]->child;
- parent = arcs[index]->parent;
+ child = the_arcs[index]->child;
+ parent = the_arcs[index]->parent;
/* If we're not using all arcs, and this is a rarely used
arc, then put it on the unplaced_arc list. Similarly
@@ -1017,7 +1051,7 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
if ((! all && (double)tmp_arcs / (double)total_arcs > MOST)
|| child->has_been_placed || parent->has_been_placed)
{
- unplaced_arcs[(*unplaced_arc_count)++] = arcs[index];
+ unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index];
continue;
}
@@ -1027,7 +1061,7 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
algorithm can use it to place function chains. */
if (parent->next && parent->prev && child->next && child->prev)
{
- unplaced_arcs[(*unplaced_arc_count)++] = arcs[index];
+ unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index];
continue;
}
@@ -1082,7 +1116,7 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
{
/* Couldn't find anywhere to attach the functions,
put the arc on the unplaced arc list. */
- unplaced_arcs[(*unplaced_arc_count)++] = arcs[index];
+ unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index];
continue;
}
@@ -1107,7 +1141,7 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
&& sym2 == parent)
{
/* This would tie two ends together. */
- unplaced_arcs[(*unplaced_arc_count)++] = arcs[index];
+ unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index];
continue;
}
@@ -1119,7 +1153,7 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
/* parent-prev and child-next */
parent->prev = child;
child->next = parent;
- arcs[index]->has_been_placed = 1;
+ the_arcs[index]->has_been_placed = 1;
}
}
else if (parent->prev)
@@ -1130,7 +1164,7 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
/* parent-next and child-prev */
parent->next = child;
child->prev = parent;
- arcs[index]->has_been_placed = 1;
+ the_arcs[index]->has_been_placed = 1;
}
}
else
@@ -1142,27 +1176,27 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
/* parent-prev and child-next. */
parent->prev = child;
child->next = parent;
- arcs[index]->has_been_placed = 1;
+ the_arcs[index]->has_been_placed = 1;
}
else
{
/* parent-next and child-prev. */
parent->next = child;
child->prev = parent;
- arcs[index]->has_been_placed = 1;
+ the_arcs[index]->has_been_placed = 1;
}
}
}
/* Dump the chains of functions we've made. */
- for (index = 0; index < numarcs; index++)
+ for (index = 0; index < arc_count; index++)
{
Sym *sym;
- if (arcs[index]->parent->has_been_placed
- || arcs[index]->child->has_been_placed)
+ if (the_arcs[index]->parent->has_been_placed
+ || the_arcs[index]->child->has_been_placed)
continue;
- sym = arcs[index]->parent;
+ sym = the_arcs[index]->parent;
/* If this symbol isn't attached to any other
symbols, then we've got a rarely used arc.
@@ -1188,14 +1222,14 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
/* If we want to place all the arcs, then output
those which weren't placed by the main algorithm. */
if (all)
- for (index = 0; index < numarcs; index++)
+ for (index = 0; index < arc_count; index++)
{
Sym *sym;
- if (arcs[index]->parent->has_been_placed
- || arcs[index]->child->has_been_placed)
+ if (the_arcs[index]->parent->has_been_placed
+ || the_arcs[index]->child->has_been_placed)
continue;
- sym = arcs[index]->parent;
+ sym = the_arcs[index]->parent;
sym->has_been_placed = 1;
printf ("%s\n", sym->name);
@@ -1206,19 +1240,11 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
on profiling information. This uses the function placement
code for the bulk of its work. */
-struct function_map
-{
- char *function_name;
- char *file_name;
-};
-
void
-DEFUN_VOID (cg_print_file_ordering)
+cg_print_file_ordering ()
{
unsigned long scratch_arc_count, index;
Arc **scratch_arcs;
- extern struct function_map *symbol_map;
- extern unsigned int symbol_map_count;
char *last;
scratch_arc_count = 0;
diff --git a/gprof/corefile.c b/gprof/corefile.c
index 9f3ca03..fdebc88 100644
--- a/gprof/corefile.c
+++ b/gprof/corefile.c
@@ -36,15 +36,14 @@ int min_insn_size;
int offset_to_code;
/* For mapping symbols to specific .o files during file ordering. */
-struct function_map
-{
- char *function_name;
- char *file_name;
-};
-
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 boolean get_src_info
+ PARAMS ((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));
@@ -53,7 +52,8 @@ extern void sparc_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
extern void mips_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
static void
-DEFUN (read_function_mappings, (filename), const char *filename)
+read_function_mappings (filename)
+ const char *filename;
{
FILE *file = fopen (filename, "r");
char dummy[1024];
@@ -139,19 +139,20 @@ DEFUN (read_function_mappings, (filename), const char *filename)
void
-DEFUN (core_init, (a_out_name), const char *a_out_name)
+core_init (aout_name)
+ const char *aout_name;
{
- core_bfd = bfd_openr (a_out_name, 0);
+ core_bfd = bfd_openr (aout_name, 0);
if (!core_bfd)
{
- perror (a_out_name);
+ perror (aout_name);
done (1);
}
if (!bfd_check_format (core_bfd, bfd_object))
{
- fprintf (stderr, _("%s: %s: not in a.out format\n"), whoami, a_out_name);
+ fprintf (stderr, _("%s: %s: not in a.out format\n"), whoami, aout_name);
done (1);
}
@@ -163,7 +164,7 @@ DEFUN (core_init, (a_out_name), const char *a_out_name)
if (!core_text_sect)
{
fprintf (stderr, _("%s: can't find .text section in %s\n"),
- whoami, a_out_name);
+ whoami, aout_name);
done (1);
}
}
@@ -174,7 +175,7 @@ DEFUN (core_init, (a_out_name), const char *a_out_name)
core_num_syms = bfd_get_symtab_upper_bound (core_bfd);
if (core_num_syms < 0)
{
- fprintf (stderr, "%s: %s: %s\n", whoami, a_out_name,
+ fprintf (stderr, "%s: %s: %s\n", whoami, aout_name,
bfd_errmsg (bfd_get_error ()));
done (1);
}
@@ -184,7 +185,7 @@ DEFUN (core_init, (a_out_name), const char *a_out_name)
if (core_num_syms < 0)
{
- fprintf (stderr, "%s: %s: %s\n", whoami, a_out_name,
+ fprintf (stderr, "%s: %s: %s\n", whoami, aout_name,
bfd_errmsg (bfd_get_error ()));
done (1);
}
@@ -214,9 +215,10 @@ DEFUN (core_init, (a_out_name), const char *a_out_name)
/* Read in the text space of an a.out file. */
void
-DEFUN (core_get_text_space, (core_bfd), bfd * core_bfd)
+core_get_text_space (cbfd)
+ bfd *cbfd;
{
- core_text_space = (PTR) malloc (core_text_sect->_raw_size);
+ core_text_space = (PTR) malloc ((unsigned int) core_text_sect->_raw_size);
if (!core_text_space)
{
@@ -225,8 +227,8 @@ DEFUN (core_get_text_space, (core_bfd), bfd * core_bfd)
done (1);
}
- if (!bfd_get_section_contents (core_bfd, core_text_sect, core_text_space,
- 0, core_text_sect->_raw_size))
+ if (!bfd_get_section_contents (cbfd, core_text_sect, core_text_space,
+ (bfd_vma) 0, core_text_sect->_raw_size))
{
bfd_perror ("bfd_get_section_contents");
free (core_text_space);
@@ -239,8 +241,10 @@ DEFUN (core_get_text_space, (core_bfd), bfd * core_bfd)
void
-DEFUN (find_call, (parent, p_lowpc, p_highpc),
- Sym * parent AND bfd_vma p_lowpc AND bfd_vma p_highpc)
+find_call (parent, p_lowpc, p_highpc)
+ Sym *parent;
+ bfd_vma p_lowpc;
+ bfd_vma p_highpc;
{
switch (bfd_get_arch (core_bfd))
{
@@ -283,7 +287,8 @@ DEFUN (find_call, (parent, p_lowpc, p_highpc),
't' -> symbol is a local (static) name. */
static int
-DEFUN (core_sym_class, (sym), asymbol * sym)
+core_sym_class (sym)
+ asymbol *sym;
{
symbol_info syminfo;
const char *name;
@@ -366,9 +371,11 @@ DEFUN (core_sym_class, (sym), asymbol * sym)
/* Get whatever source info we can get regarding address ADDR. */
static boolean
-DEFUN (get_src_info, (addr, filename, name, line_num),
- bfd_vma addr AND const char **filename AND const char **name
- AND int *line_num)
+get_src_info (addr, filename, name, line_num)
+ bfd_vma addr;
+ const char **filename;
+ const char **name;
+ int *line_num;
{
const char *fname = 0, *func_name = 0;
int l = 0;
@@ -398,10 +405,11 @@ DEFUN (get_src_info, (addr, filename, name, line_num),
One symbol per function is entered. */
void
-core_create_function_syms (core_bfd)
- bfd *core_bfd ATTRIBUTE_UNUSED;
+core_create_function_syms (cbfd)
+ bfd *cbfd ATTRIBUTE_UNUSED;
{
- bfd_vma min_vma = ~0, max_vma = 0;
+ bfd_vma min_vma = ~(bfd_vma) 0;
+ bfd_vma max_vma = 0;
int class;
long i, found, skip;
unsigned int j;
@@ -560,7 +568,7 @@ core_create_function_syms (core_bfd)
sym_init (symtab.limit);
symtab.limit->name = "<hicore>";
symtab.limit->addr = max_vma + 1;
- symtab.limit->end_addr = ~0;
+ symtab.limit->end_addr = ~(bfd_vma) 0;
++symtab.limit;
symtab.len = symtab.limit - symtab.base;
@@ -571,11 +579,12 @@ core_create_function_syms (core_bfd)
One symbol per line of source code is entered. */
void
-DEFUN (core_create_line_syms, (core_bfd), bfd * core_bfd)
+core_create_line_syms (cbfd)
+ bfd *cbfd;
{
char *prev_name, *prev_filename;
- int prev_name_len, prev_filename_len;
- bfd_vma vma, min_vma = ~0, max_vma = 0;
+ unsigned int prev_name_len, prev_filename_len;
+ bfd_vma vma, min_vma = ~(bfd_vma) 0, max_vma = 0;
bfd_vma offset;
Sym *prev, dummy, *sentinel, *sym;
const char *filename;
@@ -585,7 +594,7 @@ DEFUN (core_create_line_syms, (core_bfd), bfd * core_bfd)
/* Create symbols for functions as usual. This is necessary in
cases where parts of a program were not compiled with -g. For
those parts we still want to get info at the function level. */
- core_create_function_syms (core_bfd);
+ core_create_function_syms (cbfd);
/* Pass 1 - counter number of symbols. */
@@ -605,7 +614,7 @@ DEFUN (core_create_line_syms, (core_bfd), bfd * core_bfd)
for (offset = 0; offset < core_text_sect->_raw_size; offset += min_insn_size)
{
- int len;
+ unsigned int len;
vma = core_text_sect->vma + offset;
@@ -718,13 +727,13 @@ DEFUN (core_create_line_syms, (core_bfd), bfd * core_bfd)
}
/* Update sentinels. */
- sentinel = sym_lookup (&symtab, 0);
+ sentinel = sym_lookup (&symtab, (bfd_vma) 0);
if (strcmp (sentinel->name, "<locore>") == 0
&& min_vma <= sentinel->end_addr)
sentinel->end_addr = min_vma - 1;
- sentinel = sym_lookup (&symtab, ~0);
+ sentinel = sym_lookup (&symtab, ~(bfd_vma) 0);
if (strcmp (sentinel->name, "<hicore>") == 0 && max_vma >= sentinel->addr)
sentinel->addr = max_vma + 1;
diff --git a/gprof/corefile.h b/gprof/corefile.h
index a1457da..7ecbbff 100644
--- a/gprof/corefile.h
+++ b/gprof/corefile.h
@@ -1,6 +1,6 @@
/* corefile.h
- Copyright 2000, 2001 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -21,6 +21,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef corefile_h
#define corefile_h
+struct function_map
+{
+ char *function_name;
+ char *file_name;
+};
+
+extern struct function_map *symbol_map;
+extern unsigned int symbol_map_count;
+
extern bfd *core_bfd; /* BFD for core-file. */
extern int core_num_syms; /* # of entries in symbol-table. */
extern asymbol **core_syms; /* Symbol table in a.out. */
diff --git a/gprof/gmon_io.c b/gprof/gmon_io.c
index db11590..46c6f9b 100644
--- a/gprof/gmon_io.c
+++ b/gprof/gmon_io.c
@@ -34,11 +34,20 @@
#include "hist.h"
#include "libiberty.h"
+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_read_raw_arc
+ PARAMS ((FILE *, bfd_vma *, bfd_vma *, unsigned long *));
+static int gmon_write_raw_arc
+ PARAMS ((FILE *, bfd_vma, bfd_vma, unsigned long));
+
int gmon_input = 0;
int gmon_file_version = 0; /* 0 == old (non-versioned) file format. */
int
-DEFUN (gmon_io_read_32, (ifp, valp), FILE * ifp AND unsigned int *valp)
+gmon_io_read_32 (ifp, valp)
+ FILE *ifp;
+ unsigned int *valp;
{
char buf[4];
@@ -48,8 +57,10 @@ DEFUN (gmon_io_read_32, (ifp, valp), FILE * ifp AND unsigned int *valp)
return 0;
}
-int
-DEFUN (gmon_io_read_64, (ifp, valp), FILE * ifp AND BFD_HOST_U_64_BIT *valp)
+static int
+gmon_io_read_64 (ifp, valp)
+ FILE *ifp;
+ BFD_HOST_U_64_BIT *valp;
{
char buf[8];
@@ -60,7 +71,9 @@ DEFUN (gmon_io_read_64, (ifp, valp), FILE * ifp AND BFD_HOST_U_64_BIT *valp)
}
int
-DEFUN (gmon_io_read_vma, (ifp, valp), FILE * ifp AND bfd_vma *valp)
+gmon_io_read_vma (ifp, valp)
+ FILE *ifp;
+ bfd_vma *valp;
{
unsigned int val32;
BFD_HOST_U_64_BIT val64;
@@ -88,7 +101,10 @@ DEFUN (gmon_io_read_vma, (ifp, valp), FILE * ifp AND bfd_vma *valp)
}
int
-DEFUN (gmon_io_read, (ifp, buf, n), FILE * ifp AND char *buf AND size_t n)
+gmon_io_read (ifp, buf, n)
+ FILE *ifp;
+ char *buf;
+ size_t n;
{
if (fread (buf, 1, n, ifp) != n)
return 1;
@@ -96,29 +112,35 @@ DEFUN (gmon_io_read, (ifp, buf, n), FILE * ifp AND char *buf AND size_t n)
}
int
-DEFUN (gmon_io_write_32, (ofp, val), FILE * ofp AND unsigned int val)
+gmon_io_write_32 (ofp, val)
+ FILE *ofp;
+ unsigned int val;
{
char buf[4];
- bfd_put_32 (core_bfd, val, buf);
+ bfd_put_32 (core_bfd, (bfd_vma) val, buf);
if (fwrite (buf, 1, 4, ofp) != 4)
return 1;
return 0;
}
-int
-DEFUN (gmon_io_write_64, (ofp, val), FILE * ofp AND BFD_HOST_U_64_BIT val)
+static int
+gmon_io_write_64 (ofp, val)
+ FILE *ofp;
+ BFD_HOST_U_64_BIT val;
{
char buf[8];
- bfd_put_64 (core_bfd, val, buf);
+ bfd_put_64 (core_bfd, (bfd_vma) val, buf);
if (fwrite (buf, 1, 8, ofp) != 8)
return 1;
return 0;
}
int
-DEFUN (gmon_io_write_vma, (ofp, val), FILE * ofp AND bfd_vma val)
+gmon_io_write_vma (ofp, val)
+ FILE *ofp;
+ bfd_vma val;
{
switch (bfd_arch_bits_per_address (core_bfd))
@@ -142,7 +164,9 @@ DEFUN (gmon_io_write_vma, (ofp, val), FILE * ofp AND bfd_vma val)
}
int
-DEFUN (gmon_io_write_8, (ofp, val), FILE * ofp AND unsigned char val)
+gmon_io_write_8 (ofp, val)
+ FILE *ofp;
+ unsigned int val;
{
char buf[1];
@@ -153,15 +177,22 @@ DEFUN (gmon_io_write_8, (ofp, val), FILE * ofp AND unsigned char val)
}
int
-DEFUN (gmon_io_write, (ofp, buf, n), FILE * ofp AND char *buf AND size_t n)
+gmon_io_write (ofp, buf, n)
+ FILE *ofp;
+ char *buf;
+ size_t n;
{
if (fwrite (buf, 1, n, ofp) != n)
return 1;
return 0;
}
-int
-DEFUN (gmon_read_raw_arc, (ifp, fpc, spc, cnt), FILE * ifp AND bfd_vma * fpc AND bfd_vma * spc AND unsigned long * cnt)
+static int
+gmon_read_raw_arc (ifp, fpc, spc, cnt)
+ FILE *ifp;
+ bfd_vma *fpc;
+ bfd_vma *spc;
+ unsigned long *cnt;
{
BFD_HOST_U_64_BIT cnt64;
unsigned int cnt32;
@@ -192,8 +223,12 @@ DEFUN (gmon_read_raw_arc, (ifp, fpc, spc, cnt), FILE * ifp AND bfd_vma * fpc AND
return 0;
}
-int
-DEFUN (gmon_write_raw_arc, (ofp, fpc, spc, cnt), FILE * ofp AND bfd_vma fpc AND bfd_vma spc AND unsigned long cnt)
+static int
+gmon_write_raw_arc (ofp, fpc, spc, cnt)
+ FILE *ofp;
+ bfd_vma fpc;
+ bfd_vma spc;
+ unsigned long cnt;
{
if (gmon_io_write_vma (ofp, fpc)
@@ -221,7 +256,8 @@ DEFUN (gmon_write_raw_arc, (ofp, fpc, spc, cnt), FILE * ofp AND bfd_vma fpc AND
}
void
-DEFUN (gmon_out_read, (filename), const char *filename)
+gmon_out_read (filename)
+ const char *filename;
{
FILE *ifp;
struct gmon_hdr ghdr;
@@ -538,7 +574,8 @@ DEFUN (gmon_out_read, (filename), const char *filename)
void
-DEFUN (gmon_out_write, (filename), const char *filename)
+gmon_out_write (filename)
+ const char *filename;
{
FILE *ofp;
struct gmon_hdr ghdr;
@@ -555,7 +592,7 @@ DEFUN (gmon_out_write, (filename), const char *filename)
/* Write gmon header. */
memcpy (&ghdr.cookie[0], GMON_MAGIC, 4);
- bfd_put_32 (core_bfd, GMON_VERSION, (bfd_byte *) ghdr.version);
+ bfd_put_32 (core_bfd, (bfd_vma) GMON_VERSION, (bfd_byte *) ghdr.version);
if (fwrite (&ghdr, sizeof (ghdr), 1, ofp) != 1)
{
@@ -652,7 +689,7 @@ DEFUN (gmon_out_write, (filename), const char *filename)
|| hz != hertz())
{
if (gmon_io_write_32 (ofp, GMONVERSION)
- || gmon_io_write_32 (ofp, hz))
+ || gmon_io_write_32 (ofp, (unsigned int) hz))
{
perror (filename);
done (1);
@@ -671,7 +708,8 @@ DEFUN (gmon_out_write, (filename), const char *filename)
/* Dump the samples. */
for (i = 0; i < hist_num_bins; ++i)
{
- bfd_put_16 (core_bfd, hist_sample[i], (bfd_byte *) & raw_bin_count[0]);
+ bfd_put_16 (core_bfd, (bfd_vma) hist_sample[i],
+ (bfd_byte *) &raw_bin_count[0]);
if (fwrite (&raw_bin_count[0], sizeof (raw_bin_count), 1, ofp) != 1)
{
perror (filename);
diff --git a/gprof/gmon_io.h b/gprof/gmon_io.h
index 48a0367..b632d75 100644
--- a/gprof/gmon_io.h
+++ b/gprof/gmon_io.h
@@ -1,6 +1,6 @@
/* gmon_io.h
- Copyright 2000, 2001 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -51,7 +51,7 @@ 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 char 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 void gmon_out_read PARAMS ((const char *));
diff --git a/gprof/gprof.c b/gprof/gprof.c
index c7189d0..db6dd9a 100644
--- a/gprof/gprof.c
+++ b/gprof/gprof.c
@@ -33,6 +33,9 @@
#include "sym_ids.h"
#include "demangle.h"
+static void usage PARAMS ((FILE *, int)) ATTRIBUTE_NORETURN;
+int main PARAMS ((int, char **));
+
const char *whoami;
const char *function_mapping_file;
const char *a_out_name = A_OUTNAME;
@@ -142,7 +145,9 @@ static struct option long_options[] =
static void
-DEFUN (usage, (stream, status), FILE * stream AND int status)
+usage (stream, status)
+ FILE *stream;
+ int status;
{
fprintf (stream, _("\
Usage: %s [-[abcDhilLsTvwxyz]] [-[ACeEfFJnNOpPqQZ][name]] [-I dirs]\n\
@@ -166,7 +171,9 @@ Usage: %s [-[abcDhilLsTvwxyz]] [-[ACeEfFJnNOpPqQZ][name]] [-I dirs]\n\
int
-DEFUN (main, (argc, argv), int argc AND char **argv)
+main (argc, argv)
+ int argc;
+ char **argv;
{
char **sp, *str;
Sym **cg = 0;
diff --git a/gprof/gprof.h b/gprof/gprof.h
index 567ebd2..911c5be 100644
--- a/gprof/gprof.h
+++ b/gprof/gprof.h
@@ -126,6 +126,6 @@ extern File_Format file_format; /* requested file format */
extern boolean first_output; /* no output so far? */
-extern void done PARAMS ((int status));
+extern void done PARAMS ((int status)) ATTRIBUTE_NORETURN;
#endif /* gprof_h */
diff --git a/gprof/hist.c b/gprof/hist.c
index 0d0df01..d987656 100644
--- a/gprof/hist.c
+++ b/gprof/hist.c
@@ -1,6 +1,6 @@
/* hist.c - Histogram related operations.
- Copyright 2000, 2001 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -34,6 +34,9 @@
#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));
/* Declarations of automatically generated functions to output blurbs. */
extern void flat_blurb PARAMS ((FILE * fp));
@@ -77,7 +80,9 @@ SItab[] =
is provided for formatting error messages only. */
void
-DEFUN (hist_read_rec, (ifp, filename), FILE * ifp AND const char *filename)
+hist_read_rec (ifp, filename)
+ FILE * ifp;
+ const char *filename;
{
bfd_vma n_lowpc, n_highpc;
int i, ncnt, profrate;
@@ -152,7 +157,9 @@ DEFUN (hist_read_rec, (ifp, filename), FILE * ifp AND const char *filename)
of OFP and is provided for formatting error-messages only. */
void
-DEFUN (hist_write_hist, (ofp, filename), FILE * ofp AND const char *filename)
+hist_write_hist (ofp, filename)
+ FILE * ofp;
+ const char *filename;
{
UNIT count;
int i;
@@ -173,7 +180,7 @@ DEFUN (hist_write_hist, (ofp, filename), FILE * ofp AND const char *filename)
for (i = 0; i < hist_num_bins; ++i)
{
- bfd_put_16 (core_bfd, hist_sample[i], (bfd_byte *) & count[0]);
+ bfd_put_16 (core_bfd, (bfd_vma) hist_sample[i], (bfd_byte *) &count[0]);
if (fwrite (&count[0], sizeof (count), 1, ofp) != 1)
{
@@ -255,7 +262,7 @@ scale_and_align_entries ()
cases, above). */
void
-DEFUN_VOID (hist_assign_samples)
+hist_assign_samples ()
{
bfd_vma bin_low_pc, bin_high_pc;
bfd_vma sym_low_pc, sym_high_pc;
@@ -344,7 +351,8 @@ DEFUN_VOID (hist_assign_samples)
/* Print header for flag histogram profile. */
static void
-DEFUN (print_header, (prefix), const char prefix)
+print_header (prefix)
+ int prefix;
{
char unit[64];
@@ -383,7 +391,9 @@ DEFUN (print_header, (prefix), const char prefix)
static void
-DEFUN (print_line, (sym, scale), Sym * sym AND double scale)
+print_line (sym, scale)
+ Sym *sym;
+ double scale;
{
if (ignore_zeros && sym->ncalls == 0 && sym->hist.time == 0)
return;
@@ -420,7 +430,9 @@ DEFUN (print_line, (sym, scale), Sym * sym AND double scale)
lexicographic order of the function names. */
static int
-DEFUN (cmp_time, (lp, rp), const PTR lp AND const PTR rp)
+cmp_time (lp, rp)
+ const PTR lp;
+ const PTR rp;
{
const Sym *left = *(const Sym **) lp;
const Sym *right = *(const Sym **) rp;
@@ -447,7 +459,7 @@ DEFUN (cmp_time, (lp, rp), const PTR lp AND const PTR rp)
/* Print the flat histogram profile. */
void
-DEFUN_VOID (hist_print)
+hist_print ()
{
Sym **time_sorted_syms, *top_dog, *sym;
unsigned int index;
diff --git a/gprof/mips.c b/gprof/mips.c
index 5638957..fcc1ed3 100644
--- a/gprof/mips.c
+++ b/gprof/mips.c
@@ -74,7 +74,7 @@ mips_find_call (parent, p_lowpc, p_highpc)
DBG (CALLDEBUG,
printf (_("[find_call] 0x%lx: jal"), (unsigned long) pc));
offset = (op & 0x03ffffff) << 2;
- dest_pc = (pc & ~0xfffffff) | offset;
+ dest_pc = (pc & ~(bfd_vma) 0xfffffff) | offset;
if (dest_pc >= s_lowpc && dest_pc <= s_highpc)
{
child = sym_lookup (&symtab, dest_pc);
diff --git a/gprof/search_list.c b/gprof/search_list.c
index 743fbda..50b4cf2 100644
--- a/gprof/search_list.c
+++ b/gprof/search_list.c
@@ -1,6 +1,6 @@
/* search-list.c
- Copyright 2000, 2001 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -25,12 +25,13 @@
void
-DEFUN (search_list_append, (list, paths),
- Search_List * list AND const char *paths)
+search_list_append (list, paths)
+ Search_List *list;
+ const char *paths;
{
Search_List_Elem *new_el;
const char *beg, *colon;
- int len;
+ unsigned int len;
colon = paths - 1;
do
diff --git a/gprof/source.c b/gprof/source.c
index c0bbabd..496373e 100644
--- a/gprof/source.c
+++ b/gprof/source.c
@@ -1,6 +1,6 @@
/* source.c - Keep track of source files.
- Copyright 2000, 2001 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -35,7 +35,8 @@ Source_File *first_src_file = 0;
Source_File *
-DEFUN (source_file_lookup_path, (path), const char *path)
+source_file_lookup_path (path)
+ const char *path;
{
Source_File *sf;
@@ -62,7 +63,8 @@ DEFUN (source_file_lookup_path, (path), const char *path)
Source_File *
-DEFUN (source_file_lookup_name, (filename), const char *filename)
+source_file_lookup_name (filename)
+ const char *filename;
{
const char *fname;
Source_File *sf;
@@ -89,10 +91,11 @@ DEFUN (source_file_lookup_name, (filename), const char *filename)
FILE *
-DEFUN (annotate_source, (sf, max_width, annote, arg),
- Source_File * sf AND int max_width
- AND void (*annote) PARAMS ((char *buf, int w, int l, void *arg))
- AND void *arg)
+annotate_source (sf, max_width, annote, arg)
+ Source_File *sf;
+ unsigned int max_width;
+ void (*annote) PARAMS ((char *, unsigned int, int, void *));
+ void *arg;
{
static boolean first_file = true;
int i, line_num, nread;
diff --git a/gprof/source.h b/gprof/source.h
index 6e2e18f..6cc23ab 100644
--- a/gprof/source.h
+++ b/gprof/source.h
@@ -1,6 +1,6 @@
/* source.h
- Copyright 2000, 2001 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -53,8 +53,8 @@ extern Source_File *source_file_lookup_name PARAMS ((const char *));
Returns a pointer to the output file (which maybe stdout) such
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, int max_width,
- void (*annote) (char *b, int w, int l,
- void *arg),
- void *arg));
+extern FILE *annotate_source
+ PARAMS ((Source_File *sf, unsigned int max_width,
+ void (*annote) (char *, unsigned int, int, PTR arg),
+ PTR arg));
#endif /* source_h */
diff --git a/gprof/sparc.c b/gprof/sparc.c
index 5b1b1e8..a889604 100644
--- a/gprof/sparc.c
+++ b/gprof/sparc.c
@@ -38,7 +38,7 @@ sparc_find_call (parent, p_lowpc, p_highpc)
bfd_vma p_highpc;
{
bfd_vma pc, dest_pc;
- unsigned long insn;
+ unsigned int insn;
Sym *child;
if (core_text_space == 0)
@@ -56,7 +56,7 @@ sparc_find_call (parent, p_lowpc, p_highpc)
DBG (CALLDEBUG, printf ("[find_call] %s: 0x%lx to 0x%lx\n",
parent->name, (unsigned long) p_lowpc,
(unsigned long) p_highpc));
- for (pc = (p_lowpc + 3) & ~3; pc < p_highpc; pc += 4)
+ for (pc = (p_lowpc + 3) & ~(bfd_vma) 3; pc < p_highpc; pc += 4)
{
insn = bfd_get_32 (core_bfd, ((unsigned char *) core_text_space
+ pc - core_text_sect->vma));
diff --git a/gprof/sym_ids.c b/gprof/sym_ids.c
index f388d11..66ee0f6 100644
--- a/gprof/sym_ids.c
+++ b/gprof/sym_ids.c
@@ -1,6 +1,6 @@
/* sym_ids.c
- Copyright 2000, 2001 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -46,6 +46,12 @@ struct sym_id
}
*id_list;
+static void parse_spec PARAMS ((char *, Sym *));
+static void parse_id PARAMS ((struct sym_id *));
+static boolean match PARAMS ((Sym *, Sym *));
+static void extend_match PARAMS ((struct match *, Sym *, Sym_Table *, boolean));
+
+
Sym_Table syms[NUM_TABLES];
#ifdef DEBUG
@@ -74,8 +80,9 @@ static Source_File non_existent_file =
void
-DEFUN (sym_id_add, (spec, which_table),
- const char *spec AND Table_Id which_table)
+sym_id_add (spec, which_table)
+ const char *spec;
+ Table_Id which_table;
{
struct sym_id *id;
int len = strlen (spec);
@@ -103,7 +110,9 @@ DEFUN (sym_id_add, (spec, which_table),
FILENAME not containing a dot can be specified by FILENAME. */
static void
-DEFUN (parse_spec, (spec, sym), char *spec AND Sym * sym)
+parse_spec (spec, sym)
+ char *spec;
+ Sym *sym;
{
char *colon;
@@ -158,7 +167,8 @@ DEFUN (parse_spec, (spec, sym), char *spec AND Sym * sym)
by parse_spec(). */
static void
-DEFUN (parse_id, (id), struct sym_id *id)
+parse_id (id)
+ struct sym_id *id;
{
char *slash;
@@ -207,7 +217,9 @@ DEFUN (parse_id, (id), struct sym_id *id)
/* Return TRUE iff PATTERN matches SYM. */
static boolean
-DEFUN (match, (pattern, sym), Sym * pattern AND Sym * sym)
+match (pattern, sym)
+ Sym *pattern;
+ Sym *sym;
{
return (pattern->file ? pattern->file == sym->file : true)
&& (pattern->line_num ? pattern->line_num == sym->line_num : true)
@@ -219,8 +231,11 @@ DEFUN (match, (pattern, sym), Sym * pattern AND Sym * sym)
static void
-DEFUN (extend_match, (m, sym, tab, second_pass),
- struct match *m AND Sym * sym AND Sym_Table * tab AND boolean second_pass)
+extend_match (m, sym, tab, second_pass)
+ struct match *m;
+ Sym *sym;
+ Sym_Table *tab;
+ boolean second_pass;
{
if (m->prev_match != sym - 1)
{
@@ -255,7 +270,7 @@ DEFUN (extend_match, (m, sym, tab, second_pass),
requests---you get what you ask for! */
void
-DEFUN_VOID (sym_id_parse)
+sym_id_parse ()
{
Sym *sym, *left, *right;
struct sym_id *id;
@@ -354,12 +369,14 @@ DEFUN_VOID (sym_id_parse)
very big (the user has to type them!), so a linear search is probably
tolerable. */
boolean
-DEFUN (sym_id_arc_is_present, (symtab, from, to),
- Sym_Table * symtab AND Sym * from AND Sym * to)
+sym_id_arc_is_present (sym_tab, from, to)
+ Sym_Table *sym_tab;
+ Sym *from;
+ Sym *to;
{
Sym *sym;
- for (sym = symtab->base; sym < symtab->limit; ++sym)
+ for (sym = sym_tab->base; sym < sym_tab->limit; ++sym)
{
if (from->addr >= sym->addr && from->addr <= sym->end_addr
&& arc_lookup (sym, to))
diff --git a/gprof/sym_ids.h b/gprof/sym_ids.h
index 5b65ce2..49565eb 100644
--- a/gprof/sym_ids.h
+++ b/gprof/sym_ids.h
@@ -1,6 +1,6 @@
/* sym_ids.h
- Copyright 2000, 2001 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Binutils.
diff --git a/gprof/symtab.c b/gprof/symtab.c
index 9ca2002..c4ce7ed 100644
--- a/gprof/symtab.c
+++ b/gprof/symtab.c
@@ -1,6 +1,6 @@
/* symtab.c
- Copyright 2000, 2001 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -26,13 +26,16 @@
#include "cg_arcs.h"
#include "corefile.h"
+static int cmp_addr PARAMS ((const PTR, const PTR));
+
Sym_Table symtab;
/* Initialize a symbol (so it's empty). */
void
-DEFUN (sym_init, (sym), Sym * sym)
+sym_init (sym)
+ Sym *sym;
{
memset (sym, 0, sizeof (*sym));
@@ -56,10 +59,12 @@ DEFUN (sym_init, (sym), Sym * sym)
the global symbol survives. */
static int
-DEFUN (cmp_addr, (lp, rp), const PTR lp AND const PTR rp)
+cmp_addr (lp, rp)
+ const PTR lp;
+ const PTR rp;
{
- Sym *left = (Sym *) lp;
- Sym *right = (Sym *) rp;
+ const Sym *left = (const Sym *) lp;
+ const Sym *right = (const Sym *) rp;
if (left->addr > right->addr)
return 1;
@@ -74,7 +79,8 @@ DEFUN (cmp_addr, (lp, rp), const PTR lp AND const PTR rp)
void
-DEFUN (symtab_finalize, (tab), Sym_Table * tab)
+symtab_finalize (tab)
+ Sym_Table *tab;
{
Sym *src, *dst;
bfd_vma prev_addr;
@@ -171,7 +177,9 @@ DEFUN (symtab_finalize, (tab), Sym_Table * tab)
#ifdef DEBUG
Sym *
-DEFUN (dbg_sym_lookup, (symtab, address), Sym_Table * symtab AND bfd_vma address)
+dbg_sym_lookup (sym_tab, address)
+ Sym_Table *sym_tab;
+ bfd_vma address;
{
long low, mid, high;
Sym *sym;
@@ -179,8 +187,8 @@ DEFUN (dbg_sym_lookup, (symtab, address), Sym_Table * symtab AND bfd_vma address
fprintf (stderr, "[dbg_sym_lookup] address 0x%lx\n",
(unsigned long) address);
- sym = symtab->base;
- for (low = 0, high = symtab->len - 1; low != high;)
+ sym = sym_tab->base;
+ for (low = 0, high = sym_tab->len - 1; low != high;)
{
mid = (high + low) >> 1;
@@ -210,7 +218,9 @@ DEFUN (dbg_sym_lookup, (symtab, address), Sym_Table * symtab AND bfd_vma 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 *
-DEFUN (sym_lookup, (symtab, address), Sym_Table * symtab AND bfd_vma address)
+sym_lookup (sym_tab, address)
+ Sym_Table *sym_tab;
+ bfd_vma address;
{
long low, high;
long mid = -1;
@@ -219,11 +229,11 @@ DEFUN (sym_lookup, (symtab, address), Sym_Table * symtab AND bfd_vma address)
int probes = 0;
#endif /* DEBUG */
- if (!symtab->len)
+ if (!sym_tab->len)
return 0;
- sym = symtab->base;
- for (low = 0, high = symtab->len - 1; low != high;)
+ sym = sym_tab->base;
+ for (low = 0, high = sym_tab->len - 1; low != high;)
{
DBG (LOOKUPDEBUG, ++probes);
mid = (high + low) / 2;
@@ -240,7 +250,7 @@ DEFUN (sym_lookup, (symtab, address), Sym_Table * symtab AND bfd_vma address)
{
DBG (LOOKUPDEBUG,
printf ("[sym_lookup] %d probes (symtab->len=%u)\n",
- probes, symtab->len - 1));
+ probes, sym_tab->len - 1));
return &sym[mid];
}
}
@@ -261,7 +271,7 @@ DEFUN (sym_lookup, (symtab, address), Sym_Table * symtab AND bfd_vma address)
else
{
DBG (LOOKUPDEBUG, printf ("[sym_lookup] %d (%u) probes, fall off\n",
- probes, symtab->len - 1));
+ probes, sym_tab->len - 1));
return &sym[mid + 1];
}
}
diff --git a/gprof/symtab.h b/gprof/symtab.h
index 824fe9c..edeb1b3 100644
--- a/gprof/symtab.h
+++ b/gprof/symtab.h
@@ -1,6 +1,6 @@
/* symtab.h
- Copyright 2000, 2001 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -113,6 +113,9 @@ extern Sym_Table symtab; /* The symbol table. */
extern void sym_init PARAMS ((Sym *));
extern void symtab_finalize PARAMS ((Sym_Table *));
+#ifdef DEBUG
+extern Sym *dbg_sym_lookup PARAMS ((Sym_Table *, bfd_vma));
+#endif
extern Sym *sym_lookup PARAMS ((Sym_Table *, bfd_vma));
extern void find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
diff --git a/gprof/utils.c b/gprof/utils.c
index cf6dd29..b18216f 100644
--- a/gprof/utils.c
+++ b/gprof/utils.c
@@ -22,13 +22,15 @@
#include "source.h"
#include "symtab.h"
#include "cg_arcs.h"
+#include "utils.h"
/*
* Print name of symbol. Return number of characters printed.
*/
int
-DEFUN (print_name_only, (self), Sym * self)
+print_name_only (self)
+ Sym *self;
{
const char *name = self->name;
const char *filename;
@@ -87,7 +89,8 @@ DEFUN (print_name_only, (self), Sym * self)
void
-DEFUN (print_name, (self), Sym * self)
+print_name (self)
+ Sym *self;
{
print_name_only (self);