aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gprof/ChangeLog15
-rw-r--r--gprof/alpha.c4
-rw-r--r--gprof/basic_blocks.c59
-rw-r--r--gprof/basic_blocks.h4
-rw-r--r--gprof/call_graph.c10
-rw-r--r--gprof/call_graph.h3
-rw-r--r--gprof/cg_arcs.c12
-rw-r--r--gprof/cg_arcs.h4
-rw-r--r--gprof/cg_print.c40
-rw-r--r--gprof/gmon_io.c7
-rw-r--r--gprof/gprof.c2
-rw-r--r--gprof/hist.c14
-rw-r--r--gprof/i386.c2
-rw-r--r--gprof/source.h2
-rw-r--r--gprof/sparc.c2
-rw-r--r--gprof/sym_ids.c2
-rw-r--r--gprof/symtab.h6
-rw-r--r--gprof/tahoe.c4
-rw-r--r--gprof/vax.c4
19 files changed, 110 insertions, 86 deletions
diff --git a/gprof/ChangeLog b/gprof/ChangeLog
index dc8f3e9..3f0ed67 100644
--- a/gprof/ChangeLog
+++ b/gprof/ChangeLog
@@ -1,3 +1,18 @@
+Wed Aug 12 14:59:06 1998 Ian Lance Taylor <ian@cygnus.com>
+
+ Avoid some overflow cases:
+ * basic_blocks.h (bb_min_calls): Change to unsigned long.
+ * call_graph.h (cg_tally): Change count parameter to unsigned
+ long.
+ * cg_arcs.h (Arc): Change count field to unsigned long.
+ (arc_add): Change count parameter to unsigned long.
+ * source.h (Source_File): Change ncalls field to unsigned long.
+ * symtab.h (Sym): Change fields ncalls, bb_calls, and
+ cg.self_calls to unsigned long.
+ * Many files: Update accordingly.
+
+ * configure, Makefile.in, aclocal.m4: Rebuild with current tools.
+
Fri Jul 10 17:29:49 1998 Stan Cox <scox@equinox.cygnus.com>
* configure.in (BSD44_FORMAT): Define for cygwin32, win32, mingw32
diff --git a/gprof/alpha.c b/gprof/alpha.c
index d9d55d5..ad4f22e 100644
--- a/gprof/alpha.c
+++ b/gprof/alpha.c
@@ -127,7 +127,7 @@ alpha_find_call (parent, p_lowpc, p_highpc)
printf (_("[find_call] 0x%lx: jsr%s <indirect_child>\n"),
(bfd_vma) pc - delta,
pc->j.func == Jxx_FUNC_JSR ? "" : "_coroutine"));
- arc_add (parent, &indirect_child, 0);
+ arc_add (parent, &indirect_child, (unsigned long) 0);
}
break;
@@ -151,7 +151,7 @@ alpha_find_call (parent, p_lowpc, p_highpc)
{
DBG (CALLDEBUG, printf ("\n"));
/* a hit: */
- arc_add (parent, child, 0);
+ arc_add (parent, child, (unsigned long) 0);
continue;
}
}
diff --git a/gprof/basic_blocks.c b/gprof/basic_blocks.c
index 0c0fc43..07b6f8d 100644
--- a/gprof/basic_blocks.c
+++ b/gprof/basic_blocks.c
@@ -19,7 +19,7 @@
* Default option values:
*/
bool bb_annotate_all_lines = FALSE;
-int bb_min_calls = 1;
+unsigned long bb_min_calls = 1;
int bb_table_length = 10;
/*
@@ -90,10 +90,10 @@ DEFUN (cmp_ncalls, (lp, rp), const void *lp AND const void *rp)
return -1;
}
- if (right->ncalls != left->ncalls)
- {
- return right->ncalls - left->ncalls;
- }
+ if (left->ncalls < right->ncalls)
+ return 1;
+ else if (left->ncalls > right->ncalls)
+ return -1;
return left->line_num - right->line_num;
}
@@ -126,7 +126,7 @@ DEFUN (bb_read_rec, (ifp, filename), FILE * ifp AND const char *filename)
{
int nblocks, b;
bfd_vma addr;
- long ncalls;
+ unsigned long ncalls;
Sym *sym;
if (fread (&nblocks, sizeof (nblocks), 1, ifp) != 1)
@@ -189,7 +189,7 @@ DEFUN (bb_read_rec, (ifp, filename), FILE * ifp AND const char *filename)
int i;
DBG (BBDEBUG,
- printf ("[bb_read_rec] 0x%lx->0x%lx (%s:%d) cnt=%ld\n",
+ printf ("[bb_read_rec] 0x%lx->0x%lx (%s:%d) cnt=%lu\n",
addr, sym->addr, sym->name, sym->line_num, ncalls));
for (i = 0; i < NBBS; i++)
@@ -231,7 +231,7 @@ DEFUN (bb_write_blocks, (ofp, filename), FILE * ofp AND const char *filename)
const unsigned char tag = GMON_TAG_BB_COUNT;
int nblocks = 0;
bfd_vma addr;
- long ncalls;
+ unsigned long ncalls;
Sym *sym;
int i;
@@ -319,7 +319,7 @@ DEFUN_VOID (print_exec_counts)
{
if (sym->ncalls > 0 || ! ignore_zeros)
{
- printf (_("%s:%d: (%s:0x%lx) %d executions\n"),
+ printf (_("%s:%d: (%s:0x%lx) %lu executions\n"),
sym->file ? sym->file->name : _("<unknown>"), sym->line_num,
sym->name, sym->addr, sym->ncalls);
}
@@ -327,7 +327,7 @@ DEFUN_VOID (print_exec_counts)
{
if (sym->bb_calls[j] > 0 || ! ignore_zeros)
{
- printf (_("%s:%d: (%s:0x%lx) %d executions\n"),
+ printf (_("%s:%d: (%s:0x%lx) %lu executions\n"),
sym->file ? sym->file->name : _("<unknown>"), sym->line_num,
sym->name, sym->bb_addr[j], sym->bb_calls[j]);
}
@@ -355,8 +355,8 @@ DEFUN (annotate_with_count, (buf, width, line_num, arg),
Source_File *sf = arg;
Sym *b;
int i;
- static int last_count;
- int last_print=-1;
+ static unsigned long last_count;
+ unsigned long last_print = (unsigned long) -1;
b = NULL;
if (line_num <= sf->num_lines)
@@ -373,7 +373,8 @@ DEFUN (annotate_with_count, (buf, width, line_num, arg),
{
char tmpbuf[NBBS * 30];
char *p;
- int ncalls;
+ unsigned long ncalls;
+ int ncalls_set;
int len;
++num_executable_lines;
@@ -381,7 +382,8 @@ DEFUN (annotate_with_count, (buf, width, line_num, arg),
p = tmpbuf;
*p = '\0';
- ncalls = -1;
+ ncalls = 0;
+ ncalls_set = 0;
/* If this is a function entry point, label the line no matter what.
* Otherwise, we're in the middle of a function, so check to see
@@ -393,19 +395,21 @@ DEFUN (annotate_with_count, (buf, width, line_num, arg),
if (b->is_func)
{
- sprintf (p, "%d", b->ncalls);
+ sprintf (p, "%lu", b->ncalls);
p += strlen (p);
last_count = b->ncalls;
last_print = last_count;
ncalls = b->ncalls;
+ ncalls_set = 1;
}
else if (bb_annotate_all_lines
&& b->bb_addr[0] && b->bb_addr[0] > b->addr)
{
- sprintf (p, "%d", last_count);
+ sprintf (p, "%lu", last_count);
p += strlen (p);
last_print = last_count;
ncalls = last_count;
+ ncalls_set = 1;
}
/* Loop through all of this line's basic-blocks. For each one,
@@ -416,8 +420,11 @@ DEFUN (annotate_with_count, (buf, width, line_num, arg),
for (i = 0; i < NBBS && b->bb_addr[i]; i++)
{
last_count = b->bb_calls[i];
- if (ncalls < 0)
- ncalls = 0;
+ if (! ncalls_set)
+ {
+ ncalls = 0;
+ ncalls_set = 1;
+ }
ncalls += last_count;
if (bb_annotate_all_lines && last_count == last_print)
@@ -427,7 +434,7 @@ DEFUN (annotate_with_count, (buf, width, line_num, arg),
if (p > tmpbuf)
*p++ = ',';
- sprintf (p, "%d", last_count);
+ sprintf (p, "%lu", last_count);
p += strlen (p);
last_print = last_count;
@@ -442,12 +449,13 @@ DEFUN (annotate_with_count, (buf, width, line_num, arg),
if (bb_annotate_all_lines && p == tmpbuf)
{
- sprintf (p, "%d", last_count);
+ sprintf (p, "%lu", last_count);
p += strlen (p);
ncalls = last_count;
+ ncalls_set = 1;
}
- if (ncalls < 0)
+ if (! ncalls_set)
{
int c;
@@ -594,11 +602,11 @@ DEFUN_VOID (print_annotated_source)
for (i = 0; i < table_len; ++i)
{
sym = sf->line[i];
- if (!sym || sym->ncalls <= 0)
+ if (!sym || sym->ncalls == 0)
{
break;
}
- fprintf (ofp, "%9d %10d\n", sym->line_num, sym->ncalls);
+ fprintf (ofp, "%9d %10lu\n", sym->line_num, sym->ncalls);
}
}
@@ -613,10 +621,11 @@ DEFUN_VOID (print_annotated_source)
num_executable_lines
? 100.0 * num_lines_executed / (double) num_executable_lines
: 100.0);
- fprintf (ofp, _("\n%9d Total number of line executions\n"), sf->ncalls);
+ fprintf (ofp, _("\n%9lu Total number of line executions\n"),
+ sf->ncalls);
fprintf (ofp, _("%9.2f Average executions per line\n"),
num_executable_lines
- ? sf->ncalls / (double) num_executable_lines
+ ? (double) sf->ncalls / (double) num_executable_lines
: 0.0);
if (ofp != stdout)
{
diff --git a/gprof/basic_blocks.h b/gprof/basic_blocks.h
index daba408..923eca1 100644
--- a/gprof/basic_blocks.h
+++ b/gprof/basic_blocks.h
@@ -10,8 +10,8 @@
* Options:
*/
extern bool bb_annotate_all_lines; /* force annotation of all lines? */
-extern int bb_table_length; /* length of most-used bb table */
-extern int bb_min_calls; /* minimum execution count */
+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 * ifp, const char *filename));
extern void bb_write_blocks PARAMS ((FILE * ofp, const char *filename));
diff --git a/gprof/call_graph.c b/gprof/call_graph.c
index 693d337..8f12cbd 100644
--- a/gprof/call_graph.c
+++ b/gprof/call_graph.c
@@ -8,7 +8,7 @@
extern void
DEFUN (cg_tally, (from_pc, self_pc, count),
- bfd_vma from_pc AND bfd_vma self_pc AND int count)
+ bfd_vma from_pc AND bfd_vma self_pc AND unsigned long count)
{
Sym *parent;
Sym *child;
@@ -45,7 +45,7 @@ DEFUN (cg_tally, (from_pc, self_pc, count),
{
child->ncalls += count;
DBG (TALLYDEBUG,
- printf (_("[cg_tally] arc from %s to %s traversed %d times\n"),
+ printf (_("[cg_tally] arc from %s to %s traversed %lu times\n"),
parent->name, child->name, count));
arc_add (parent, child, count);
}
@@ -63,7 +63,7 @@ DEFUN (cg_read_rec, (ifp, filename), FILE * ifp AND CONST char *filename)
{
bfd_vma from_pc, self_pc;
struct gmon_cg_arc_record arc;
- int count;
+ unsigned long count;
if (fread (&arc, sizeof (arc), 1, ifp) != 1)
{
@@ -75,7 +75,7 @@ DEFUN (cg_read_rec, (ifp, filename), FILE * ifp AND CONST char *filename)
self_pc = get_vma (core_bfd, (bfd_byte *) arc.self_pc);
count = bfd_get_32 (core_bfd, (bfd_byte *) arc.count);
DBG (SAMPLEDEBUG,
- printf ("[cg_read_rec] frompc 0x%lx selfpc 0x%lx count %d\n",
+ printf ("[cg_read_rec] frompc 0x%lx selfpc 0x%lx count %lu\n",
from_pc, self_pc, count));
/* add this arc: */
cg_tally (from_pc, self_pc, count);
@@ -109,7 +109,7 @@ DEFUN (cg_write_arcs, (ofp, filename), FILE * ofp AND const char *filename)
done (1);
}
DBG (SAMPLEDEBUG,
- printf ("[cg_write_arcs] frompc 0x%lx selfpc 0x%lx count %d\n",
+ printf ("[cg_write_arcs] frompc 0x%lx selfpc 0x%lx count %lu\n",
arc->parent->addr, arc->child->addr, arc->count));
}
}
diff --git a/gprof/call_graph.h b/gprof/call_graph.h
index 6e9413a..be5139b 100644
--- a/gprof/call_graph.h
+++ b/gprof/call_graph.h
@@ -5,7 +5,8 @@
#include "gprof.h"
#include "symtab.h"
-extern void cg_tally PARAMS ((bfd_vma from_pc, bfd_vma self_pc, int count));
+extern void cg_tally PARAMS ((bfd_vma from_pc, bfd_vma self_pc,
+ unsigned long count));
extern void cg_read_rec PARAMS ((FILE * ifp, const char *filename));
extern void cg_write_arcs PARAMS ((FILE * ofp, const char *filename));
diff --git a/gprof/cg_arcs.c b/gprof/cg_arcs.c
index d14238d..0702317 100644
--- a/gprof/cg_arcs.c
+++ b/gprof/cg_arcs.c
@@ -65,12 +65,12 @@ DEFUN (arc_lookup, (parent, child), Sym * parent AND Sym * child)
*/
void
DEFUN (arc_add, (parent, child, count),
- Sym * parent AND Sym * child AND int count)
+ Sym * parent AND Sym * child AND unsigned long count)
{
static unsigned int maxarcs = 0;
Arc *arc, **newarcs;
- DBG (TALLYDEBUG, printf ("[arc_add] %d arcs from %s to %s\n",
+ DBG (TALLYDEBUG, printf ("[arc_add] %lu arcs from %s to %s\n",
count, parent->name, child->name));
arc = arc_lookup (parent, child);
if (arc)
@@ -78,7 +78,7 @@ DEFUN (arc_add, (parent, child, count),
/*
* A hit: just increment the count.
*/
- DBG (TALLYDEBUG, printf ("[tally] hit %d += %d\n",
+ DBG (TALLYDEBUG, printf ("[tally] hit %lu += %lu\n",
arc->count, count));
arc->count += count;
return;
@@ -211,7 +211,7 @@ DEFUN (propagate_time, (parent), Sym * parent)
DBG (PROPDEBUG,
printf ("[prop_time] child \t");
print_name (child);
- printf (" with %f %f %d/%d\n", child->hist.time,
+ printf (" with %f %f %lu/%lu\n", child->hist.time,
child->cg.child_time, arc->count, child->ncalls);
printf ("[prop_time] parent\t");
print_name (parent);
@@ -361,7 +361,7 @@ DEFUN (inherit_flags, (child), Sym * child)
* is static (and all others are, too)) no time propagates
* along this arc.
*/
- if (child->ncalls)
+ if (child->ncalls != 0)
{
child->cg.prop.fract += parent->cg.prop.fract
* (((double) arc->count) / ((double) child->ncalls));
@@ -391,7 +391,7 @@ DEFUN (inherit_flags, (child), Sym * child)
* arc is static (and all others are, too)) no time
* propagates along this arc.
*/
- if (head->ncalls)
+ if (head->ncalls != 0)
{
head->cg.prop.fract += parent->cg.prop.fract
* (((double) arc->count) / ((double) head->ncalls));
diff --git a/gprof/cg_arcs.h b/gprof/cg_arcs.h
index b9c3a36..caa0197 100644
--- a/gprof/cg_arcs.h
+++ b/gprof/cg_arcs.h
@@ -15,7 +15,7 @@ typedef struct arc
{
Sym *parent; /* source vertice of arc */
Sym *child; /* dest vertice of arc */
- int count; /* # of calls from parent to child */
+ unsigned long count; /* # of calls from parent to child */
double time; /* time inherited along arc */
double child_time; /* child-time inherited along arc */
struct arc *next_parent; /* next parent of CHILD */
@@ -27,7 +27,7 @@ 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, int count));
+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 Arc **arcs;
diff --git a/gprof/cg_print.c b/gprof/cg_print.c
index c604e6c..e645bc7 100644
--- a/gprof/cg_print.c
+++ b/gprof/cg_print.c
@@ -86,13 +86,13 @@ DEFUN (print_cycle, (cyc), Sym * cyc)
sprintf (buf, "[%d]", cyc->cg.index);
printf (bsd_style_output
- ? "%-6.6s %5.1f %7.2f %11.2f %7d"
- : "%-6.6s %5.1f %7.2f %7.2f %7d", buf,
+ ? "%-6.6s %5.1f %7.2f %11.2f %7lu"
+ : "%-6.6s %5.1f %7.2f %7.2f %7lu", buf,
100 * (cyc->cg.prop.self + cyc->cg.prop.child) / print_time,
cyc->cg.prop.self / hz, cyc->cg.prop.child / hz, cyc->ncalls);
if (cyc->cg.self_calls != 0)
{
- printf ("+%-7d", cyc->cg.self_calls);
+ printf ("+%-7lu", cyc->cg.self_calls);
}
else
{
@@ -111,8 +111,8 @@ DEFUN (cmp_member, (left, right), Sym * left AND Sym * right)
{
double left_time = left->cg.prop.self + left->cg.prop.child;
double right_time = right->cg.prop.self + right->cg.prop.child;
- long left_calls = left->ncalls + left->cg.self_calls;
- long right_calls = right->ncalls + right->cg.self_calls;
+ unsigned long left_calls = left->ncalls + left->cg.self_calls;
+ unsigned long right_calls = right->ncalls + right->cg.self_calls;
if (left_time > right_time)
{
@@ -176,13 +176,13 @@ DEFUN (print_members, (cyc), Sym * cyc)
for (member = cyc->cg.cyc.next; member; member = member->cg.cyc.next)
{
printf (bsd_style_output
- ? "%6.6s %5.5s %7.2f %11.2f %7d"
- : "%6.6s %5.5s %7.2f %7.2f %7d",
+ ? "%6.6s %5.5s %7.2f %11.2f %7lu"
+ : "%6.6s %5.5s %7.2f %7.2f %7lu",
"", "", member->cg.prop.self / hz, member->cg.prop.child / hz,
member->ncalls);
if (member->cg.self_calls != 0)
{
- printf ("+%-7d", member->cg.self_calls);
+ printf ("+%-7lu", member->cg.self_calls);
}
else
{
@@ -218,13 +218,13 @@ DEFUN (cmp_arc, (left, right), Arc * left AND Arc * right)
print_name (left_parent);
printf (" calls ");
print_name (left_child);
- printf (" %f + %f %d/%d\n", left->time, left->child_time,
+ printf (" %f + %f %lu/%lu\n", left->time, left->child_time,
left->count, left_child->ncalls);
printf ("[cmp_arc] ");
print_name (right_parent);
printf (" calls ");
print_name (right_child);
- printf (" %f + %f %d/%d\n", right->time, right->child_time,
+ printf (" %f + %f %lu/%lu\n", right->time, right->child_time,
right->count, right_child->ncalls);
printf ("\n");
);
@@ -364,8 +364,8 @@ DEFUN (print_parents, (child), Sym * child)
{
/* selfcall or call among siblings: */
printf (bsd_style_output
- ? "%6.6s %5.5s %7.7s %11.11s %7d %7.7s "
- : "%6.6s %5.5s %7.7s %7.7s %7d %7.7s ",
+ ? "%6.6s %5.5s %7.7s %11.11s %7lu %7.7s "
+ : "%6.6s %5.5s %7.7s %7.7s %7lu %7.7s ",
"", "", "", "",
arc->count, "");
print_name (parent);
@@ -375,8 +375,8 @@ DEFUN (print_parents, (child), Sym * child)
{
/* regular parent of child: */
printf (bsd_style_output
- ? "%6.6s %5.5s %7.2f %11.2f %7d/%-7d "
- : "%6.6s %5.5s %7.2f %7.2f %7d/%-7d ",
+ ? "%6.6s %5.5s %7.2f %11.2f %7lu/%-7lu "
+ : "%6.6s %5.5s %7.2f %7.2f %7lu/%-7lu ",
"", "",
arc->time / hz, arc->child_time / hz,
arc->count, cycle_head->ncalls);
@@ -437,8 +437,8 @@ DEFUN (print_children, (parent), Sym * parent)
{
/* self call or call to sibling: */
printf (bsd_style_output
- ? "%6.6s %5.5s %7.7s %11.11s %7d %7.7s "
- : "%6.6s %5.5s %7.7s %7.7s %7d %7.7s ",
+ ? "%6.6s %5.5s %7.7s %11.11s %7lu %7.7s "
+ : "%6.6s %5.5s %7.7s %7.7s %7lu %7.7s ",
"", "", "", "", arc->count, "");
print_name (child);
printf ("\n");
@@ -447,8 +447,8 @@ DEFUN (print_children, (parent), Sym * parent)
{
/* regular child of parent: */
printf (bsd_style_output
- ? "%6.6s %5.5s %7.2f %11.2f %7d/%-7d "
- : "%6.6s %5.5s %7.2f %7.2f %7d/%-7d ",
+ ? "%6.6s %5.5s %7.2f %11.2f %7lu/%-7lu "
+ : "%6.6s %5.5s %7.2f %7.2f %7lu/%-7lu ",
"", "",
arc->time / hz, arc->child_time / hz,
arc->count, child->cg.cyc.head->ncalls);
@@ -472,10 +472,10 @@ DEFUN (print_line, (np), Sym * np)
np->cg.prop.self / hz, np->cg.prop.child / hz);
if ((np->ncalls + np->cg.self_calls) != 0)
{
- printf (" %7d", np->ncalls);
+ printf (" %7lu", np->ncalls);
if (np->cg.self_calls != 0)
{
- printf ("+%-7d ", np->cg.self_calls);
+ printf ("+%-7lu ", np->cg.self_calls);
}
else
{
diff --git a/gprof/gmon_io.c b/gprof/gmon_io.c
index af4d8ac..6cf9167 100644
--- a/gprof/gmon_io.c
+++ b/gprof/gmon_io.c
@@ -149,7 +149,8 @@ DEFUN (gmon_out_read, (filename), const char *filename)
bfd_vma high_pc;
int ncnt;
};
- int i, samp_bytes, count;
+ int i, samp_bytes;
+ unsigned long count;
bfd_vma from_pc, self_pc;
struct raw_arc raw_arc;
struct raw_phdr raw;
@@ -260,7 +261,7 @@ DEFUN (gmon_out_read, (filename), const char *filename)
self_pc = get_vma (core_bfd, (bfd_byte *) raw_arc.self_pc);
count = bfd_get_32 (core_bfd, (bfd_byte *) raw_arc.count);
DBG (SAMPLEDEBUG,
- printf ("[gmon_out_read] frompc 0x%lx selfpc 0x%lx count %d\n",
+ printf ("[gmon_out_read] frompc 0x%lx selfpc 0x%lx count %lu\n",
from_pc, self_pc, count));
/* add this arc: */
cg_tally (from_pc, self_pc, count);
@@ -399,7 +400,7 @@ DEFUN (gmon_out_write, (filename), const char *filename)
done (1);
}
DBG (SAMPLEDEBUG,
- printf ("[dumpsum] frompc 0x%lx selfpc 0x%lx count %d\n",
+ printf ("[dumpsum] frompc 0x%lx selfpc 0x%lx count %lu\n",
arc->parent->addr, arc->child->addr, arc->count));
}
}
diff --git a/gprof/gprof.c b/gprof/gprof.c
index 5438c91..efb16b3 100644
--- a/gprof/gprof.c
+++ b/gprof/gprof.c
@@ -279,7 +279,7 @@ DEFUN (main, (argc, argv), int argc AND char **argv)
print_path = TRUE;
break;
case 'm':
- bb_min_calls = atoi (optarg);
+ bb_min_calls = (unsigned long) strtoul (optarg, (char **) NULL, 10);
break;
case 'n':
sym_id_add (optarg, INCL_TIME);
diff --git a/gprof/hist.c b/gprof/hist.c
index e027d9a..5cdbbbb 100644
--- a/gprof/hist.c
+++ b/gprof/hist.c
@@ -427,9 +427,9 @@ DEFUN (print_line, (sym, scale), Sym * sym AND double scale)
total_time > 0.0 ? 100 * sym->hist.time / total_time : 0.0,
accum_time / hz, sym->hist.time / hz);
}
- if (sym->ncalls)
+ if (sym->ncalls != 0)
{
- printf (" %8d %8.2f %8.2f ",
+ printf (" %8lu %8.2f %8.2f ",
sym->ncalls, scale * sym->hist.time / hz / sym->ncalls,
scale * (sym->hist.time + sym->cg.child_time) / hz / sym->ncalls);
}
@@ -460,7 +460,6 @@ DEFUN (cmp_time, (lp, rp), const PTR lp AND const PTR rp)
const Sym *left = *(const Sym **) lp;
const Sym *right = *(const Sym **) rp;
double time_diff;
- long call_diff;
time_diff = right->hist.time - left->hist.time;
if (time_diff > 0.0)
@@ -472,12 +471,11 @@ DEFUN (cmp_time, (lp, rp), const PTR lp AND const PTR rp)
return -1;
}
- call_diff = right->ncalls - left->ncalls;
- if (call_diff > 0)
+ if (right->ncalls > left->ncalls)
{
return 1;
}
- if (call_diff < 0)
+ if (right->ncalls < left->ncalls)
{
return -1;
}
@@ -547,7 +545,7 @@ DEFUN_VOID (hist_print)
for (index = 0; index < symtab.len; ++index)
{
sym = time_sorted_syms[index];
- if (sym->ncalls)
+ if (sym->ncalls != 0)
{
time = (sym->hist.time + sym->cg.child_time) / sym->ncalls;
if (time > top_time)
@@ -557,7 +555,7 @@ DEFUN_VOID (hist_print)
}
}
}
- if (top_dog && top_dog->ncalls && top_time > 0.0)
+ if (top_dog && top_dog->ncalls != 0 && top_time > 0.0)
{
top_time /= hz;
while (SItab[log_scale].scale * top_time < 1000.0
diff --git a/gprof/i386.c b/gprof/i386.c
index 6ce4eea..18aad1c 100644
--- a/gprof/i386.c
+++ b/gprof/i386.c
@@ -86,7 +86,7 @@ i386_find_call (parent, p_lowpc, p_highpc)
*/
DBG (CALLDEBUG,
printf ("\tdestpc 0x%lx (%s)\n", destpc, child->name));
- arc_add (parent, child, (long) 0);
+ arc_add (parent, child, (unsigned long) 0);
instructp += 4; /* call is a 5 byte instruction */
continue;
}
diff --git a/gprof/source.h b/gprof/source.h
index ebdbb3b..b33bad3 100644
--- a/gprof/source.h
+++ b/gprof/source.h
@@ -9,7 +9,7 @@ typedef struct source_file
{
struct source_file *next;
const char *name; /* name of source file */
- int ncalls; /* # of "calls" to this file */
+ unsigned long ncalls; /* # of "calls" to this file */
int num_lines; /* # of lines in file */
int nalloced; /* number of lines allocated */
void **line; /* usage-dependent per-line data */
diff --git a/gprof/sparc.c b/gprof/sparc.c
index fd0f469..ad702b1 100644
--- a/gprof/sparc.c
+++ b/gprof/sparc.c
@@ -75,7 +75,7 @@ sparc_find_call (parent, p_lowpc, p_highpc)
if (child->addr == dest_pc)
{
/* a hit: */
- arc_add (parent, child, 0);
+ arc_add (parent, child, (unsigned long) 0);
continue;
}
}
diff --git a/gprof/sym_ids.c b/gprof/sym_ids.c
index 24814e8..ba3ca28 100644
--- a/gprof/sym_ids.c
+++ b/gprof/sym_ids.c
@@ -329,7 +329,7 @@ DEFUN_VOID (sym_id_parse)
right->name ? right->name : "*", right->addr,
right->end_addr,
table_name[id->which_table]));
- arc_add (left, right, 0);
+ arc_add (left, right, (unsigned long) 0);
}
}
}
diff --git a/gprof/symtab.h b/gprof/symtab.h
index 1ffbc6e..a6a450e 100644
--- a/gprof/symtab.h
+++ b/gprof/symtab.h
@@ -41,11 +41,11 @@ typedef struct sym
is_bb_head:1, /* is this the head of a basic-blk? */
mapped:1, /* this symbol was mapped to another name */
has_been_placed:1; /* have we placed this symbol? */
- int ncalls; /* how many times executed */
+ unsigned long ncalls; /* how many times executed */
int nuses; /* how many times this symbol appears in
a particular context */
bfd_vma bb_addr[NBBS]; /* address of basic-block start */
- int bb_calls[NBBS]; /* how many times basic-block was called */
+ unsigned long bb_calls[NBBS]; /* how many times basic-block was called */
struct sym *next; /* for building chains of syms */
struct sym *prev; /* for building chains of syms */
@@ -62,7 +62,7 @@ typedef struct sym
/* call-graph specific info: */
struct
{
- int self_calls; /* how many calls to self */
+ unsigned long self_calls; /* how many calls to self */
double child_time; /* cumulative ticks in children */
int index; /* index in the graph list */
int top_order; /* graph call chain top-sort order */
diff --git a/gprof/tahoe.c b/gprof/tahoe.c
index 55db278..d133c17 100644
--- a/gprof/tahoe.c
+++ b/gprof/tahoe.c
@@ -293,7 +293,7 @@ tahoe_find_call (parent, p_lowpc, p_highpc)
* [are there others that we miss?,
* e.g. arrays of pointers to functions???]
*/
- arc_add (parent, &indirectchild, (long) 0);
+ arc_add (parent, &indirectchild, (unsigned long) 0);
length += tahoe_operandlength (instructp + length);
continue;
case byterel:
@@ -319,7 +319,7 @@ tahoe_find_call (parent, p_lowpc, p_highpc)
/*
* a hit
*/
- arc_add (parent, child, (long) 0);
+ arc_add (parent, child, (unsigned long) 0);
length += tahoe_operandlength (instructp + length);
continue;
}
diff --git a/gprof/vax.c b/gprof/vax.c
index c1f77df..1a7bd8d 100644
--- a/gprof/vax.c
+++ b/gprof/vax.c
@@ -296,7 +296,7 @@ vax_find_call (parent, p_lowpc, p_highpc)
* [are there others that we miss?,
* e.g. arrays of pointers to functions???]
*/
- arc_add (parent, &indirectchild, (long) 0);
+ arc_add (parent, &indirectchild, (unsigned long) 0);
length += vax_operandlength (
(struct modebyte *) (instructp + length));
continue;
@@ -323,7 +323,7 @@ vax_find_call (parent, p_lowpc, p_highpc)
/*
* a hit
*/
- arc_add (parent, child, (long) 0);
+ arc_add (parent, child, (unsigned long) 0);
length += vax_operandlength ((struct modebyte *)
(instructp + length));
continue;