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.
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
\f
-#include <stdio.h>
+#include "libiberty.h"
+#include "gprof.h"
#include "basic_blocks.h"
#include "corefile.h"
#include "gmon_io.h"
#include "gmon_out.h"
-#include "gprof.h"
-#include "libiberty.h"
+#include "search_list.h"
#include "source.h"
+#include "symtab.h"
#include "sym_ids.h"
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
+
+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: */
-bool bb_annotate_all_lines = FALSE;
+bfd_boolean bb_annotate_all_lines = FALSE;
unsigned long bb_min_calls = 1;
int bb_table_length = 10;
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;
/* 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;
/* Skip over variable length string. */
static void
-DEFUN (fskip_string, (fp), FILE * fp)
+fskip_string (fp)
+ FILE *fp;
{
int ch;
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;
}
else
{
- static bool user_warned = FALSE;
+ static bfd_boolean user_warned = FALSE;
if (!user_warned)
{
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;
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);
<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;
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;
char *p;
unsigned long ncalls;
int ncalls_set;
- int len;
+ unsigned int len;
++num_executable_lines;
if (! ncalls_set)
{
- int c;
+ unsigned int c;
for (c = 0; c < width; c++)
buf[c] = ' ';
}
else
{
- int c;
+ unsigned int c;
strcpy (buf + width - len, tmpbuf);
for (c = 0; c < width - len; ++c)
regarding that source file are printed. */
void
-DEFUN_VOID (print_annotated_source)
+print_annotated_source ()
{
Sym *sym, *line_stats, *new_line;
Source_File *sf;