]> oss.titaniummirror.com Git - msp430-binutils.git/blobdiff - gprof/gmon_io.c
Merge commit 'upstream/2.20'
[msp430-binutils.git] / gprof / gmon_io.c
index 463993229794451609f4ca79fefa3c141883466d..f48d3bcc1f0b485425f96ad352b9b83171a902f7 100644 (file)
@@ -1,6 +1,6 @@
 /* gmon_io.c - Input and output from/to gmon.out files.
 
 /* gmon_io.c - Input and output from/to gmon.out files.
 
-   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
+   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
    Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
    Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
@@ -21,6 +21,7 @@
    02110-1301, USA.  */
 \f
 #include "gprof.h"
    02110-1301, USA.  */
 \f
 #include "gprof.h"
+#include "binary-io.h"
 #include "search_list.h"
 #include "source.h"
 #include "symtab.h"
 #include "search_list.h"
 #include "source.h"
 #include "symtab.h"
@@ -300,9 +301,7 @@ gmon_out_read (const char *filename)
   if (strcmp (filename, "-") == 0)
     {
       ifp = stdin;
   if (strcmp (filename, "-") == 0)
     {
       ifp = stdin;
-#ifdef SET_BINARY
       SET_BINARY (fileno (stdin));
       SET_BINARY (fileno (stdin));
-#endif
     }
   else
     {
     }
   else
     {
@@ -493,11 +492,14 @@ gmon_out_read (const char *filename)
 
       if (!histograms)
        {
 
       if (!histograms)
        {
-         histograms = xmalloc (sizeof (struct histogram));
+         num_histograms = 1;
+         histograms = (struct histogram *) xmalloc (sizeof (struct histogram));
          histograms->lowpc = tmp.low_pc;
          histograms->highpc = tmp.high_pc;
          histograms->num_bins = hist_num_bins;
          histograms->lowpc = tmp.low_pc;
          histograms->highpc = tmp.high_pc;
          histograms->num_bins = hist_num_bins;
-         histograms->sample = xmalloc (hist_num_bins * sizeof (int));
+         hist_scale = (double)((tmp.high_pc - tmp.low_pc) / sizeof (UNIT))
+           / hist_num_bins;
+         histograms->sample = (int *) xmalloc (hist_num_bins * sizeof (int));
          memset (histograms->sample, 0, 
                  hist_num_bins * sizeof (int));
        }
          memset (histograms->sample, 0, 
                  hist_num_bins * sizeof (int));
        }