* gprof.c (inline_file_names): New variable.
authorConrad Hoffmann <ch@bitfehler.net>
Thu, 21 Nov 2013 13:13:06 +0000 (13:13 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 21 Nov 2013 13:13:06 +0000 (13:13 +0000)
(OPTION_INLINE_FILE_NAMES): Define.
(long_options): Add --inline-file-names.
(usage): Likewise.
(main): Process --inline-file-names.
* gprof.h: Add prototype for inline_file_names.
* utils.c (print_name_only): Handle inline_file_names.
* gprof.texi: Document new command line option.

gprof/ChangeLog
gprof/gprof.c
gprof/gprof.h
gprof/gprof.texi
gprof/utils.c

index c6190e97df81c9b934514e308c722a6743d6c725..d08636fa74d6540e1eb49af5c111ef1eba9718f0 100644 (file)
@@ -1,3 +1,14 @@
+2013-11-21  Conrad Hoffmann  <ch@bitfehler.net>
+
+       * gprof.c (inline_file_names): New variable.
+       (OPTION_INLINE_FILE_NAMES): Define.
+       (long_options): Add --inline-file-names.
+       (usage): Likewise.
+       (main): Process --inline-file-names.
+       * gprof.h: Add prototype for inline_file_names.
+       * utils.c (print_name_only): Handle inline_file_names.
+       * gprof.texi: Document new command line option.
+
 2013-11-02  Alan Modra  <amodra@gmail.com>
 
        * Makefile.am (.m.c): Fix input and output file specification.
index 8d545389c5d6bc84339ef89f2092fedd34eb5c8d..6415c30d6a1f2ddfcefb76a815db445c422884a3 100644 (file)
@@ -68,6 +68,7 @@ bfd_boolean line_granularity = FALSE;
 bfd_boolean print_descriptions = TRUE;
 bfd_boolean print_path = FALSE;
 bfd_boolean ignore_non_functions = FALSE;
+bfd_boolean inline_file_names = FALSE;
 File_Format file_format = FF_AUTO;
 
 bfd_boolean first_output = TRUE;
@@ -91,8 +92,9 @@ static char *default_excluded_list[] =
 /* Codes used for the long options with no short synonyms.  150 isn't
    special; it's just an arbitrary non-ASCII char value.  */
 
-#define OPTION_DEMANGLE                (150)
-#define OPTION_NO_DEMANGLE     (OPTION_DEMANGLE + 1)
+#define OPTION_DEMANGLE                        (150)
+#define OPTION_NO_DEMANGLE             (OPTION_DEMANGLE + 1)
+#define OPTION_INLINE_FILE_NAMES       (OPTION_DEMANGLE + 2)
 
 static struct option long_options[] =
 {
@@ -123,6 +125,7 @@ static struct option long_options[] =
   {"no-demangle", no_argument, 0, OPTION_NO_DEMANGLE},
   {"directory-path", required_argument, 0, 'I'},
   {"display-unused-functions", no_argument, 0, 'z'},
+  {"inline-file-names", no_argument, 0, OPTION_INLINE_FILE_NAMES},
   {"min-count", required_argument, 0, 'm'},
   {"print-path", no_argument, 0, 'L'},
   {"separate-files", no_argument, 0, 'y'},
@@ -162,7 +165,7 @@ Usage: %s [-[abcDhilLsTvwxyz]] [-[ACeEfFJnNOpPqSQZ][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\
+       [--function-ordering] [--file-ordering] [--inline-file-names]\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\
@@ -470,6 +473,9 @@ This program is free software.  This program has absolutely no warranty.\n"));
        case OPTION_NO_DEMANGLE:
          demangle = FALSE;
          break;
+       case OPTION_INLINE_FILE_NAMES:
+         inline_file_names = TRUE;
+         break;
        default:
          usage (stderr, 1);
        }
index 69527fc29b475363613b16da865f079183d6387c..c919ea437c4215c5a7875db2dbb4662e13637493 100644 (file)
@@ -126,6 +126,7 @@ extern bfd_boolean line_granularity;        /* function or line granularity? */
 extern bfd_boolean print_descriptions; /* output profile description */
 extern bfd_boolean print_path;         /* print path or just filename? */
 extern bfd_boolean ignore_non_functions; /* Ignore non-function symbols.  */
+extern bfd_boolean inline_file_names;  /* print file names after symbols */
 
 extern File_Format file_format;                /* requested file format */
 
index 30f43f9a3e237c5fcd03193dfb1b387c3e1d8cab..3f210b473b51216cd9fe4364719bbb4256cf7431 100644 (file)
@@ -1,8 +1,6 @@
 \input texinfo @c -*-texinfo-*-
 @setfilename gprof.info
-@c Copyright 1988, 1992, 1993, 1998, 1999, 2000, 2001, 2002, 2003,
-@c 2004, 2007, 2008, 2009
-@c Free Software Foundation, Inc.
+@c Copyright 1988-2013 Free Software Foundation, Inc.
 @settitle GNU gprof
 @setchapternewpage odd
 
@@ -23,8 +21,7 @@
 This file documents the gprof profiler of the GNU system.
 
 @c man begin COPYRIGHT
-Copyright @copyright{} 1988, 1992, 1997, 1998, 1999, 2000, 2001, 2003,
-2007, 2008, 2009 Free Software Foundation, Inc.
+Copyright @copyright{} 1988-2013 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3
@@ -57,8 +54,7 @@ execute programs.  @sc{gnu} @code{gprof} was written by Jay Fenlason.
 Eric S. Raymond made some minor corrections and additions in 2003.
 
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1988, 1992, 1997, 1998, 1999, 2000, 2003, 2008,
-2009 Free Software Foundation, Inc.
+Copyright @copyright{} 1988-2013 Free Software Foundation, Inc.
 
       Permission is granted to copy, distribute and/or modify this document
       under the terms of the GNU Free Documentation License, Version 1.3
@@ -124,12 +120,13 @@ gprof [ -[abcDhilLrsTvwxyz] ] [ -[ACeEfFJnNOpPqQZ][@var{name}] ]
  [ --debug[=@var{level}] ] [ --function-ordering ] 
  [ --file-ordering @var{map_file} ] [ --directory-path=@var{dirs} ]
  [ --display-unused-functions ] [ --file-format=@var{name} ]
- [ --file-info ] [ --help ] [ --line ] [ --min-count=@var{n} ]
- [ --no-static ] [ --print-path ] [ --separate-files ]
- [ --static-call-graph ] [ --sum ] [ --table-length=@var{len} ]
- [ --traditional ] [ --version ] [ --width=@var{n} ]
- [ --ignore-non-functions ] [ --demangle[=@var{STYLE}] ]
- [ --no-demangle ] [--external-symbol-table=name] 
+ [ --file-info ] [ --help ] [ --line ] [ --inline-file-names ]
+ [ --min-count=@var{n} ] [ --no-static ] [ --print-path ]
+ [ --separate-files ] [ --static-call-graph ] [ --sum ]
+ [ --table-length=@var{len} ] [ --traditional ] [ --version ]
+ [ --width=@var{n} ] [ --ignore-non-functions ]
+ [ --demangle[=@var{STYLE}] ] [ --no-demangle ]
+ [--external-symbol-table=name]
  [ @var{image-file} ] [ @var{profile-file} @dots{} ]
 @c man end
 @end smallexample
@@ -712,6 +709,11 @@ the running time of @code{gprof}, and magnifies statistical
 inaccuracies.
 @xref{Sampling Error, ,Statistical Sampling Error}.
 
+@item --inline-file-names
+This option causes @code{gprof} to print the source file after each
+symbol in both the flat profile and the call graph. The full path to the
+file is printed if used with the @samp{-L} option.
+
 @item -m @var{num}
 @itemx --min-count=@var{num}
 This option affects execution count output only.
index f34984108e530581bfac47013d04b3cedd63baf6..4fc2db6038e94c91965a0120c37dbd5190503489 100644 (file)
@@ -58,7 +58,7 @@ print_name_only (Sym *self)
        }
       printf ("%s", name);
       size = strlen (name);
-      if (line_granularity && self->file)
+      if ((line_granularity || inline_file_names) && self->file)
        {
          filename = self->file->name;
          if (!print_path)
@@ -73,8 +73,15 @@ print_name_only (Sym *self)
                  filename = self->file->name;
                }
            }
-         sprintf (buf, " (%s:%d @ %lx)", filename, self->line_num,
-                  (unsigned long) self->addr);
+         if (line_granularity)
+           {
+             sprintf (buf, " (%s:%d @ %lx)", filename, self->line_num,
+                      (unsigned long) self->addr);
+           }
+         else
+           {
+             sprintf (buf, " (%s:%d)", filename, self->line_num);
+           }
          printf ("%s", buf);
          size += strlen (buf);
        }
This page took 0.027237 seconds and 4 git commands to generate.