(sim_core_signal): Add missing "\n" in message.
[deliverable/binutils-gdb.git] / gprof / gprof.c
index 0f9dd85f7c1b64941b9bb94f82ed2c57a2d46287..1af7fa18369b7ee2be828f2e00f32969caf379fc 100644 (file)
@@ -30,9 +30,8 @@
 #include "source.h"
 #include "sym_ids.h"
 
-#define VERSION "2.6"
-
 const char *whoami;
+const char *function_mapping_file;
 const char *a_out_name = A_OUTNAME;
 long hz = HZ_WRONG;
 
@@ -68,7 +67,7 @@ bfd *abfd;
  */
 static char *default_excluded_list[] =
 {
-  "_gprof_mcount", "mcount", "_mcount", "__mcleanup",
+  "_gprof_mcount", "mcount", "_mcount", "__mcount", "__mcleanup",
   "<locore>", "<hicore>",
   0
 };
@@ -89,6 +88,8 @@ static struct option long_options[] =
   {"no-graph", optional_argument, 0, 'Q'},
   {"exec-counts", optional_argument, 0, 'C'},
   {"no-exec-counts", optional_argument, 0, 'Z'},
+  {"function-ordering", no_argument, 0, 'r'},
+  {"file-ordering", required_argument, 0, 'R'},
   {"file-info", no_argument, 0, 'i'},
   {"sum", no_argument, 0, 's'},
 
@@ -136,6 +137,7 @@ Usage: %s [-[abcDhilLsTvwxyz]] [-[ACeEfFJnNOpPqQZ][name]] [-I dirs]\n\
        [--[no-]annotated-source[=name]] [--[no-]exec-counts[=name]]\n\
        [--[no-]flat-profile[=name]] [--[no-]graph[=name]]\n\
        [--[no-]time=name] [--all-lines] [--brief] [--debug[=level]]\n\
+       [--function-ordering] [--file-ordering]\n\
        [--directory-path=dirs] [--display-unused-functions]\n\
        [--file-format=name] [--file-info] [--help] [--line] [--min-count=n]\n\
        [--no-static] [--print-path] [--separate-files]\n\
@@ -143,6 +145,8 @@ Usage: %s [-[abcDhilLsTvwxyz]] [-[ACeEfFJnNOpPqQZ][name]] [-I dirs]\n\
        [--version] [--width=n] [--ignore-non-functions]\n\
        [image-file] [profile-file...]\n",
           whoami);
+  if (status == 0)
+    fprintf (stream, "Report bugs to bug-gnu-utils@prep.ai.mit.edu\n");
   done (status);
 }
 
@@ -322,6 +326,15 @@ DEFUN (main, (argc, argv), int argc AND char **argv)
          output_style |= STYLE_CALL_GRAPH;
          user_specified |= STYLE_CALL_GRAPH;
          break;
+       case 'r':
+         output_style |= STYLE_FUNCTION_ORDER;
+         user_specified |= STYLE_FUNCTION_ORDER;
+         break;
+       case 'R':
+         output_style |= STYLE_FILE_ORDER;
+         user_specified |= STYLE_FILE_ORDER;
+         function_mapping_file = optarg;
+         break;
        case 'Q':
          if (optarg)
            {
@@ -356,7 +369,11 @@ DEFUN (main, (argc, argv), int argc AND char **argv)
          bsd_style_output = TRUE;
          break;
        case 'v':
-         printf ("%s version %s\n", whoami, VERSION);
+         /* This output is intended to follow the GNU standards document.  */
+         printf ("GNU gprof %s\n", VERSION);
+         printf ("Based on BSD gprof, copyright 1983 Regents of the University of California.\n");
+         printf ("\
+This program is free software.  This program has absolutely no warranty.\n");
          done (0);
        case 'w':
          output_width = atoi (optarg);
@@ -391,6 +408,16 @@ DEFUN (main, (argc, argv), int argc AND char **argv)
        }
     }
 
+  /* Don't allow both ordering options, they modify the arc data in-place.  */
+  if ((user_specified & STYLE_FUNCTION_ORDER)
+      && (user_specified & STYLE_FILE_ORDER))
+    {
+      fprintf (stderr,"\
+%s: Only one of --function-ordering and --file-ordering may be specified.\n",
+              whoami);
+      done (1);
+    }
+
   /* append value of GPROF_PATH to source search list if set: */
   str = (char *) getenv ("GPROF_PATH");
   if (str)
@@ -414,7 +441,7 @@ DEFUN (main, (argc, argv), int argc AND char **argv)
     {
       sym_id_add (*sp, EXCL_TIME);
       sym_id_add (*sp, EXCL_GRAPH);
-#ifdef __osf__
+#ifdef __alpha__
       sym_id_add (*sp, EXCL_FLAT);
 #endif
     }
@@ -581,6 +608,14 @@ DEFUN (main, (argc, argv), int argc AND char **argv)
     {
       print_annotated_source ();
     }
+  if (output_style & STYLE_FUNCTION_ORDER)
+    {
+      cg_print_function_ordering ();
+    }
+  if (output_style & STYLE_FILE_ORDER)
+    {
+      cg_print_file_ordering ();
+    }
   return 0;
 }
 
This page took 0.024658 seconds and 4 git commands to generate.