This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gprof fix for IA-64 (and other platforms...)


Please consider the attached patch for inclusion into binutils.  The
patch is relative to the current CVS tree (as of today) but if it's
not too late, it would be useful if it could be included in the 2.11
branch as well.  The patch is intended to fix a long-standing problem
in gprof where it assumed that the pointer size of the target's
gmon.out format is the same size as the size of a pointer on the host.
Jes Sorensen was kind enough to write an autoconf patch that attempts
to determine the gmon.out pointer size based on the systems gmon_out.h
header file (and if that doesn't exist, it falls back on the old
scheme).  With this patch plus my earlier changes to clean up the
gmon.out I/O routines (also included below), it is now possible to
build gprof in a cross environment and have it work properly.  There
are also some minor cleanups in the patch, such as the formatting of
bb_exit_func.c and the fixing of whitespace problems in various files.

The patch has been tested on IA-64 Linux both with normal gprof
profiling and line-by-line profiling and seems to work fine.  Also, I
tried to be careful not to introduce any ANSIism this time and I
believe this patch should be safe for all architectures and platforms.

Note: The patch changes configure.in so it will be necessary to rerun
"autoconf" after applying it.

Thanks,

	--david

gprof/ChangeLog

2001-03-12  David Mosberger  <davidm@hpl.hp.com>

	* bb_exit_func.c: Run it through "indent".

	* gconfig.in: Mention and document GMON_PTR_SIZE.

	* basic_blocks.c: Whitespace cleanup.
	* call_graph.c: Ditto.
	* call_graph.h: Ditto.
	* cg_arcs.c: Ditto.
	* cg_print.c: Ditto.
	* cg_print.h: Ditto.
	* corefile.c: Ditto.
	* corefile.h: Ditto.
	* gmon_io.c: Ditto.
	* gmon_io.h: Ditto.
	* gmon_out.h: Ditto.
	* gprof.c: Ditto.
	* hist.c: Ditto.
	* hist.h: Ditto.
	* i386.c: Ditto.
	* search_list.c: Ditto.
	* search_list.h: Ditto.
	* source.h: Ditto.
	* sym_ids.c: Ditto.
	* sym_ids.h: Ditto.
	* symtab.c: Ditto.
	* symtab.h: Ditto.
	* tahoe.c: Ditto.
	* vax.c: Ditto.

	* hist.c: Declare hist_dimension[] as an array of 16 characters.
	We never copy more than that many bytes anyhow, so this is safe
	and preserves the existing behavior.

	* gmon_out.h: Delete gmon_hist_hdr and gmon_cg_arc_record
	structures (they're no longer used).

	* configure.in: When determining value for GMON_PTR_SIZE, fall
	back to using sizeof(char *) if the platform doesn't have its
	own <sys/gmon_out.h>.

	* Patch by Jes Sorensen:

	* gmon_out.h: Use GMON_PTR_SIZE instead of sizeof(char*).
	* gmon.h: Ditto.
	* configure.in: Get GMON_PTR_SIZE from existing <sys/gmon_out.h>
	if it exists.

2000-05-04  David Mosberger  <davidm@hpl.hp.com>

	* call_graph.c (cg_read_rec): Adjust type of "count" from
	"unsigned long" to "u_int32_t".

2000-04-07  David Mosberger  <davidm@hpl.hp.com>

	* gmon_io.c (put_vma): Declare "static".
	(get_vma): Ditto.
	(gmon_io_write): New function.
	(gmon_io_write_8): Ditto.
	(gmon_io_write_16): Ditto.
	(gmon_io_write_32): Ditto.
	(gmon_io_write_vma): Ditto.
	(gmon_io_read): Ditto.
	(gmon_io_read_16): Ditto.
	(gmon_io_read_32): Ditto.
	(gmon_io_read_vma): Ditto.

	* basic_blocks.c (bb_read_rec): Use
	gmon_io_read*()/gmon_io_write*() to read/write data file in a more
	portable fashion.
	(bb_write_blocks): Ditto.
	* call_graph.c (cg_read_rec): Ditto.
	(cg_write_arcs): Ditto.
	* hist.c (hist_read_rec): Ditto.
	* hist.c (hist_write_hist): Ditto.

Index: basic_blocks.c
===================================================================
RCS file: /cvs/src/src/gprof/basic_blocks.c,v
retrieving revision 1.4
diff -u -r1.4 basic_blocks.c
--- basic_blocks.c	2001/01/27 19:54:49	1.4
+++ basic_blocks.c	2001/03/13 02:17:10
@@ -2,7 +2,7 @@
    of basic-block info to/from gmon.out; computing and formatting of
    basic-block related statistics.
 
-   Copyright (C) 2000  Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001  Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
@@ -21,6 +21,7 @@
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    02111-1307, USA.  */
 
+#include <inttypes.h>
 #include <stdio.h>
 #include "basic_blocks.h"
 #include "corefile.h"
@@ -58,7 +59,7 @@
   if (left->file && right->file)
     {
       r = strcmp (left->file->name, right->file->name);
-      
+
       if (r)
 	return r;
 
@@ -115,19 +116,18 @@
 void
 DEFUN (bb_read_rec, (ifp, filename), FILE * ifp AND const char *filename)
 {
-  int nblocks, b;
-  bfd_vma addr;
-  unsigned long ncalls;
+  int32_t nblocks, b;
+  bfd_vma addr, ncalls;
   Sym *sym;
 
-  if (fread (&nblocks, sizeof (nblocks), 1, ifp) != 1)
+  if (gmon_io_read_32 (ifp, &nblocks))
     {
-      fprintf (stderr, _("%s: %s: unexpected end of file\n"), whoami, filename);
+      fprintf (stderr, _("%s: %s: unexpected end of file\n"),
+	       whoami, filename);
       done (1);
     }
 
   nblocks = bfd_get_32 (core_bfd, (bfd_byte *) & nblocks);
-  
   if (gmon_file_version == 0)
     fskip_string (ifp);
 
@@ -136,7 +136,7 @@
       if (gmon_file_version == 0)
 	{
 	  int line_num;
-	  
+
 	  /* Version 0 had lots of extra stuff that we don't
 	     care about anymore.  */
 	  if ((fread (&ncalls, sizeof (ncalls), 1, ifp) != 1)
@@ -149,24 +149,17 @@
 	      done (1);
 	    }
 	}
-      else
+      else if (gmon_io_read_vma (ifp, &addr)
+	       || gmon_io_read_vma (ifp, &ncalls))
 	{
-	  if (fread (&addr, sizeof (addr), 1, ifp) != 1
-	      || fread (&ncalls, sizeof (ncalls), 1, ifp) != 1)
-	    {
-	      perror (filename);
-	      done (1);
-	    }
+	  perror (filename);
+	  done (1);
 	}
 
       /* Basic-block execution counts are meaningful only if we're
-         profiling at the line-by-line level:  */
+	 profiling at the line-by-line level:  */
       if (line_granularity)
 	{
-	  /* Convert from target to host endianness:  */
-	  addr = get_vma (core_bfd, (bfd_byte *) & addr);
-	  ncalls = bfd_get_32 (core_bfd, (bfd_byte *) &ncalls);
-
 	  sym = sym_lookup (&symtab, addr);
 
 	  if (sym)
@@ -211,10 +204,7 @@
 void
 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;
-  unsigned long ncalls;
+  int32_t nblocks = 0;
   Sym *sym;
   int i;
 
@@ -227,24 +217,16 @@
     }
 
   /* Write header:  */
-  bfd_put_32 (core_bfd, nblocks, (bfd_byte *) & nblocks);
-  if (fwrite (&tag, sizeof (tag), 1, ofp) != 1
-      || fwrite (&nblocks, sizeof (nblocks), 1, ofp) != 1)
-    {
-      perror (filename);
-      done (1);
-    }
+  gmon_io_write_8 (ofp, GMON_TAG_BB_COUNT);
+  gmon_io_write_32 (ofp, nblocks);
 
   /* Write counts:  */
   for (sym = symtab.base; sym < symtab.limit; ++sym)
     {
       for (i = 0; i < NBBS && sym->bb_addr[i]; i++)
 	{
-	  put_vma (core_bfd, sym->bb_addr[i], (bfd_byte *) & addr);
-	  bfd_put_32 (core_bfd, sym->bb_calls[i], (bfd_byte *) & ncalls);
-
-	  if (fwrite (&addr, sizeof (addr), 1, ofp) != 1
-	      || fwrite (&ncalls, sizeof (ncalls), 1, ofp) != 1)
+	  if (gmon_io_write_vma (ofp, sym->bb_addr[i])
+	      || gmon_io_write_vma (ofp, sym->bb_calls[i]))
 	    {
 	      perror (filename);
 	      done (1);
@@ -255,9 +237,9 @@
 
 /* Output basic-block statistics in a format that is easily parseable.
    Current the format is:
-  
-        <filename>:<line-number>: (<function-name>:<bb-addr): <ncalls>  */
 
+	<filename>:<line-number>: (<function-name>:<bb-addr): <ncalls>  */
+
 void
 DEFUN_VOID (print_exec_counts)
 {
@@ -272,12 +254,12 @@
   /* Sort basic-blocks according to function name and line number:  */
   sorted_bbs = (Sym **) xmalloc (symtab.len * sizeof (sorted_bbs[0]));
   len = 0;
-  
+
   for (sym = symtab.base; sym < symtab.limit; ++sym)
     {
       /* Accept symbol if it's in the INCL_EXEC table
-         or there is no INCL_EXEC table
-         and it does not appear in the EXCL_EXEC table.  */
+	 or there is no INCL_EXEC table
+	 and it does not appear in the EXCL_EXEC table.  */
       if (sym_lookup (&syms[INCL_EXEC], sym->addr)
 	  || (syms[INCL_EXEC].len == 0
 	      && !sym_lookup (&syms[EXCL_EXEC], sym->addr)))
@@ -285,7 +267,7 @@
 	  sorted_bbs[len++] = sym;
 	}
     }
-  
+
   qsort (sorted_bbs, len, sizeof (sorted_bbs[0]), cmp_bb);
 
   /* Output basic-blocks:  */
@@ -299,7 +281,7 @@
 		  sym->file ? sym->file->name : _("<unknown>"), sym->line_num,
 		  sym->name, (unsigned long) sym->addr, sym->ncalls);
 	}
-      
+
       for (j = 0; j < NBBS && sym->bb_addr[j]; j ++)
 	{
 	  if (sym->bb_calls[j] > 0 || ! ignore_zeros)
@@ -318,7 +300,7 @@
 /* Helper for bb_annotated_source: format annotation containing
    number of line executions.  Depends on being called on each
    line of a file in sequential order.
-  
+
    Global variable bb_annotate_all_lines enables execution count
    compression (counts are supressed if identical to the last one)
    and prints counts on all executed lines.  Otherwise, print
@@ -336,7 +318,7 @@
   unsigned long last_print = (unsigned long) -1;
 
   b = NULL;
-  
+
   if (line_num <= sf->num_lines)
     b = sf->line[line_num - 1];
 
@@ -363,11 +345,11 @@
       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
-         if the first basic-block address is larger than the starting
-         address of the line.  If so, then this line begins with a
-         a portion of the previous basic-block, so print that prior
-         execution count (if bb_annotate_all_lines is set).  */
+	 Otherwise, we're in the middle of a function, so check to see
+	 if the first basic-block address is larger than the starting
+	 address of the line.  If so, then this line begins with a
+	 a portion of the previous basic-block, so print that prior
+	 execution count (if bb_annotate_all_lines is set).  */
       if (b->is_func)
 	{
 	  sprintf (p, "%lu", b->ncalls);
@@ -388,8 +370,8 @@
 	}
 
       /* Loop through all of this line's basic-blocks.  For each one,
-         update last_count, then compress sequential identical counts
-         (if bb_annotate_all_lines) and print the execution count.  */
+	 update last_count, then compress sequential identical counts
+	 (if bb_annotate_all_lines) and print the execution count.  */
 
       for (i = 0; i < NBBS && b->bb_addr[i]; i++)
 	{
@@ -413,10 +395,10 @@
 	}
 
       /* We're done.  If nothing has been printed on this line,
-         print the last execution count (bb_annotate_all_lines),
-         which could be from either a previous line (if there were
-         no BBs on this line), or from this line (if all our BB
-         counts were compressed out because they were identical).  */
+	 print the last execution count (bb_annotate_all_lines),
+	 which could be from either a previous line (if there were
+	 no BBs on this line), or from this line (if all our BB
+	 counts were compressed out because they were identical).  */
 
       if (bb_annotate_all_lines && p == tmpbuf)
 	{
@@ -481,9 +463,9 @@
   for (sym = symtab.base; sym < symtab.limit; ++sym)
     {
       /* Accept symbol if it's file is known, its line number is
-         bigger than anything we have seen for that file so far and
-         if it's in the INCL_ANNO table or there is no INCL_ANNO
-         table and it does not appear in the EXCL_ANNO table.  */
+	 bigger than anything we have seen for that file so far and
+	 if it's in the INCL_ANNO table or there is no INCL_ANNO
+	 table and it does not appear in the EXCL_ANNO table.  */
       if (sym->file && sym->line_num > sym->file->num_lines
 	  && (sym_lookup (&syms[INCL_ANNO], sym->addr)
 	      || (syms[INCL_ANNO].len == 0
@@ -513,7 +495,7 @@
 	{
 	  sym->file->ncalls += sym->ncalls;
 	  line_stats = sym->file->line[sym->line_num - 1];
-	  
+
 	  if (!line_stats)
 	    {
 	      /* Common case has at most one basic-block per source line:  */
@@ -543,7 +525,7 @@
 	continue;
 
       num_executable_lines = num_lines_executed = 0;
-      
+
       ofp = annotate_source (sf, 16, annotate_with_count, sf);
       if (!ofp)
 	continue;
@@ -556,14 +538,14 @@
 	  /* Abuse line arrays---it's not needed anymore:  */
 	  qsort (sf->line, sf->num_lines, sizeof (sf->line[0]), cmp_ncalls);
 	  table_len = bb_table_length;
-	  
+
 	  if (table_len > sf->num_lines)
 	    table_len = sf->num_lines;
-	  
+
 	  for (i = 0; i < table_len; ++i)
 	    {
 	      sym = sf->line[i];
-	      
+
 	      if (!sym || sym->ncalls == 0)
 		  break;
 
@@ -588,7 +570,7 @@
 	       num_executable_lines
 	       ? (double) sf->ncalls / (double) num_executable_lines
 	       : 0.0);
-      
+
       if (ofp != stdout)
 	fclose (ofp);
     }
Index: bb_exit_func.c
===================================================================
RCS file: /cvs/src/src/gprof/bb_exit_func.c,v
retrieving revision 1.2
diff -u -r1.2 bb_exit_func.c
--- bb_exit_func.c	2000/07/26 19:59:35	1.2
+++ bb_exit_func.c	2001/03/13 02:17:10
@@ -1,7 +1,7 @@
 /*  bb_exit_func.c - dumps all the basic-block statistics linked into
     the bb_head chain to .d files.
 
-   Copyright (C) 2000  Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001  Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
@@ -30,64 +30,64 @@
 #include "gmon_out.h"
 
 /* structure emitted by -a */
-struct bb {
-    long		zero_word;
-    const char		*filename;
-    long		*counts;
-    long		ncounts;
-    struct bb		*next;
-    const unsigned long	*addresses;
+struct bb
+{
+  long zero_word;
+  const char *filename;
+  long *counts;
+  long ncounts;
+  struct bb *next;
+  const unsigned long *addresses;
 };
 
-struct bb *__bb_head = (struct bb *)0;
+struct bb *__bb_head = (struct bb *) 0;
 
 
 void
 __bb_exit_func (void)
 {
-    const int version = GMON_VERSION;
-    struct gmon_hdr ghdr;
-    struct bb *ptr;
-    FILE *fp;
-    /*
-     * GEN_GMON_CNT_FILE should be defined on systems with mcleanup()
-     * functions that do not write basic-block to gmon.out.  In such
-     * cases profiling with "-pg -a" would result in a gmon.out file
-     * without basic-block info (because the file written here would
-     * be overwritten.  Thus, a separate file is generated instead.
-     * The two files can easily be combined by specifying them
-     * on gprof's command line (and possibly generating a gmon.sum
-     * file with "gprof -s").
-     */
+  const int version = GMON_VERSION;
+  struct gmon_hdr ghdr;
+  struct bb *ptr;
+  FILE *fp;
+  /* GEN_GMON_CNT_FILE should be defined on systems with mcleanup()
+     functions that do not write basic-block to gmon.out.  In such
+     cases profiling with "-pg -a" would result in a gmon.out file
+     without basic-block info (because the file written here would be
+     overwritten.  Thus, a separate file is generated instead.  The
+     two files can easily be combined by specifying them on gprof's
+     command line (and possibly generating a gmon.sum file with "gprof
+     -s"). */
 #ifndef GEN_GMON_CNT_FILE
 #   define OUT_NAME	"gmon.out"
 #else
 #   define OUT_NAME	"gmon.cnt"
 #endif
-    fp = fopen(OUT_NAME, "wb");
-    if (!fp) {
-	perror(OUT_NAME);
-	return;
-    } /* if */
-    memcpy(&ghdr.cookie[0], GMON_MAGIC, 4);
-    memcpy(&ghdr.version, &version, sizeof(version));
-    fwrite(&ghdr, sizeof(ghdr), 1, fp);
-
-    for (ptr = __bb_head; ptr != 0; ptr = ptr->next) {
-	u_int ncounts = ptr->ncounts;
-	u_char tag;
-	u_int i;
-
-	tag = GMON_TAG_BB_COUNT;
-	fwrite(&tag, sizeof(tag), 1, fp);
-	fwrite(&ncounts, sizeof(ncounts), 1, fp);
-
-	for (i = 0; i < ncounts; ++i) {
-	    fwrite(&ptr->addresses[i], sizeof(ptr->addresses[0]), 1, fp);
-	    fwrite(&ptr->counts[i], sizeof(ptr->counts[0]), 1, fp);
-	} /* for */
-    } /* for */
-    fclose (fp);
-} /* __bb_exit_func */
-
-			/*** end of __bb_exit_func.c ***/
+  fp = fopen (OUT_NAME, "wb");
+  if (!fp)
+    {
+      perror (OUT_NAME);
+      return;
+    }
+  memcpy (&ghdr.cookie[0], GMON_MAGIC, 4);
+  memcpy (&ghdr.version, &version, sizeof (version));
+  fwrite (&ghdr, sizeof (ghdr), 1, fp);
+
+  for (ptr = __bb_head; ptr != 0; ptr = ptr->next)
+    {
+      u_int ncounts = ptr->ncounts;
+      u_char tag;
+      u_int i;
+
+      tag = GMON_TAG_BB_COUNT;
+      fwrite (&tag, sizeof (tag), 1, fp);
+      fwrite (&ncounts, sizeof (ncounts), 1, fp);
+
+      for (i = 0; i < ncounts; ++i)
+	{
+	  fwrite (&ptr->addresses[i], sizeof (ptr->addresses[0]), 1, fp);
+	  fwrite (&ptr->counts[i], sizeof (ptr->counts[0]), 1, fp);
+	}
+    }
+  fclose (fp);
+}
Index: call_graph.c
===================================================================
RCS file: /cvs/src/src/gprof/call_graph.c,v
retrieving revision 1.3
diff -u -r1.3 call_graph.c
--- call_graph.c	2000/07/24 20:59:03	1.3
+++ call_graph.c	2001/03/13 02:17:10
@@ -1,6 +1,6 @@
 /* call_graph.c  -  Create call graphs.
 
-   Copyright (C) 2000  Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001  Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
@@ -46,7 +46,7 @@
      line number in the calling routing, but the child should always
      point to a function entry point, so we back up in the symbol
      table until we find it.
-   
+
      For normal profiling, is_func will be set on all symbols, so this
      code will do nothing.  */
   while (child >= symtab.base && ! child->is_func)
@@ -78,22 +78,21 @@
 DEFUN (cg_read_rec, (ifp, filename), FILE * ifp AND CONST char *filename)
 {
   bfd_vma from_pc, self_pc;
-  struct gmon_cg_arc_record arc;
-  unsigned long count;
+  u_int32_t count;
 
-  if (fread (&arc, sizeof (arc), 1, ifp) != 1)
+  if (gmon_io_read_vma (ifp, &from_pc)
+      || gmon_io_read_vma (ifp, &self_pc)
+      || gmon_io_read_32 (ifp, &count))
     {
       fprintf (stderr, _("%s: %s: unexpected end of file\n"),
 	       whoami, filename);
       done (1);
     }
-  
-  from_pc = get_vma (core_bfd, (bfd_byte *) arc.from_pc);
-  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 %lu\n",
-	       (unsigned long) from_pc, (unsigned long) self_pc, count));
+	       (unsigned long) from_pc, (unsigned long) self_pc,
+	       (unsigned long) count));
   /* Add this arc:  */
   cg_tally (from_pc, self_pc, count);
 }
@@ -105,8 +104,6 @@
 void
 DEFUN (cg_write_arcs, (ofp, filename), FILE * ofp AND const char *filename)
 {
-  const unsigned char tag = GMON_TAG_CG_ARC;
-  struct gmon_cg_arc_record raw_arc;
   Arc *arc;
   Sym *sym;
 
@@ -114,11 +111,10 @@
     {
       for (arc = sym->cg.children; arc; arc = arc->next_child)
 	{
-	  put_vma (core_bfd, arc->parent->addr, (bfd_byte *) raw_arc.from_pc);
-	  put_vma (core_bfd, arc->child->addr, (bfd_byte *) raw_arc.self_pc);
-	  bfd_put_32 (core_bfd, arc->count, (bfd_byte *) raw_arc.count);
-	  if (fwrite (&tag, sizeof (tag), 1, ofp) != 1
-	      || fwrite (&raw_arc, sizeof (raw_arc), 1, ofp) != 1)
+	  if (gmon_io_write_8 (ofp, GMON_TAG_CG_ARC)
+	      || gmon_io_write_vma (ofp, arc->parent->addr)
+	      || gmon_io_write_vma (ofp, arc->child->addr)
+	      || gmon_io_write_32 (ofp, arc->count))
 	    {
 	      perror (filename);
 	      done (1);
Index: call_graph.h
===================================================================
RCS file: /cvs/src/src/gprof/call_graph.h,v
retrieving revision 1.2
diff -u -r1.2 call_graph.h
--- call_graph.h	2000/07/24 20:59:03	1.2
+++ call_graph.h	2001/03/13 02:17:10
@@ -1,5 +1,5 @@
 /* call_graph.h
-   
+
    Copyright (C) 2000  Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
Index: cg_arcs.c
===================================================================
RCS file: /cvs/src/src/gprof/cg_arcs.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 cg_arcs.c
--- cg_arcs.c	1999/05/03 07:29:11	1.1.1.1
+++ cg_arcs.c	2001/03/13 02:17:10
@@ -102,7 +102,7 @@
 	  if (maxarcs == 0)
 	    maxarcs = 1;
 	  maxarcs *= 2;
-	
+
 	  /* Allocate the new array.  */
 	  newarcs = (Arc **)xmalloc(sizeof (Arc *) * maxarcs);
 
Index: cg_print.c
===================================================================
RCS file: /cvs/src/src/gprof/cg_print.c,v
retrieving revision 1.2
diff -u -r1.2 cg_print.c
--- cg_print.c	2000/07/24 20:59:03	1.2
+++ cg_print.c	2001/03/13 02:17:10
@@ -47,7 +47,7 @@
     first_output = FALSE;
   else
     printf ("\f\n");
-  
+
   if (!bsd_style_output)
     {
       if (print_descriptions)
@@ -55,21 +55,21 @@
       else
 	printf (_("\t\t\tCall graph\n\n"));
     }
-  
+
   printf (_("\ngranularity: each sample hit covers %ld byte(s)"),
 	  (long) hist_scale * sizeof (UNIT));
-  
+
   if (print_time > 0.0)
     printf (_(" for %.2f%% of %.2f seconds\n\n"),
 	    100.0 / print_time, print_time / hz);
   else
     {
       printf (_(" no time propagated\n\n"));
-      
+
       /* This doesn't hurt, since all the numerators will be 0.0.  */
       print_time = 1.0;
     }
-  
+
   if (bsd_style_output)
     {
       printf ("%6.6s %5.5s %7.7s %11.11s %7.7s/%-7.7s     %-8.8s\n",
@@ -100,7 +100,7 @@
 	  : "%-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 ("+%-7lu", cyc->cg.self_calls);
   else
@@ -141,22 +141,22 @@
 DEFUN (sort_members, (cyc), Sym * cyc)
 {
   Sym *todo, *doing, *prev;
-  
+
   /* Detach cycle members from cyclehead,
      and insertion sort them back on.  */
   todo = cyc->cg.cyc.next;
   cyc->cg.cyc.next = 0;
-  
+
   for (doing = todo; doing && doing->cg.cyc.next; doing = todo)
     {
       todo = doing->cg.cyc.next;
-      
+
       for (prev = cyc; prev->cg.cyc.next; prev = prev->cg.cyc.next)
 	{
 	  if (cmp_member (doing, prev->cg.cyc.next) == GREATERTHAN)
 	    break;
 	}
-      
+
       doing->cg.cyc.next = prev->cg.cyc.next;
       prev->cg.cyc.next = doing;
     }
@@ -170,7 +170,7 @@
   Sym *member;
 
   sort_members (cyc);
-  
+
   for (member = cyc->cg.cyc.next; member; member = member->cg.cyc.next)
     {
       printf (bsd_style_output
@@ -178,7 +178,7 @@
 	      : "%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 ("+%-7lu", member->cg.self_calls);
       else
@@ -191,12 +191,12 @@
 }
 
 /* Compare two arcs to/from the same child/parent.
-        - if one arc is a self arc, it's least.
-        - if one arc is within a cycle, it's less than.
-        - if both arcs are within a cycle, compare arc counts.
-        - if neither arc is within a cycle, compare with
-                time + child_time as major key
-                arc count as minor key.  */
+	- if one arc is a self arc, it's least.
+	- if one arc is within a cycle, it's less than.
+	- if both arcs are within a cycle, compare arc counts.
+	- if neither arc is within a cycle, compare with
+		time + child_time as major key
+		arc count as minor key.  */
 
 static int
 DEFUN (cmp_arc, (left, right), Arc * left AND Arc * right)
@@ -222,7 +222,7 @@
 	       right->count, right_child->ncalls);
        printf ("\n");
     );
-  
+
   if (left_parent == left_child)
     return LESSTHAN;		/* Left is a self call.  */
 
@@ -265,7 +265,7 @@
 	  /* Neither is a call within a cycle.  */
 	  left_time = left->time + left->child_time;
 	  right_time = right->time + right->child_time;
-	  
+
 	  if (left_time < right_time)
 	    return LESSTHAN;
 
@@ -291,12 +291,12 @@
 
   /* Unlink parents from child, then insertion sort back on to
      sorted's parents.
-          *arc        the arc you have detached and are inserting.
-          *detached   the rest of the arcs to be sorted.
-          sorted      arc list onto which you insertion sort.
-          *prev       arc before the arc you are comparing.  */
+	  *arc        the arc you have detached and are inserting.
+	  *detached   the rest of the arcs to be sorted.
+	  sorted      arc list onto which you insertion sort.
+	  *prev       arc before the arc you are comparing.  */
   sorted.next_parent = 0;
-  
+
   for (arc = child->cg.parents; arc; arc = detached)
     {
       detached = arc->next_parent;
@@ -307,7 +307,7 @@
 	  if (cmp_arc (arc, prev->next_parent) != GREATERTHAN)
 	    break;
 	}
-      
+
       arc->next_parent = prev->next_parent;
       prev->next_parent = arc;
     }
@@ -328,7 +328,7 @@
     cycle_head = child->cg.cyc.head;
   else
     cycle_head = child;
-  
+
   if (!child->cg.parents)
     {
       printf (bsd_style_output
@@ -337,9 +337,9 @@
 	      "", "", "", "", "", "");
       return;
     }
-  
+
   sort_parents (child);
-  
+
   for (arc = child->cg.parents; arc; arc = arc->next_parent)
     {
       parent = arc->parent;
@@ -375,15 +375,15 @@
 DEFUN (sort_children, (parent), Sym * parent)
 {
   Arc *arc, *detached, sorted, *prev;
-  
+
   /* Unlink children from parent, then insertion sort back on to
      sorted's children.
-          *arc        the arc you have detached and are inserting.
-          *detached   the rest of the arcs to be sorted.
-          sorted      arc list onto which you insertion sort.
-          *prev       arc before the arc you are comparing.  */
+	  *arc        the arc you have detached and are inserting.
+	  *detached   the rest of the arcs to be sorted.
+	  sorted      arc list onto which you insertion sort.
+	  *prev       arc before the arc you are comparing.  */
   sorted.next_child = 0;
-  
+
   for (arc = parent->cg.children; arc; arc = detached)
     {
       detached = arc->next_child;
@@ -394,7 +394,7 @@
 	  if (cmp_arc (arc, prev->next_child) != LESSTHAN)
 	    break;
 	}
-      
+
       arc->next_child = prev->next_child;
       prev->next_child = arc;
     }
@@ -412,7 +412,7 @@
 
   sort_children (parent);
   arc = parent->cg.children;
-  
+
   for (arc = parent->cg.children; arc; arc = arc->next_child)
     {
       child = arc->child;
@@ -454,11 +454,11 @@
 	  : "%-6.6s %5.1f %7.2f %7.2f", buf,
 	  100 * (np->cg.prop.self + np->cg.prop.child) / print_time,
 	  np->cg.prop.self / hz, np->cg.prop.child / hz);
-  
+
   if ((np->ncalls + np->cg.self_calls) != 0)
     {
       printf (" %7lu", np->ncalls);
-      
+
       if (np->cg.self_calls != 0)
 	  printf ("+%-7lu ", np->cg.self_calls);
       else
@@ -468,7 +468,7 @@
     {
       printf (" %7.7s %7.7s ", "", "");
     }
-  
+
   print_name (np);
   printf ("\n");
 }
@@ -490,14 +490,14 @@
   for (index = 0; index < symtab.len + num_cycles; ++index)
     {
       parent = timesortsym[index];
-      
+
       if ((ignore_zeros && parent->ncalls == 0
 	   && parent->cg.self_calls == 0 && parent->cg.prop.self == 0
 	   && parent->cg.prop.child == 0)
 	  || !parent->cg.print_flag
 	  || (line_granularity && ! parent->is_func))
 	continue;
-      
+
       if (!parent->name && parent->cg.cyc.num != 0)
 	{
 	  /* Cycle header.  */
@@ -510,18 +510,18 @@
 	  print_line (parent);
 	  print_children (parent);
 	}
-      
+
       if (bsd_style_output)
 	printf ("\n");
-      
+
       printf ("-----------------------------------------------\n");
-      
+
       if (bsd_style_output)
 	printf ("\n");
     }
-  
+
   free (timesortsym);
-  
+
   if (print_descriptions && !bsd_style_output)
     fsf_callg_blurb (stdout);
 }
@@ -547,11 +547,11 @@
   const char *filename;
   char buf[20];
   int column_width = (output_width - 1) / 3;	/* Don't write in last col!  */
-  
+
   /* Now, sort regular function name
      alphabetically to create an index.  */
   name_sorted_syms = (Sym **) xmalloc ((symtab.len + num_cycles) * sizeof (Sym *));
-  
+
   for (index = 0, nnames = 0; index < symtab.len; index++)
     {
       if (ignore_zeros && symtab.base[index].ncalls == 0
@@ -560,25 +560,25 @@
 
       name_sorted_syms[nnames++] = &symtab.base[index];
     }
-  
+
   qsort (name_sorted_syms, nnames, sizeof (Sym *), cmp_name);
-  
+
   for (index = 1, todo = nnames; index <= num_cycles; index++)
     name_sorted_syms[todo++] = &cycle_header[index];
 
   printf ("\f\n");
   printf (_("Index by function name\n\n"));
   index = (todo + 2) / 3;
-  
+
   for (i = 0; i < index; i++)
     {
       col = 0;
       starting_col = 0;
-      
+
       for (j = i; j < todo; j += index)
 	{
 	  sym = name_sorted_syms[j];
-	  
+
 	  if (sym->cg.print_flag)
 	    sprintf (buf, "[%d]", sym->cg.index);
 	  else
@@ -593,27 +593,27 @@
 	      else
 		{
 		  col += strlen (buf);
-		  
+
 		  for (; col < starting_col + 5; ++col)
 		    putchar (' ');
 
 		  printf (" %s ", buf);
 		  col += print_name_only (sym);
-		  
+
 		  if (!line_granularity && sym->is_static && sym->file)
 		    {
 		      filename = sym->file->name;
-		      
+
 		      if (!print_path)
 			{
 			  filename = strrchr (filename, '/');
-			  
+
 			  if (filename)
 			    ++filename;
 			  else
 			    filename = sym->file->name;
 			}
-		      
+
 		      printf (" (%s)", filename);
 		      col += strlen (filename) + 3;
 		    }
@@ -638,13 +638,13 @@
 		  col += strlen (buf);
 		}
 	    }
-	  
+
 	  starting_col += column_width;
 	}
-      
+
       printf ("\n");
     }
-  
+
   free (name_sorted_syms);
 }
 
@@ -714,7 +714,7 @@
    Of course, profiling errors, machine limitations (PA long calls), and
    poor cutoff values for the placement algorithm may limit the usefullness
    of the resulting function order.  Improvements would be greatly appreciated.
-   
+
    Suggestions:
 
 	* Place the functions with many callers near the middle of the
@@ -749,7 +749,7 @@
 	ordering which shares the same arc placement algorithm with
 	the function ordering code (in fact it is a degenerate case
 	of function ordering).  */
-	
+
 void
 DEFUN_VOID (cg_print_function_ordering)
 {
@@ -856,13 +856,13 @@
 	 Unfortunately, we don't know all these functions
 	 until we're done.  So we keep track of all the arcs
 	 to the functions we care about, then prune out those
-	 which are uninteresting. 
+	 which are uninteresting.
 
 	 An interesting variation would be to quit when we found
 	 multi-call site functions which account for some percentage
 	 of the arcs.  */
       arc = sym->cg.children;
-      
+
       while (arc)
 	{
 	  if (arc->parent != arc->child)
@@ -872,7 +872,7 @@
 	}
 
       arc = sym->cg.parents;
-      
+
       while (arc)
 	{
 	  if (arc->parent != arc->child)
@@ -992,7 +992,7 @@
     total_arcs = 0;
 
   tmp_arcs = 0;
-  
+
   for (index = 0; index < numarcs; index++)
     {
       Sym *sym1, *sym2;
@@ -1049,7 +1049,7 @@
 	      prev = prev->prev;
 	      prev_count++;
 	    }
-	  
+
 	  /* Choose the closest.  */
 	  child = next_count < prev_count ? next : prev;
 	}
@@ -1263,5 +1263,5 @@
       if (index2 == symtab.len)
 	printf ("%s\n", symbol_map[index].file_name);
       last = symbol_map[index].file_name;
-    } 
+    }
 }
Index: cg_print.h
===================================================================
RCS file: /cvs/src/src/gprof/cg_print.h,v
retrieving revision 1.2
diff -u -r1.2 cg_print.h
--- cg_print.h	2000/07/24 20:59:03	1.2
+++ cg_print.h	2001/03/13 02:17:10
@@ -1,5 +1,5 @@
 /* cg_print.h
-   
+
    Copyright (C) 2000  Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
Index: configure.in
===================================================================
RCS file: /cvs/src/src/gprof/configure.in,v
retrieving revision 1.8
diff -u -r1.8 configure.in
--- configure.in	2001/02/27 06:43:55	1.8
+++ configure.in	2001/03/13 02:17:11
@@ -29,6 +29,33 @@
 AM_MAINTAINER_MODE
 AC_EXEEXT
 
+AC_CHECK_HEADERS(sys/gmon_out.h)
+
+AC_MSG_CHECKING(the size of gmon pointers)
+AC_TRY_RUN([#include <stdio.h>
+#include <stdlib.h>
+#if HAVE_SYS_GMON_OUT_H
+#include <sys/gmon_out.h>
+#endif
+main()
+{
+#if HAVE_SYS_GMON_OUT_H
+  struct gmon_cg_arc_record arc;
+  FILE *f=fopen("conftestval", "w");
+  if (!f) exit(1);
+  fprintf(f, "%d\n", sizeof(arc.from_pc));
+  exit(0);
+#else
+  FILE *f=fopen("conftestval", "w");
+  if (!f) exit(1);
+  fprintf(f, "%d\n", (int) sizeof(char *));
+  exit(1);
+#endif
+}], gmon_ptr_size=`cat conftestval`, gmon_ptr_size=4, gmon_ptr_size=4)
+AC_MSG_RESULT($gmon_ptr_size)
+
+AC_DEFINE_UNQUOTED(GMON_PTR_SIZE, $gmon_ptr_size)
+
 build_warnings="-W -Wall"
 AC_ARG_ENABLE(build-warnings,
 [  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
Index: corefile.c
===================================================================
RCS file: /cvs/src/src/gprof/corefile.c,v
retrieving revision 1.5
diff -u -r1.5 corefile.c
--- corefile.c	2000/07/24 20:59:03	1.5
+++ corefile.c	2001/03/13 02:17:11
@@ -178,7 +178,7 @@
 
   core_syms = (asymbol **) xmalloc (core_num_syms);
   core_num_syms = bfd_canonicalize_symtab (core_bfd, core_syms);
-  
+
   if (core_num_syms < 0)
     {
       fprintf (stderr, "%s: %s: %s\n", whoami, a_out_name,
@@ -221,7 +221,7 @@
 	       whoami, (unsigned long) core_text_sect->_raw_size);
       done (1);
     }
-  
+
   if (!bfd_get_section_contents (core_bfd, core_text_sect, core_text_space,
 				 0, core_text_sect->_raw_size))
     {
@@ -229,7 +229,7 @@
       free (core_text_space);
       core_text_space = 0;
     }
-  
+
   if (!core_text_space)
     fprintf (stderr, _("%s: can't do -c\n"), whoami);
 }
@@ -271,9 +271,9 @@
 }
 
 /* Return class of symbol SYM.  The returned class can be any of:
-        0   -> symbol is not interesting to us
-        'T' -> symbol is a global name
-        't' -> symbol is a local (static) name.  */
+	0   -> symbol is not interesting to us
+	'T' -> symbol is a global name
+	't' -> symbol is a local (static) name.  */
 
 static int
 DEFUN (core_sym_class, (sym), asymbol * sym)
@@ -328,7 +328,7 @@
       if (*name == '.' || *name == '$')
 	return 0;
     }
-  
+
   /* On systems where the C compiler adds an underscore to all
      names, static names without underscores seem usually to be
      labels in hand written assembler in the library.  We don't want
@@ -337,10 +337,10 @@
      division). I don't know whether it has harmful side effects on
      other systems.  Perhaps it should be made configurable.  */
   sym_prefix = bfd_get_symbol_leading_char (core_bfd);
-  
+
   if ((sym_prefix && sym_prefix != sym->name[0])
       /* GCC may add special symbols to help gdb figure out the file
-        language.  We want to ignore these, since sometimes they mask
+	language.  We want to ignore these, since sometimes they mask
 	the real function.  (dj@ctron)  */
       || !strncmp (sym->name, "__gnu_compiled", 14)
       || !strncmp (sym->name, "___gnu_compiled", 15))
@@ -401,14 +401,14 @@
 
   /* Pass 1 - determine upper bound on number of function names.  */
   symtab.len = 0;
-  
+
   for (i = 0; i < core_num_syms; ++i)
     {
       if (!core_sym_class (core_syms[i]))
 	continue;
 
       /* This should be replaced with a binary search or hashed
-	 search.  Gross. 
+	 search.  Gross.
 
 	 Don't create a symtab entry for a function that has
 	 a mapping to a file, unless it's the first function
@@ -418,13 +418,13 @@
 	if (!strcmp (core_syms[i]->name, symbol_map[j].function_name))
 	  {
 	    if (j > 0 && ! strcmp (symbol_map [j].file_name,
-			 	   symbol_map [j - 1].file_name))
+				   symbol_map [j - 1].file_name))
 	      skip = 1;
 	    break;
 	  }
-      
+
       if (!skip)
-        ++symtab.len;
+	++symtab.len;
     }
 
   if (symtab.len == 0)
@@ -438,11 +438,11 @@
 
   /* Pass 2 - create symbols.  */
   symtab.limit = symtab.base;
-  
+
   for (i = 0; i < core_num_syms; ++i)
     {
       class = core_sym_class (core_syms[i]);
-      
+
       if (!class)
 	{
 	  DBG (AOUTDEBUG,
@@ -451,17 +451,17 @@
 		       core_syms[i]->name));
 	  continue;
 	}
-      
+
       /* This should be replaced with a binary search or hashed
 	 search.  Gross.   */
       skip = 0;
       found = 0;
-      
+
       for (j = 0; j < symbol_map_count; j++)
 	if (!strcmp (core_syms[i]->name, symbol_map[j].function_name))
 	  {
 	    if (j > 0 && ! strcmp (symbol_map [j].file_name,
-			 	   symbol_map [j - 1].file_name))
+				   symbol_map [j - 1].file_name))
 	      skip = 1;
 	    else
 	      found = j;
@@ -475,7 +475,7 @@
 
       /* Symbol offsets are always section-relative.  */
       symtab.limit->addr = core_syms[i]->value + core_syms[i]->section->vma;
-      
+
       if (symbol_map_count
 	  && !strcmp (core_syms[i]->name, symbol_map[found].function_name))
 	{
@@ -491,18 +491,18 @@
       /* Lookup filename and line number, if we can.  */
       {
 	const char *filename, *func_name;
-	
+
 	if (get_src_info (symtab.limit->addr, &filename, &func_name,
 			  &symtab.limit->line_num))
 	  {
 	    symtab.limit->file = source_file_lookup_path (filename);
 
 	    /* FIXME: Checking __osf__ here does not work with a cross
-               gprof.  */
+	       gprof.  */
 #ifdef __osf__
 	    /* Suppress symbols that are not function names.  This is
 	       useful to suppress code-labels and aliases.
-	      
+
 	       This is known to be useful under DEC's OSF/1.  Under SunOS 4.x,
 	       labels do not appear in the symbol table info, so this isn't
 	       necessary.  */
@@ -523,7 +523,7 @@
 
       symtab.limit->is_func = TRUE;
       symtab.limit->is_bb_head = TRUE;
-      
+
       if (class == 't')
 	symtab.limit->is_static = TRUE;
 
@@ -531,7 +531,7 @@
       max_vma = MAX (symtab.limit->addr, max_vma);
 
       /* If we see "main" without an initial '_', we assume names
-         are *not* prefixed by '_'.  */
+	 are *not* prefixed by '_'.  */
       if (symtab.limit->name[0] == 'm' && discard_underscores
 	  && strcmp (symtab.limit->name, "main") == 0)
 	discard_underscores = 0;
@@ -574,7 +574,7 @@
   const char *filename;
   int prev_line_num;
   Sym_Table ltab;
-  
+
   /* 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.  */
@@ -586,7 +586,7 @@
      text-space addresses (one by one!) and get the debugging
      info for each address.  When the debugging info changes,
      it is time to create a new symbol.
-    
+
      Of course, this is rather slow and it would be better if
      bfd would provide an iterator for enumerating all line infos.  */
   prev_name_len = PATH_MAX;
@@ -595,13 +595,13 @@
   prev_filename = xmalloc (prev_filename_len);
   ltab.len = 0;
   prev_line_num = 0;
-  
+
   for (offset = 0; offset < core_text_sect->_raw_size; offset += min_insn_size)
     {
       int len;
 
       vma = core_text_sect->vma + offset;
-      
+
       if (!get_src_info (vma, &filename, &dummy.name, &dummy.line_num)
 	  || (prev_line_num == dummy.line_num
 	      && prev_name != NULL
@@ -619,17 +619,17 @@
 	  free (prev_name);
 	  prev_name = xmalloc (prev_name_len);
 	}
-      
+
       strcpy (prev_name, dummy.name);
       len = strlen (filename);
-      
+
       if (len >= prev_filename_len)
 	{
 	  prev_filename_len = len + 1024;
 	  free (prev_filename);
 	  prev_filename = xmalloc (prev_filename_len);
 	}
-      
+
       strcpy (prev_filename, filename);
 
       min_vma = MIN (vma, min_vma);
@@ -663,11 +663,11 @@
      distinction as well, but the current fix works and the code is a
      lot cleaner now.  */
   prev = 0;
-  
+
   for (offset = 0; offset < core_text_sect->_raw_size; offset += min_insn_size)
     {
       sym_init (ltab.limit);
-      
+
       if (!get_src_info (core_text_sect->vma + offset, &filename,
 			 &ltab.limit->name, &ltab.limit->line_num)
 	  || (prev && prev->line_num == ltab.limit->line_num
@@ -682,8 +682,8 @@
       ltab.limit->addr = core_text_sect->vma + offset;
 
       /* Set is_static based on the enclosing function, using either:
-         1) the previous symbol, if it's from the same function, or
-         2) a symtab lookup.  */
+	 1) the previous symbol, if it's from the same function, or
+	 2) a symtab lookup.  */
       if (prev && ltab.limit->file == prev->file &&
 	  strcmp (ltab.limit->name, prev->name) == 0)
 	{
@@ -698,7 +698,7 @@
       prev = ltab.limit;
 
       /* If we see "main" without an initial '_', we assume names
-         are *not* prefixed by '_'.  */
+	 are *not* prefixed by '_'.  */
       if (ltab.limit->name[0] == 'm' && discard_underscores
 	  && strcmp (ltab.limit->name, "main") == 0)
 	discard_underscores = 0;
@@ -712,13 +712,13 @@
 
   /* Update sentinels.  */
   sentinel = sym_lookup (&symtab, 0);
-  
+
   if (strcmp (sentinel->name, "<locore>") == 0
       && min_vma <= sentinel->end_addr)
     sentinel->end_addr = min_vma - 1;
 
   sentinel = sym_lookup (&symtab, ~0);
-  
+
   if (strcmp (sentinel->name, "<hicore>") == 0 && max_vma >= sentinel->addr)
     sentinel->addr = max_vma + 1;
 
Index: corefile.h
===================================================================
RCS file: /cvs/src/src/gprof/corefile.h,v
retrieving revision 1.2
diff -u -r1.2 corefile.h
--- corefile.h	2000/07/24 20:59:03	1.2
+++ corefile.h	2001/03/13 02:17:11
@@ -1,5 +1,5 @@
 /* corefile.h
-   
+
    Copyright (C) 2000  Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
Index: gconfig.in
===================================================================
RCS file: /cvs/src/src/gprof/gconfig.in,v
retrieving revision 1.4
diff -u -r1.4 gconfig.in
--- gconfig.in	2001/02/27 06:43:55	1.4
+++ gconfig.in	2001/03/13 02:17:11
@@ -130,3 +130,5 @@
 /* Define as 1 if you have gettext and don't want to use GNU gettext. */
 #undef HAVE_GETTEXT
 
+/* Define as the size of a pointer in the target profile file format.  */
+#undef GMON_PTR_SIZE
Index: gmon.h
===================================================================
RCS file: /cvs/src/src/gprof/gmon.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 gmon.h
--- gmon.h	1999/05/03 07:29:11	1.1.1.1
+++ gmon.h	2001/03/13 02:17:11
@@ -39,13 +39,8 @@
   {
     /* FIXME: Checking a host compiler define means that we can't use
        a cross gprof to the alpha.  */
-#ifdef __alpha__
-    char low_pc[8];		/* base pc address of sample buffer */
-    char high_pc[8];		/* max pc address of sampled buffer */
-#else
-    char low_pc[4];		/* base pc address of sample buffer */
-    char high_pc[4];		/* max pc address of sampled buffer */
-#endif
+    char low_pc[GMON_PTR_SIZE];	/* base pc address of sample buffer */
+    char high_pc[GMON_PTR_SIZE];/* max pc address of sampled buffer */
     char ncnt[4];		/* size of sample buffer (plus this header) */
 
     char version[4];		/* version number */
@@ -57,15 +52,8 @@
 
 struct old_raw_phdr
   {
-    /* FIXME: Checking a host compiler define means that we can't use
-       a cross gprof to the alpha.  */
-#ifdef __alpha__
-    char low_pc[8];		/* base pc address of sample buffer */
-    char high_pc[8];		/* max pc address of sampled buffer */
-#else
-    char low_pc[4];		/* base pc address of sample buffer */
-    char high_pc[4];		/* max pc address of sampled buffer */
-#endif
+    char low_pc[GMON_PTR_SIZE];	/* base pc address of sample buffer */
+    char high_pc[GMON_PTR_SIZE];/* max pc address of sampled buffer */
     char ncnt[4];		/* size of sample buffer (plus this header) */
 
     /* FIXME: Checking host compiler defines here means that we can't
@@ -103,7 +91,7 @@
  *      calls   $0,(r0)
  *      calls   $0,(r0)
  *
- * which is separated by only three bytes, thus HASHFRACTION is 
+ * which is separated by only three bytes, thus HASHFRACTION is
  * calculated as:
  *
  *      HASHFRACTION = 3 / (2 * 2 - 1) = 1
@@ -134,17 +122,9 @@
  */
 struct raw_arc
   {
-    /* FIXME: Checking a host compiler define means that we can't use
-       a cross gprof to the alpha.  */
-#ifdef __alpha__
-    char from_pc[8];
-    char self_pc[8];
-    char count[8];
-#else
-    char from_pc[4];
-    char self_pc[4];
+    char from_pc[GMON_PTR_SIZE];
+    char self_pc[GMON_PTR_SIZE];
     char count[4];
-#endif
   };
 
 /*
Index: gmon_io.c
===================================================================
RCS file: /cvs/src/src/gprof/gmon_io.c,v
retrieving revision 1.5
diff -u -r1.5 gmon_io.c
--- gmon_io.c	2000/07/24 20:59:03	1.5
+++ gmon_io.c	2001/03/13 02:17:11
@@ -1,6 +1,6 @@
 /* gmon_io.c - Input and output from/to gmon.out files.
 
-   Copyright (C) 2000  Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001  Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
@@ -19,6 +19,8 @@
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    02111-1307, USA.  */
 
+#include <inttypes.h>
+
 #include "cg_arcs.h"
 #include "basic_blocks.h"
 #include "bfd.h"
@@ -34,10 +36,136 @@
 
 int gmon_input = 0;
 int gmon_file_version = 0;	/* 0 == old (non-versioned) file format.  */
+
+int
+DEFUN (gmon_io_read_vma, (ifp, valp), FILE * ifp AND bfd_vma *valp)
+{
+  char buf[8];
+  bfd_vma val;
+
+  switch (GMON_PTR_SIZE)
+    {
+    case 4:
+      if (fread (buf, 1, 4, ifp) != 4)
+	return 1;
+      val = bfd_get_32 (core_bfd, buf);
+      break;
+
+    case 8:
+      if (fread (buf, 1, 8, ifp) != 8)
+	return 1;
+      val = bfd_get_64 (core_bfd, buf);
+      break;
+
+    default:
+      fprintf (stderr, _("%s: GMON_PTR_SIZE has unexpected value of %u\n"),
+	       whoami, GMON_PTR_SIZE);
+      done (1);
+    }
+  *valp = val;
+  return 0;
+}
+
+int
+DEFUN (gmon_io_read_32, (ifp, valp), FILE * ifp AND u_int32_t *valp)
+{
+  char buf[4];
+
+  if (fread (buf, 1, 4, ifp) != 4)
+    return 1;
+  *valp = bfd_get_32 (core_bfd, buf);
+  return 0;
+}
+
+int
+DEFUN (gmon_io_read_16, (ifp, valp), FILE * ifp AND u_int16_t *valp)
+{
+  char buf[2];
+
+  if (fread (buf, 1, 2, ifp) != 2)
+    return 1;
+  *valp = bfd_get_16 (core_bfd, buf);
+  return 0;
+}
+
+int
+DEFUN (gmon_io_read, (ifp, valp), FILE * ifp AND char *buf AND size_t n)
+{
+  if (fread (buf, 1, n, ifp) != n)
+    return 1;
+  return 0;
+}
+
+int
+DEFUN (gmon_io_write_vma, (ofp, valp), FILE * ofp AND bfd_vma val)
+{
+  char buf[8];
+
+  switch (GMON_PTR_SIZE)
+    {
+    case 4:
+      bfd_put_32 (core_bfd, val, buf);
+      if (fwrite (buf, 1, 4, ofp) != 4)
+	return 1;
+      break;
+
+    case 8:
+      bfd_put_64 (core_bfd, val, buf);
+      if (fwrite (buf, 1, 8, ofp) != 8)
+	return 1;
+      break;
+
+    default:
+      fprintf (stderr, _("%s: GMON_PTR_SIZE has unexpected value of %u\n"),
+	       whoami, GMON_PTR_SIZE);
+      done (1);
+    }
+  return 0;
+}
+
+int
+DEFUN (gmon_io_write_32, (ofp, valp), FILE * ofp AND u_int32_t val)
+{
+  char buf[4];
+
+  bfd_put_32 (core_bfd, val, buf);
+  if (fwrite (buf, 1, 4, ofp) != 4)
+    return 1;
+  return 0;
+}
+
+int
+DEFUN (gmon_io_write_16, (ofp, valp), FILE * ofp AND u_int16_t val)
+{
+  char buf[2];
+
+  bfd_put_16 (core_bfd, val, buf);
+  if (fwrite (buf, 1, 2, ofp) != 2)
+    return 1;
+  return 0;
+}
+
+int
+DEFUN (gmon_io_write_8, (ofp, valp), FILE * ofp AND u_int8_t val)
+{
+  char buf[1];
+
+  bfd_put_8 (core_bfd, val, buf);
+  if (fwrite (buf, 1, 1, ofp) != 1)
+    return 1;
+  return 0;
+}
 
-/* This probably ought to be in libbfd.  */
+int
+DEFUN (gmon_io_write, (ofp, valp), FILE * ofp AND char *buf AND size_t n)
+{
+  if (fwrite (buf, 1, n, ofp) != n)
+    return 1;
+  return 0;
+}
 
-bfd_vma
+/* get_vma and put_vma are for backwards compatibility only */
+static bfd_vma
 DEFUN (get_vma, (abfd, addr), bfd * abfd AND bfd_byte * addr)
 {
   switch (sizeof (char*))
@@ -53,10 +181,7 @@
     }
 }
 
-
-/* This probably ought to be in libbfd.  */
-
-void
+static void
 DEFUN (put_vma, (abfd, val, addr), bfd * abfd AND bfd_vma val AND bfd_byte * addr)
 {
   switch (sizeof (char*))
@@ -74,7 +199,6 @@
     }
 }
 
-
 void
 DEFUN (gmon_out_read, (filename), const char *filename)
 {
@@ -94,14 +218,14 @@
   else
     {
       ifp = fopen (filename, FOPEN_RB);
-      
+
       if (!ifp)
 	{
 	  perror (filename);
 	  done (1);
 	}
     }
-  
+
   if (fread (&ghdr, sizeof (struct gmon_hdr), 1, ifp) != 1)
     {
       fprintf (stderr, _("%s: file too short to be a gmon file\n"),
@@ -109,8 +233,8 @@
       done (1);
     }
 
-  if ((file_format == FF_MAGIC) ||
-      (file_format == FF_AUTO && !strncmp (&ghdr.cookie[0], GMON_MAGIC, 4)))
+  if ((file_format == FF_MAGIC)
+      || (file_format == FF_AUTO && !strncmp (&ghdr.cookie[0], GMON_MAGIC, 4)))
     {
       if (file_format == FF_MAGIC && strncmp (&ghdr.cookie[0], GMON_MAGIC, 4))
 	{
@@ -121,7 +245,7 @@
 
       /* Right magic, so it's probably really a new gmon.out file.  */
       gmon_file_version = bfd_get_32 (core_bfd, (bfd_byte *) ghdr.version);
-      
+
       if (gmon_file_version != GMON_VERSION && gmon_file_version != 0)
 	{
 	  fprintf (stderr,
@@ -181,18 +305,18 @@
       struct hdr tmp;
 
       /* Information from a gmon.out file is in two parts: an array of
-         sampling hits within pc ranges, and the arcs.  */
+	 sampling hits within pc ranges, and the arcs.  */
       gmon_input = INPUT_HISTOGRAM | INPUT_CALL_GRAPH;
 
       /* This fseek() ought to work even on stdin as long as it's
-         not an interactive device (heck, is there anybody who would
-         want to type in a gmon.out at the terminal?).  */
+	 not an interactive device (heck, is there anybody who would
+	 want to type in a gmon.out at the terminal?).  */
       if (fseek (ifp, 0, SEEK_SET) < 0)
 	{
 	  perror (filename);
 	  done (1);
 	}
-      
+
       if (fread (&raw, 1, sizeof (struct raw_phdr), ifp)
 	  != sizeof (struct raw_phdr))
 	{
@@ -200,7 +324,7 @@
 		   filename);
 	  done (1);
 	}
-      
+
       tmp.low_pc = get_vma (core_bfd, (bfd_byte *) &raw.low_pc[0]);
       tmp.high_pc = get_vma (core_bfd, (bfd_byte *) &raw.high_pc[0]);
       tmp.ncnt = bfd_get_32 (core_bfd, (bfd_byte *) &raw.ncnt[0]);
@@ -212,7 +336,7 @@
 
 	  /* 4.4BSD format header.  */
 	  profrate = bfd_get_32 (core_bfd, (bfd_byte *) &raw.profrate[0]);
-	  
+
 	  if (!s_highpc)
 	    hz = profrate;
 	  else if (hz != profrate)
@@ -244,14 +368,14 @@
 	  header_size = sizeof (struct old_raw_phdr);
 	}
 
-      if (s_highpc && (tmp.low_pc != h.low_pc ||
-		       tmp.high_pc != h.high_pc || tmp.ncnt != h.ncnt))
+      if (s_highpc && (tmp.low_pc != h.low_pc
+		       || tmp.high_pc != h.high_pc || tmp.ncnt != h.ncnt))
 	{
 	  fprintf (stderr, _("%s: incompatible with first gmon file\n"),
 		   filename);
 	  done (1);
 	}
-      
+
       h = tmp;
       s_lowpc = (bfd_vma) h.low_pc;
       s_highpc = (bfd_vma) h.high_pc;
@@ -259,7 +383,7 @@
       highpc = (bfd_vma) h.high_pc / sizeof (UNIT);
       samp_bytes = h.ncnt - header_size;
       hist_num_bins = samp_bytes / sizeof (UNIT);
-      
+
       DBG (SAMPLEDEBUG,
 	   printf ("[gmon_out_read] lowpc 0x%lx highpc 0x%lx ncnt %d\n",
 		   (unsigned long) h.low_pc, (unsigned long) h.high_pc,
@@ -273,12 +397,12 @@
 
       /* Make sure that we have sensible values.  */
       if (samp_bytes < 0 || lowpc > highpc)
-        {
-          fprintf (stderr, 
+	{
+	  fprintf (stderr,
 	    _("%s: file '%s' does not appear to be in gmon.out format\n"),
 	    whoami, filename);
-          done (1);
-        }
+	  done (1);
+	}
 
       if (hist_num_bins)
 	++nhist;
@@ -287,7 +411,7 @@
 	{
 	  hist_sample =
 	    (int *) xmalloc (hist_num_bins * sizeof (hist_sample[0]));
-	  
+
 	  memset (hist_sample, 0, hist_num_bins * sizeof (hist_sample[0]));
 	}
 
@@ -300,7 +424,7 @@
 		       whoami, --i, hist_num_bins);
 	      done (1);
 	    }
-	  
+
 	  hist_sample[i] += bfd_get_16 (core_bfd, (bfd_byte *) raw_bin_count);
 	}
 
@@ -312,15 +436,15 @@
 	  from_pc = get_vma (core_bfd, (bfd_byte *) raw_arc.from_pc);
 	  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 %lu\n",
 		     (unsigned long) from_pc, (unsigned long) self_pc, count));
-	  
+
 	  /* Add this arc.  */
 	  cg_tally (from_pc, self_pc, count);
 	}
-      
+
       fclose (ifp);
 
       if (hz == HZ_WRONG)
@@ -328,7 +452,7 @@
 	  /* How many ticks per second?  If we can't tell, report
 	     time in ticks.  */
 	  hz = hertz ();
-	  
+
 	  if (hz == HZ_WRONG)
 	    {
 	      hz = 1;
@@ -377,7 +501,7 @@
 
       memcpy (&ghdr.cookie[0], GMON_MAGIC, 4);
       bfd_put_32 (core_bfd, GMON_VERSION, (bfd_byte *) ghdr.version);
-      
+
       if (fwrite (&ghdr, sizeof (ghdr), 1, ofp) != 1)
 	{
 	  perror (filename);
@@ -413,8 +537,8 @@
 		  (bfd_byte *) &h.ncnt);
 
       /* Write header.  Use new style BSD format is explicitly
-         specified, or if the profiling rate is non-standard;
-         otherwise, use the old BSD format.  */
+	 specified, or if the profiling rate is non-standard;
+	 otherwise, use the old BSD format.  */
       if (file_format == FF_BSD44
 	  || hz != hertz ())
 	{
@@ -467,7 +591,7 @@
 			   (unsigned long) arc->child->addr, arc->count));
 	    }
 	}
-      
+
       fclose (ofp);
     }
   else
Index: gmon_io.h
===================================================================
RCS file: /cvs/src/src/gprof/gmon_io.h,v
retrieving revision 1.3
diff -u -r1.3 gmon_io.h
--- gmon_io.h	2000/07/24 20:59:03	1.3
+++ gmon_io.h	2001/03/13 02:17:11
@@ -1,7 +1,7 @@
 /* gmon_io.h
-   
-   Copyright (C) 2000  Free Software Foundation, Inc.
 
+   Copyright (C) 2000, 2001  Free Software Foundation, Inc.
+
 This file is part of GNU Binutils.
 
 This program is free software; you can redistribute it and/or modify
@@ -21,6 +21,8 @@
 #ifndef gmon_io_h
 #define gmon_io_h
 
+#include <inttypes.h>
+
 #include "bfd.h"
 #include "gmon.h"
 
@@ -48,9 +50,17 @@
 
 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, u_int32_t *valp));
+extern int gmon_io_read_16 PARAMS ((FILE *ifp, u_int16_t *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, u_int32_t val));
+extern int gmon_io_write_16 PARAMS ((FILE *ifp, u_int16_t val));
+extern int gmon_io_write_8 PARAMS ((FILE *ifp, u_int8_t val));
+extern int gmon_io_write PARAMS ((FILE *ifp, char *buf, size_t n));
 
-extern bfd_vma get_vma      PARAMS ((bfd *, bfd_byte *));
-extern void put_vma         PARAMS ((bfd *, bfd_vma, bfd_byte *));
 extern void gmon_out_read   PARAMS ((const char *));
 extern void gmon_out_write  PARAMS ((const char *));
 
Index: gmon_out.h
===================================================================
RCS file: /cvs/src/src/gprof/gmon_out.h,v
retrieving revision 1.2
diff -u -r1.2 gmon_out.h
--- gmon_out.h	2000/07/24 20:59:03	1.2
+++ gmon_out.h	2001/03/13 02:17:11
@@ -1,7 +1,7 @@
 /* gmon_out.h
-   
-   Copyright (C) 2000  Free Software Foundation, Inc.
 
+   Copyright (C) 2000, 2001  Free Software Foundation, Inc.
+
 This file is part of GNU Binutils.
 
 This program is free software; you can redistribute it and/or modify
@@ -18,17 +18,14 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-/* This file specifies the format of gmon.out files.  It should have
-   as few external dependencies as possible as it is going to be
-   included in many different programs.  That is, minimize the
-   number of #include's.
-  
-   A gmon.out file consists of a header (defined by gmon_hdr) followed
+/* A gmon.out file consists of a header (defined by gmon_hdr) followed
    by a sequence of records.  Each record starts with a one-byte tag
    identifying the type of records, followed by records specific data.  */
 #ifndef gmon_out_h
 #define gmon_out_h
 
+#include <gconfig.h>
+
 #define	GMON_MAGIC	"gmon"	/* magic cookie */
 #define GMON_VERSION	1	/* version number */
 
@@ -46,22 +43,5 @@
     GMON_TAG_TIME_HIST = 0, GMON_TAG_CG_ARC = 1, GMON_TAG_BB_COUNT = 2
   }
 GMON_Record_Tag;
-
-struct gmon_hist_hdr
-  {
-    char low_pc[sizeof (char*)];	/* Base pc address of sample buffer.  */
-    char high_pc[sizeof (char*)];	/* Max pc address of sampled buffer.  */
-    char hist_size[4];			/* Size of sample buffer.  */
-    char prof_rate[4];			/* Profiling clock rate.  */
-    char dimen[15];			/* Phys. dim., usually "seconds".  */
-    char dimen_abbrev;			/* Usually 's' for "seconds".  */
-  };
-
-struct gmon_cg_arc_record
-  {
-    char from_pc[sizeof (char*)];	/* Address within caller's body.  */
-    char self_pc[sizeof (char*)];	/* Address within callee's body.  */
-    char count[4];			/* Number of arc traversals.  */
-  };
 
 #endif /* gmon_out_h */
Index: gprof.c
===================================================================
RCS file: /cvs/src/src/gprof/gprof.c,v
retrieving revision 1.6
diff -u -r1.6 gprof.c
--- gprof.c	2000/07/20 18:02:56	1.6
+++ gprof.c	2001/03/13 02:17:11
@@ -429,18 +429,18 @@
 	  if (optarg != NULL)
 	    {
 	      enum demangling_styles style;
-	      
+
 	      style = cplus_demangle_name_to_style (optarg);
-	      if (style == unknown_demangling) 
+	      if (style == unknown_demangling)
 		{
 		  fprintf (stderr,
 			   _("%s: unknown demangling style `%s'\n"),
 			   whoami, optarg);
 		  xexit (1);
 		}
-	      
+
 	      cplus_demangle_set_style (style);
-           }
+	   }
 	  break;
 	case OPTION_NO_DEMANGLE:
 	  demangle = FALSE;
Index: hist.c
===================================================================
RCS file: /cvs/src/src/gprof/hist.c,v
retrieving revision 1.3
diff -u -r1.3 hist.c
--- hist.c	2000/07/24 20:59:03	1.3
+++ hist.c	2001/03/13 02:17:12
@@ -1,6 +1,6 @@
 /* hist.c  -  Histogram related operations.
 
-   Copyright (C) 2000  Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001  Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
@@ -43,11 +43,10 @@
 int hist_num_bins = 0;		/* Number of histogram samples.  */
 int *hist_sample = 0;		/* Histogram samples (shorts in the file!).  */
 double hist_scale;
-char hist_dimension[sizeof (((struct gmon_hist_hdr *) 0)->dimen) + 1] =
-  "seconds";
+char hist_dimension[16] = "seconds";
 char hist_dimension_abbrev = 's';
 
-static double accum_time;	/* Accumulated time so far for print_line().  */
+static double accum_time;	/* Accumulated time so far for print_line(). */
 static double total_time;	/* Total time for all routines.  */
 
 /* Table of SI prefixes for powers of 10 (used to automatically
@@ -59,50 +58,17 @@
   }
 SItab[] =
 {
-  {
-    'T', 1e-12
-  }
-  ,				/* tera */
-  {
-    'G', 1e-09
-  }
-  ,				/* giga */
-  {
-    'M', 1e-06
-  }
-  ,				/* mega */
-  {
-    'K', 1e-03
-  }
-  ,				/* kilo */
-  {
-    ' ', 1e-00
-  }
-  ,
-  {
-    'm', 1e+03
-  }
-  ,				/* milli */
-  {
-    'u', 1e+06
-  }
-  ,				/* micro */
-  {
-    'n', 1e+09
-  }
-  ,				/* nano */
-  {
-    'p', 1e+12
-  }
-  ,				/* pico */
-  {
-    'f', 1e+15
-  }
-  ,				/* femto */
-  {
-    'a', 1e+18
-  }
-  ,				/* ato */
+  { 'T', 1e-12 },				/* tera */
+  { 'G', 1e-09 },				/* giga */
+  { 'M', 1e-06 },				/* mega */
+  { 'K', 1e-03 },				/* kilo */
+  { ' ', 1e-00 },
+  { 'm', 1e+03 },				/* milli */
+  { 'u', 1e+06 },				/* micro */
+  { 'n', 1e+09 },				/* nano */
+  { 'p', 1e+12 },				/* pico */
+  { 'f', 1e+15 },				/* femto */
+  { 'a', 1e+18 }				/* ato */
 };
 
 
@@ -112,26 +78,22 @@
 void
 DEFUN (hist_read_rec, (ifp, filename), FILE * ifp AND const char *filename)
 {
-  struct gmon_hist_hdr hdr;
   bfd_vma n_lowpc, n_highpc;
   int i, ncnt, profrate;
   UNIT count;
 
-  if (fread (&hdr, sizeof (hdr), 1, ifp) != 1)
+  if (gmon_io_read_vma (ifp, &n_lowpc)
+      || gmon_io_read_vma (ifp, &n_highpc)
+      || gmon_io_read_32 (ifp, &ncnt)
+      || gmon_io_read_32 (ifp, &profrate)
+      || gmon_io_read (ifp, hist_dimension, 15)
+      || gmon_io_read (ifp, &hist_dimension_abbrev, 1))
     {
       fprintf (stderr, _("%s: %s: unexpected end of file\n"),
 	       whoami, filename);
       done (1);
     }
 
-  n_lowpc = (bfd_vma) get_vma (core_bfd, (bfd_byte *) hdr.low_pc);
-  n_highpc = (bfd_vma) get_vma (core_bfd, (bfd_byte *) hdr.high_pc);
-  ncnt = bfd_get_32 (core_bfd, (bfd_byte *) hdr.hist_size);
-  profrate = bfd_get_32 (core_bfd, (bfd_byte *) hdr.prof_rate);
-  strncpy (hist_dimension, hdr.dimen, sizeof (hdr.dimen));
-  hist_dimension[sizeof (hdr.dimen)] = '\0';
-  hist_dimension_abbrev = hdr.dimen_abbrev;
-
   if (!s_highpc)
     {
       /* This is the first histogram record.  */
@@ -171,7 +133,7 @@
       if (fread (&count[0], sizeof (count), 1, ifp) != 1)
 	{
 	  fprintf (stderr,
-		   _("%s: %s: unexpected EOF after reading %d of %d samples\n"),
+		  _("%s: %s: unexpected EOF after reading %d of %d samples\n"),
 		   whoami, filename, i, hist_num_bins);
 	  done (1);
 	}
@@ -186,23 +148,19 @@
 void
 DEFUN (hist_write_hist, (ofp, filename), FILE * ofp AND const char *filename)
 {
-  struct gmon_hist_hdr hdr;
   unsigned char tag;
   UNIT count;
   int i;
 
   /* Write header.  */
 
-  tag = GMON_TAG_TIME_HIST;
-  put_vma (core_bfd, s_lowpc, (bfd_byte *) hdr.low_pc);
-  put_vma (core_bfd, s_highpc, (bfd_byte *) hdr.high_pc);
-  bfd_put_32 (core_bfd, hist_num_bins, (bfd_byte *) hdr.hist_size);
-  bfd_put_32 (core_bfd, hz, (bfd_byte *) hdr.prof_rate);
-  strncpy (hdr.dimen, hist_dimension, sizeof (hdr.dimen));
-  hdr.dimen_abbrev = hist_dimension_abbrev;
-
-  if (fwrite (&tag, sizeof (tag), 1, ofp) != 1
-      || fwrite (&hdr, sizeof (hdr), 1, ofp) != 1)
+  if (gmon_io_write_8 (ofp, GMON_TAG_TIME_HIST)
+      || gmon_io_write_vma (ofp, s_lowpc)
+      || gmon_io_write_vma (ofp, s_highpc)
+      || gmon_io_write_32 (ofp, hist_num_bins)
+      || gmon_io_write_32 (ofp, hz)
+      || gmon_io_write (ofp, hist_dimension, 15)
+      || gmon_io_write (ofp, &hist_dimension_abbrev, 1))
     {
       perror (filename);
       done (1);
@@ -211,7 +169,7 @@
   for (i = 0; i < hist_num_bins; ++i)
     {
       bfd_put_16 (core_bfd, hist_sample[i], (bfd_byte *) & count[0]);
-      
+
       if (fwrite (&count[0], sizeof (count), 1, ofp) != 1)
 	{
 	  perror (filename);
@@ -239,7 +197,8 @@
     {
       sym->hist.scaled_addr = sym->addr / sizeof (UNIT);
       bin_of_entry = (sym->hist.scaled_addr - lowpc) / hist_scale;
-      bin_of_code = (sym->hist.scaled_addr + UNITS_TO_CODE - lowpc) / hist_scale;
+      bin_of_code = ((sym->hist.scaled_addr + UNITS_TO_CODE - lowpc)
+		     / hist_scale);
       if (bin_of_entry < bin_of_code)
 	{
 	  DBG (SAMPLEDEBUG,
@@ -254,33 +213,33 @@
 
 
 /* Assign samples to the symbol to which they belong.
-  
+
    Histogram bin I covers some address range [BIN_LOWPC,BIN_HIGH_PC)
    which may overlap one more symbol address ranges.  If a symbol
    overlaps with the bin's address range by O percent, then O percent
    of the bin's count is credited to that symbol.
-  
+
    There are three cases as to where BIN_LOW_PC and BIN_HIGH_PC can be
    with respect to the symbol's address range [SYM_LOW_PC,
    SYM_HIGH_PC) as shown in the following diagram.  OVERLAP computes
    the distance (in UNITs) between the arrows, the fraction of the
    sample that is to be credited to the symbol which starts at
    SYM_LOW_PC.
-  
-          sym_low_pc                                      sym_high_pc
-               |                                               |
-               v                                               v
-  
-               +-----------------------------------------------+
-               |                                               |
-          |  ->|    |<-         ->|         |<-         ->|    |<-  |
-          |         |             |         |             |         |
-          +---------+             +---------+             +---------+
-  
-          ^         ^             ^         ^             ^         ^
-          |         |             |         |             |         |
+
+	  sym_low_pc                                      sym_high_pc
+	       |                                               |
+	       v                                               v
+
+	       +-----------------------------------------------+
+	       |                                               |
+	  |  ->|    |<-         ->|         |<-         ->|    |<-  |
+	  |         |             |         |             |         |
+	  +---------+             +---------+             +---------+
+
+	  ^         ^             ^         ^             ^         ^
+	  |         |             |         |             |         |
      bin_low_pc bin_high_pc  bin_low_pc bin_high_pc  bin_low_pc bin_high_pc
-  
+
    For the VAX we assert that samples will never fall in the first two
    bytes of any routine, since that is the entry mask, thus we call
    scale_and_align_entries() to adjust the entry points if the entry
@@ -315,7 +274,7 @@
       bin_low_pc = lowpc + (bfd_vma) (hist_scale * i);
       bin_high_pc = lowpc + (bfd_vma) (hist_scale * (i + 1));
       time = bin_count;
-      
+
       DBG (SAMPLEDEBUG,
 	   printf (
       "[assign_samples] bin_low_pc=0x%lx, bin_high_pc=0x%lx, bin_count=%d\n",
@@ -329,7 +288,7 @@
 	{
 	  sym_low_pc = symtab.base[j].hist.scaled_addr;
 	  sym_high_pc = symtab.base[j + 1].hist.scaled_addr;
-	  
+
 	  /* If high end of bin is below entry address,
 	     go for next bin.  */
 	  if (bin_high_pc < sym_low_pc)
@@ -346,18 +305,18 @@
 	    {
 	      DBG (SAMPLEDEBUG,
 		   printf (
-			    "[assign_samples] [0x%lx,0x%lx) %s gets %f ticks %ld overlap\n",
-			    (unsigned long) symtab.base[j].addr,
-			    (unsigned long) (sizeof (UNIT) * sym_high_pc),
-			    symtab.base[j].name, overlap * time / hist_scale,
-			    (long) overlap));
-	      
+	       "[assign_samples] [0x%lx,0x%lx) %s gets %f ticks %ld overlap\n",
+			   (unsigned long) symtab.base[j].addr,
+			   (unsigned long) (sizeof (UNIT) * sym_high_pc),
+			   symtab.base[j].name, overlap * time / hist_scale,
+			   (long) overlap));
+
 	      addr = symtab.base[j].addr;
 	      credit = overlap * time / hist_scale;
-	      
+
 	      /* Credit symbol if it appears in INCL_FLAT or that
-	         table is empty and it does not appear it in
-	         EXCL_FLAT.  */
+		 table is empty and it does not appear it in
+		 EXCL_FLAT.  */
 	      if (sym_lookup (&syms[INCL_FLAT], addr)
 		  || (syms[INCL_FLAT].len == 0
 		      && !sym_lookup (&syms[EXCL_FLAT], addr)))
@@ -371,7 +330,7 @@
 	    }
 	}
     }
-  
+
   DBG (SAMPLEDEBUG, printf ("[assign_samples] total_time %f\n",
 			    total_time));
 }
@@ -404,13 +363,14 @@
   if (total_time <= 0.0)
     {
       printf (_(" no time accumulated\n\n"));
-      
+
       /* This doesn't hurt since all the numerators will be zero.  */
       total_time = 1.0;
     }
 
   printf ("%5.5s %10.10s %8.8s %8.8s %8.8s %8.8s  %-8.8s\n",
-	  "%  ", _("cumulative"), _("self  "), "", _("self  "), _("total "), "");
+	  "%  ", _("cumulative"), _("self  "), "", _("self  "), _("total "),
+	  "");
   printf ("%5.5s %9.9s  %8.8s %8.8s %8.8s %8.8s  %-8.8s\n",
 	  _("time"), hist_dimension, hist_dimension, _("calls"), unit, unit,
 	  _("name"));
@@ -424,7 +384,7 @@
     return;
 
   accum_time += sym->hist.time;
-  
+
   if (bsd_style_output)
     printf ("%5.1f %10.2f %8.2f",
 	    total_time > 0.0 ? 100 * sym->hist.time / total_time : 0.0,
@@ -433,14 +393,14 @@
     printf ("%6.2f %9.2f %8.2f",
 	    total_time > 0.0 ? 100 * sym->hist.time / total_time : 0.0,
 	    accum_time / hz, sym->hist.time / hz);
-  
+
   if (sym->ncalls != 0)
     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);
   else
     printf (" %8.8s %8.8s %8.8s  ", "", "", "");
-  
+
   if (bsd_style_output)
     print_name (sym);
   else
@@ -462,10 +422,10 @@
   double time_diff;
 
   time_diff = right->hist.time - left->hist.time;
-  
+
   if (time_diff > 0.0)
     return 1;
-  
+
   if (time_diff < 0.0)
     return -1;
 
@@ -496,7 +456,7 @@
     printf ("\f\n");
 
   accum_time = 0.0;
-  
+
   if (bsd_style_output)
     {
       if (print_descriptions)
@@ -509,11 +469,11 @@
     {
       printf (_("Flat profile:\n"));
     }
-  
+
   /* Sort the symbol table by time (call-count and name as secondary
      and tertiary keys).  */
   time_sorted_syms = (Sym **) xmalloc (symtab.len * sizeof (Sym *));
-  
+
   for (index = 0; index < symtab.len; ++index)
     time_sorted_syms[index] = &symtab.base[index];
 
@@ -530,15 +490,15 @@
       log_scale = 0;
       top_dog = 0;
       top_time = 0.0;
-      
+
       for (index = 0; index < symtab.len; ++index)
 	{
 	  sym = time_sorted_syms[index];
-	  
+
 	  if (sym->ncalls != 0)
 	    {
 	      time = (sym->hist.time + sym->cg.child_time) / sym->ncalls;
-	      
+
 	      if (time > top_time)
 		{
 		  top_dog = sym;
@@ -546,11 +506,11 @@
 		}
 	    }
 	}
-      
+
       if (top_dog && top_dog->ncalls != 0 && top_time > 0.0)
 	{
 	  top_time /= hz;
-	  
+
 	  while (SItab[log_scale].scale * top_time < 1000.0
 		 && ((size_t) log_scale
 		     < sizeof (SItab) / sizeof (SItab[0]) - 1))
@@ -564,19 +524,19 @@
      may also want to support other (pseudo-)dimensions (such as
      I-cache misses etc.).  */
   print_header (SItab[log_scale].prefix);
-  
+
   for (index = 0; index < symtab.len; ++index)
     {
       addr = time_sorted_syms[index]->addr;
-      
+
       /* Print symbol if its in INCL_FLAT table or that table
-        is empty and the symbol is not in EXCL_FLAT.  */
+	is empty and the symbol is not in EXCL_FLAT.  */
       if (sym_lookup (&syms[INCL_FLAT], addr)
 	  || (syms[INCL_FLAT].len == 0
 	      && !sym_lookup (&syms[EXCL_FLAT], addr)))
 	print_line (time_sorted_syms[index], SItab[log_scale].scale);
     }
-  
+
   free (time_sorted_syms);
 
   if (print_descriptions && !bsd_style_output)
Index: hist.h
===================================================================
RCS file: /cvs/src/src/gprof/hist.h,v
retrieving revision 1.2
diff -u -r1.2 hist.h
--- hist.h	2000/07/24 20:59:03	1.2
+++ hist.h	2001/03/13 02:17:12
@@ -1,5 +1,5 @@
 /* hist.h
-   
+
    Copyright (C) 2000  Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
Index: i386.c
===================================================================
RCS file: /cvs/src/src/gprof/i386.c,v
retrieving revision 1.3
diff -u -r1.3 i386.c
--- i386.c	2000/02/22 07:25:46	1.3
+++ i386.c	2001/03/13 02:17:12
@@ -71,7 +71,7 @@
 		       (unsigned long) (instructp - (unsigned char *) delta)));
 	  /*
 	   *  regular pc relative addressing
-	   *    check that this is the address of 
+	   *    check that this is the address of
 	   *    a function.
 	   */
 
Index: search_list.c
===================================================================
RCS file: /cvs/src/src/gprof/search_list.c,v
retrieving revision 1.3
diff -u -r1.3 search_list.c
--- search_list.c	2000/07/24 20:59:03	1.3
+++ search_list.c	2001/03/13 02:17:12
@@ -37,7 +37,7 @@
     {
       beg = colon + 1;
       colon = strchr (beg, PATH_SEP_CHAR);
-      
+
       if (colon)
 	len = colon - beg;
       else
@@ -49,7 +49,7 @@
 
       /* Append new path at end of list.  */
       new_el->next = 0;
-      
+
       if (list->tail)
 	list->tail->next = new_el;
       else
Index: search_list.h
===================================================================
RCS file: /cvs/src/src/gprof/search_list.h,v
retrieving revision 1.3
diff -u -r1.3 search_list.h
--- search_list.h	2000/07/24 20:59:03	1.3
+++ search_list.h	2001/03/13 02:17:12
@@ -1,5 +1,5 @@
 /* search-list.h
-   
+
    Copyright (C) 2000  Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
Index: source.c
===================================================================
RCS file: /cvs/src/src/gprof/source.c,v
retrieving revision 1.5
diff -u -r1.5 source.c
--- source.c	2000/07/24 20:59:03	1.5
+++ source.c	2001/03/13 02:17:12
@@ -44,19 +44,19 @@
       if (FILENAME_CMP (path, sf->name) == 0)
 	break;
     }
-  
+
   if (!sf)
     {
       /* Create a new source file descriptor.  */
       sf = (Source_File *) xmalloc (sizeof (*sf));
-      
+
       memset (sf, 0, sizeof (*sf));
-      
+
       sf->name = xstrdup (path);
       sf->next = first_src_file;
       first_src_file = sf;
     }
-  
+
   return sf;
 }
 
@@ -66,7 +66,7 @@
 {
   const char *fname;
   Source_File *sf;
-  
+
   /* The user cannot know exactly how a filename will be stored in
      the debugging info (e.g., ../include/foo.h
      vs. /usr/include/foo.h).  So we simply compare the filename
@@ -74,7 +74,7 @@
   for (sf = first_src_file; sf; sf = sf->next)
     {
       fname = strrchr (sf->name, '/');
-      
+
       if (fname)
 	++fname;
       else
@@ -83,7 +83,7 @@
       if (FILENAME_CMP (filename, fname) == 0)
 	break;
     }
-  
+
   return sf;
 }
 
@@ -106,7 +106,7 @@
   /* Open input file.  If open fails, walk along search-list until
      open succeeds or reaching end of list.  */
   strcpy (fname, sf->name);
-  
+
   if (IS_ABSOLUTE_PATH (sf->name))
     sle = 0;			/* Don't use search list for absolute paths.  */
 
@@ -115,7 +115,7 @@
     {
       DBG (SRCDEBUG, printf ("[annotate_source]: looking for %s, trying %s\n",
 			     sf->name, fname));
-      
+
       ifp = fopen (fname, FOPEN_RB);
       if (ifp)
 	break;
@@ -139,7 +139,7 @@
 	      sle = src_search_list.head;
 	    }
 	}
-      
+
       if (sle)
 	{
 	  strcpy (fname, sle->path);
@@ -149,7 +149,7 @@
 	    strcat (fname, ".");
 #endif
 	  strcat (fname, "/");
-	  
+
 	  if (name_only)
 	    strcat (fname, name_only);
 	  else
@@ -170,7 +170,7 @@
     }
 
   ofp = stdout;
-  
+
   if (create_annotation_files)
     {
       /* Try to create annotated source file.  */
@@ -213,7 +213,7 @@
       }
 #endif
       ofp = fopen (fname, "w");
-      
+
       if (!ofp)
 	{
 	  perror (fname);
@@ -241,7 +241,7 @@
   annotation = xmalloc (max_width + 1);
   line_num = 1;
   new_line = TRUE;
-  
+
   while ((nread = fread (buf, 1, sizeof (buf), ifp)) > 0)
     {
       for (i = 0; i < nread; ++i)
@@ -253,12 +253,12 @@
 	      ++line_num;
 	      new_line = FALSE;
 	    }
-	  
+
 	  new_line = (buf[i] == '\n');
 	  fputc (buf[i], ofp);
 	}
     }
-  
+
   free (annotation);
   return ofp;
 }
Index: source.h
===================================================================
RCS file: /cvs/src/src/gprof/source.h,v
retrieving revision 1.2
diff -u -r1.2 source.h
--- source.h	2000/07/24 20:59:03	1.2
+++ source.h	2001/03/13 02:17:12
@@ -1,5 +1,5 @@
 /* source.h
-   
+
    Copyright (C) 2000  Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
@@ -53,7 +53,7 @@
    MAX_WIDTH characters wide and for each source-line an annotation is
    obtained by invoking function ANNOTE.  ARG is an argument passed to
    ANNOTE that is left uninterpreted by annotate_source().
-  
+
    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.  */
Index: sym_ids.c
===================================================================
RCS file: /cvs/src/src/gprof/sym_ids.c,v
retrieving revision 1.5
diff -u -r1.5 sym_ids.c
--- sym_ids.c	2000/07/24 20:59:03	1.5
+++ sym_ids.c	2001/03/13 02:17:12
@@ -31,7 +31,7 @@
     char *spec;			/* Parsing modifies this.  */
     Table_Id which_table;
     bool has_right;
-    
+
     struct match
       {
 	int prev_index;		/* Index of prev match.  */
@@ -91,11 +91,11 @@
 
 /* A spec has the syntax FILENAME:(FUNCNAME|LINENUM).  As a convenience
    to the user, a spec without a colon is interpreted as:
-  
-        (i)   a FILENAME if it contains a dot
-        (ii)  a FUNCNAME if it starts with a non-digit character
-        (iii) a LINENUM if it starts with a digit
-  
+
+	(i)   a FILENAME if it contains a dot
+	(ii)  a FUNCNAME if it starts with a non-digit character
+	(iii) a LINENUM if it starts with a digit
+
    A FUNCNAME containing a dot can be specified by :FUNCNAME, a
    FILENAME not containing a dot can be specified by FILENAME.  */
 
@@ -106,21 +106,21 @@
 
   sym_init (sym);
   colon = strrchr (spec, ':');
-  
+
   if (colon)
     {
       *colon = '\0';
-      
+
       if (colon > spec)
 	{
 	  sym->file = source_file_lookup_name (spec);
-	  
+
 	  if (!sym->file)
 	    sym->file = &non_existent_file;
 	}
-      
+
       spec = colon + 1;
-      
+
       if (strlen (spec))
 	{
 	  if (isdigit ((unsigned char) spec[0]))
@@ -135,7 +135,7 @@
       if (strchr (spec, '.'))
 	{
 	  sym->file = source_file_lookup_name (spec);
-	  
+
 	  if (!sym->file)
 	    sym->file = &non_existent_file;
 	}
@@ -174,19 +174,19 @@
   if (debug_level & IDDEBUG)
     {
       printf ("%s:", id->left.sym.file ? id->left.sym.file->name : "*");
-      
+
       if (id->left.sym.name)
 	printf ("%s", id->left.sym.name);
       else if (id->left.sym.line_num)
 	printf ("%d", id->left.sym.line_num);
       else
 	printf ("*");
-      
+
       if (id->has_right)
 	{
 	  printf ("/%s:",
 		  id->right.sym.file ? id->right.sym.file->name : "*");
-	  
+
 	  if (id->right.sym.name)
 	    printf ("%s", id->right.sym.name);
 	  else if (id->right.sym.line_num)
@@ -194,7 +194,7 @@
 	  else
 	    printf ("*");
 	}
-      
+
       printf ("\n");
     }
 #endif
@@ -231,7 +231,7 @@
 	  tab->base[tab->len].next = m->first_match;
 	  m->first_match = &tab->base[tab->len];
 	}
-      
+
       ++tab->len;
     }
 
@@ -246,7 +246,7 @@
 /* Go through sym_id list produced by option processing and fill
    in the various symbol tables indicating what symbols should
    be displayed or suppressed for the various kinds of outputs.
-  
+
    This can potentially produce huge tables and in particulars
    tons of arcs, but this happens only if the user makes silly
    requests---you get what you ask for!  */
@@ -285,7 +285,7 @@
 	  tab->len = 0;
 	}
     }
-  
+
   if (right_ids.len)
     {
       right_ids.base = (Sym *) xmalloc (right_ids.len * sizeof (Sym));
@@ -327,7 +327,7 @@
 				(unsigned long) right->addr,
 				(unsigned long) right->end_addr,
 				table_name[id->which_table]));
-		  
+
 		  arc_add (left, right, (unsigned long) 0);
 		}
 	    }
@@ -362,6 +362,6 @@
 	  && arc_lookup (sym, to))
 	return TRUE;
     }
-  
+
   return FALSE;
 }
Index: sym_ids.h
===================================================================
RCS file: /cvs/src/src/gprof/sym_ids.h,v
retrieving revision 1.2
diff -u -r1.2 sym_ids.h
--- sym_ids.h	2000/07/24 20:59:03	1.2
+++ sym_ids.h	2001/03/13 02:17:12
@@ -1,5 +1,5 @@
 /* sym_ids.h
-   
+
    Copyright (C) 2000  Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gprof/symtab.c,v
retrieving revision 1.4
diff -u -r1.4 symtab.c
--- symtab.c	2000/07/24 20:59:03	1.4
+++ symtab.c	2001/03/13 02:17:12
@@ -33,7 +33,7 @@
 DEFUN (sym_init, (sym), Sym * sym)
 {
   memset (sym, 0, sizeof (*sym));
-  
+
   /* It is not safe to assume that a binary zero corresponds
      to a floating-point 0.0, so initialize floats explicitly.  */
   sym->hist.time = 0.0;
@@ -86,7 +86,7 @@
   /* Remove duplicate entries to speed-up later processing and
      set end_addr if its not set yet.  */
   prev_addr = tab->base[0].addr + 1;
-  
+
   for (src = dst = tab->base; src < tab->limit; ++src)
     {
       if (src->addr == prev_addr)
@@ -114,7 +114,7 @@
 			   dst[-1].name, dst[-1].is_static ? 't' : 'T',
 			   dst[-1].is_func ? 'F' : 'f');
 		   printf (" (addr=%lx)\n", (unsigned long) src->addr));
-	      
+
 	      dst[-1] = *src;
 	    }
 	  else
@@ -142,7 +142,7 @@
 	    }
 	}
     }
-  
+
   if (tab->len > 0 && dst[-1].end_addr == 0)
     dst[-1].end_addr = core_text_sect->vma + core_text_sect->_raw_size - 1;
 
@@ -157,11 +157,11 @@
        unsigned int j;
 
        for (j = 0; j < tab->len; ++j)
-         {
+	 {
 	   printf ("[symtab_finalize] 0x%lx-0x%lx\t%s\n",
 		 (long) tab->base[j].addr, (long) tab->base[j].end_addr,
 		 tab->base[j].name);
-         }
+	 }
   );
 }
 
@@ -181,13 +181,13 @@
   for (low = 0, high = symtab->len - 1; low != high;)
     {
       mid = (high + low) >> 1;
-      
+
       fprintf (stderr, "[dbg_sym_lookup] low=0x%lx, mid=0x%lx, high=0x%lx\n",
 	       low, mid, high);
       fprintf (stderr, "[dbg_sym_lookup] sym[m]=0x%lx sym[m + 1]=0x%lx\n",
 	       (unsigned long) sym[mid].addr,
 	       (unsigned long) sym[mid + 1].addr);
-      
+
       if (sym[mid].addr <= address && sym[mid + 1].addr > address)
 	return &sym[mid];
 
@@ -196,9 +196,9 @@
       else
 	low = mid + 1;
     }
-  
+
   fprintf (stderr, "[dbg_sym_lookup] binary search fails???\n");
-  
+
   return 0;
 }
 
@@ -225,7 +225,7 @@
     {
       DBG (LOOKUPDEBUG, ++probes);
       mid = (high + low) / 2;
-      
+
       if (sym[mid].addr <= address && sym[mid + 1].addr > address)
 	{
 	  if (address > sym[mid].end_addr)
@@ -242,13 +242,13 @@
 	      return &sym[mid];
 	    }
 	}
-      
+
       if (sym[mid].addr > address)
 	high = mid;
       else
 	low = mid + 1;
     }
-  
+
   if (sym[mid + 1].addr <= address)
     {
       if (address > sym[mid + 1].end_addr)
@@ -263,6 +263,6 @@
 	  return &sym[mid + 1];
 	}
     }
-  
+
   return 0;
 }
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gprof/symtab.h,v
retrieving revision 1.2
diff -u -r1.2 symtab.h
--- symtab.h	2000/07/24 20:59:03	1.2
+++ symtab.h	2001/03/13 02:17:12
@@ -1,5 +1,5 @@
 /* symtab.h
-   
+
    Copyright (C) 2000  Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
@@ -28,7 +28,7 @@
    to map code-addresses into source-code information.  Source-code
    information can be any combination of: (i) function-name, (ii)
    source file-name, and (iii) source line number.
-  
+
    The symbol table is used to map addresses into source-code
    information.  */
 
@@ -41,11 +41,11 @@
 typedef struct sym
   {
     /* Common information:
-      
+
        In the symbol-table, fields ADDR and FUNC_NAME are guaranteed
        to contain valid information.  FILE may be 0, if unknown and
        LINE_NUM maybe 0 if unknown.  */
-    
+
     bfd_vma addr;		/* Address of entry point.  */
     bfd_vma end_addr;		/* End-address.  */
     const char *name;		/* Name of function this sym is from.  */
Index: tahoe.c
===================================================================
RCS file: /cvs/src/src/gprof/tahoe.c,v
retrieving revision 1.3
diff -u -r1.3 tahoe.c
--- tahoe.c	2000/02/22 07:25:46	1.3
+++ tahoe.c	2001/03/13 02:17:12
@@ -304,7 +304,7 @@
 	    case longrel:
 	      /*
 	       *    regular pc relative addressing
-	       *      check that this is the address of 
+	       *      check that this is the address of
 	       *      a function.
 	       */
 	      destpc = tahoe_reladdr (instructp + length)
Index: vax.c
===================================================================
RCS file: /cvs/src/src/gprof/vax.c,v
retrieving revision 1.3
diff -u -r1.3 vax.c
--- vax.c	2000/02/22 07:25:46	1.3
+++ vax.c	2001/03/13 02:17:12
@@ -307,7 +307,7 @@
 	    case longrel:
 	      /*
 	       *    regular pc relative addressing
-	       *      check that this is the address of 
+	       *      check that this is the address of
 	       *      a function.
 	       */
 	      destpc = vax_reladdr ((struct modebyte *) (instructp + length))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]