summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/binutils/gprof/gprof.c
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-06-10 10:55:58 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-06-10 10:55:58 +0000
commita7e831079363e3bb45f3172f6e59ba48e335682b (patch)
treeee4324eac9a9d66f189fab60498ec42b8226b7fc /gnu/usr.bin/binutils/gprof/gprof.c
parent467cb0a471d13c5186a6ee166e60b47c30da64e9 (diff)
Bring Cygnus versions into the trunk, keeping our local patches
Diffstat (limited to 'gnu/usr.bin/binutils/gprof/gprof.c')
-rw-r--r--gnu/usr.bin/binutils/gprof/gprof.c46
1 files changed, 41 insertions, 5 deletions
diff --git a/gnu/usr.bin/binutils/gprof/gprof.c b/gnu/usr.bin/binutils/gprof/gprof.c
index 5da3180a93e..e99f2d25caf 100644
--- a/gnu/usr.bin/binutils/gprof/gprof.c
+++ b/gnu/usr.bin/binutils/gprof/gprof.c
@@ -33,6 +33,7 @@
#define VERSION "2.6"
const char *whoami;
+const char *function_mapping_file;
const char *a_out_name = A_OUTNAME;
long hz = HZ_WRONG;
@@ -50,6 +51,7 @@ bool ignore_zeros = TRUE;
bool line_granularity = FALSE;
bool print_descriptions = TRUE;
bool print_path = FALSE;
+bool ignore_non_functions = FALSE;
File_Format file_format = FF_AUTO;
bool first_output = TRUE;
@@ -67,7 +69,7 @@ bfd *abfd;
*/
static char *default_excluded_list[] =
{
- "_gprof_mcount", "mcount", "_mcount", "__mcleanup",
+ "_gprof_mcount", "mcount", "_mcount", "__mcount", "__mcleanup",
"<locore>", "<hicore>",
0
};
@@ -76,6 +78,7 @@ static struct option long_options[] =
{
{"line", no_argument, 0, 'l'},
{"no-static", no_argument, 0, 'a'},
+ {"ignore-non-functions", no_argument, 0, 'D'},
/* output styles: */
@@ -87,6 +90,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'},
@@ -129,16 +134,17 @@ static void
DEFUN (usage, (stream, status), FILE * stream AND int status)
{
fprintf (stream, "\
-Usage: %s [-[abchilLsTvwxyz]] [-[ACeEfFJnNOpPqQZ][name]] [-I dirs]\n\
+Usage: %s [-[abcDhilLsTvwxyz]] [-[ACeEfFJnNOpPqQZ][name]] [-I dirs]\n\
[-d[num]] [-k from/to] [-m min-count] [-t table-length]\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\
[--static-call-graph] [--sum] [--table-length=len] [--traditional]\n\
- [--version] [--width=n]\n\
+ [--version] [--width=n] [--ignore-non-functions]\n\
[image-file] [profile-file...]\n",
whoami);
done (status);
@@ -156,7 +162,7 @@ DEFUN (main, (argc, argv), int argc AND char **argv)
xmalloc_set_program_name (whoami);
while ((ch = getopt_long (argc, argv,
- "aA::bBcCd::e:E:f:F:hiI:J::k:lLm:n::N::O:p::P::q::Q::st:Tvw:xyzZ::",
+ "aA::bBcCdD::e:E:f:F:hiI:J::k:lLm:n::N::O:p::P::q::Q::st:Tvw:xyzZ::",
long_options, 0))
!= EOF)
{
@@ -206,6 +212,9 @@ DEFUN (main, (argc, argv), int argc AND char **argv)
printf ("%s: debugging not supported; -d ignored\n", whoami);
#endif /* DEBUG */
break;
+ case 'D':
+ ignore_non_functions = TRUE;
+ break;
case 'E':
sym_id_add (optarg, EXCL_TIME);
case 'e':
@@ -317,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)
{
@@ -386,6 +404,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)
@@ -409,7 +437,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
}
@@ -576,6 +604,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;
}