* symtab.h (SYMBOL_SET_LINKAGE_NAME): Update comment.
[deliverable/binutils-gdb.git] / gprof / cg_print.c
index b951b4483bb745a42d76f742e6ec5b248fd23054..0b2e989c2a92f97051cf65b54329d8d85a060ae9 100644 (file)
@@ -1,12 +1,13 @@
 /* cg_print.c -  Print routines for displaying call graphs.
 
-   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2004, 2007, 2009
+   Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 \f
-#include "libiberty.h"
 #include "gprof.h"
+#include "libiberty.h"
 #include "search_list.h"
 #include "source.h"
 #include "symtab.h"
@@ -76,7 +77,7 @@ print_header ()
     }
 
   printf (_("\ngranularity: each sample hit covers %ld byte(s)"),
-         (long) hist_scale * sizeof (UNIT));
+         (long) hist_scale * (long) sizeof (UNIT));
 
   if (print_time > 0.0)
     printf (_(" for %.2f%% of %.2f seconds\n\n"),
@@ -166,7 +167,7 @@ sort_members (Sym *cyc)
   todo = cyc->cg.cyc.next;
   cyc->cg.cyc.next = 0;
 
-  for (doing = todo; doing && doing->cg.cyc.next; doing = todo)
+  for (doing = todo; doing != NULL; doing = todo)
     {
       todo = doing->cg.cyc.next;
 
@@ -804,13 +805,8 @@ cg_print_function_ordering ()
     {
       if (symtab.base[index].ncalls == 0)
        {
-         /* Filter out gprof generated names.  */
-         if (strcmp (symtab.base[index].name, "<locore>")
-             && strcmp (symtab.base[index].name, "<hicore>"))
-           {
-             unused_syms[unused++] = &symtab.base[index];
-             symtab.base[index].has_been_placed = 1;
-           }
+         unused_syms[unused++] = &symtab.base[index];
+         symtab.base[index].has_been_placed = 1;
        }
       else
        {
@@ -1217,12 +1213,22 @@ order_and_dump_functions_by_arcs (the_arcs, arc_count, all,
       }
 }
 
+/* Compare two function_map structs based on file name.
+   We want to sort in ascending order.  */
+
+static int
+cmp_symbol_map (const void * l, const void * r)
+{
+  return strcmp (((struct function_map *) l)->file_name, 
+                ((struct function_map *) r)->file_name);
+}
+
 /* Print a suggested .o ordering for files on a link line based
    on profiling information.  This uses the function placement
    code for the bulk of its work.  */
 
 void
-cg_print_file_ordering ()
+cg_print_file_ordering (void)
 {
   unsigned long scratch_arc_count, index;
   Arc **scratch_arcs;
@@ -1249,6 +1255,8 @@ cg_print_file_ordering ()
        printf ("%s\n", symtab.base[index].name);
     }
 
+  qsort (symbol_map, symbol_map_count, sizeof (struct function_map), cmp_symbol_map);
+
   /* Now output any .o's that didn't have any text symbols.  */
   last = NULL;
   for (index = 0; index < symbol_map_count; index++)
This page took 0.025041 seconds and 4 git commands to generate.