aboutsummaryrefslogtreecommitdiff
path: root/gprof
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>1995-12-25 04:32:29 +0000
committerJeff Law <law@redhat.com>1995-12-25 04:32:29 +0000
commit32843f948c896c825b38465b5495044f9f6cb298 (patch)
tree9eed0cebd32f609fb20ec5fc2b5ef95ec7ffe377 /gprof
parent7920c1d195114002311c4a8b1209603a8c57d315 (diff)
downloadgdb-32843f948c896c825b38465b5495044f9f6cb298.zip
gdb-32843f948c896c825b38465b5495044f9f6cb298.tar.gz
gdb-32843f948c896c825b38465b5495044f9f6cb298.tar.bz2
* core.c (core_sym_class): Ignore symbols without BSF_FUNCTION
set if ignore_non_function is set. * gprof.h (ignore_non_functions): Declare. * gprof.c (ignore_non_functions): Define. (long_options): Add "ignore-non-functions". (usage): Add new options. (main): Recognize "-D" and "--ignore-non-functions" option. So we can get more accurate information on Solaris, HPUX and other systems that can uniquely identify function symbols.
Diffstat (limited to 'gprof')
-rw-r--r--gprof/ChangeLog10
-rw-r--r--gprof/core.c6
-rw-r--r--gprof/gprof.c11
-rw-r--r--gprof/gprof.h2
-rw-r--r--gprof/gprof.texi6
5 files changed, 32 insertions, 3 deletions
diff --git a/gprof/ChangeLog b/gprof/ChangeLog
index e8a9350..2e2a726 100644
--- a/gprof/ChangeLog
+++ b/gprof/ChangeLog
@@ -1,3 +1,13 @@
+Sun Dec 24 21:32:27 1995 Jeffrey A Law (law@cygnus.com)
+
+ * core.c (core_sym_class): Ignore symbols without BSF_FUNCTION
+ set if ignore_non_function is set.
+ * gprof.h (ignore_non_functions): Declare.
+ * gprof.c (ignore_non_functions): Define.
+ (long_options): Add "ignore-non-functions".
+ (usage): Add new options.
+ (main): Recognize "-D" and "--ignore-non-functions" option.
+
Tue Nov 21 13:24:39 1995 Ken Raeburn <raeburn@cygnus.com>
* Makefile.in (.m.c): Strip out directory name from function
diff --git a/gprof/core.c b/gprof/core.c
index 19c6e59..aa6012a 100644
--- a/gprof/core.c
+++ b/gprof/core.c
@@ -179,6 +179,12 @@ DEFUN (core_sym_class, (sym), asymbol * sym)
{
return 0;
}
+
+ /* If the object file supports marking of function symbols, then we can
+ zap anything that doesn't have BSF_FUNCTION set. */
+ if (ignore_non_functions && (sym->flags & BSF_FUNCTION) == 0)
+ return 0;
+
return 't'; /* it's a static text symbol */
}
diff --git a/gprof/gprof.c b/gprof/gprof.c
index 5da3180..0f9dd85 100644
--- a/gprof/gprof.c
+++ b/gprof/gprof.c
@@ -50,6 +50,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;
@@ -76,6 +77,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: */
@@ -129,7 +131,7 @@ 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\
@@ -138,7 +140,7 @@ Usage: %s [-[abchilLsTvwxyz]] [-[ACeEfFJnNOpPqQZ][name]] [-I dirs]\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 +158,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 +208,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':
diff --git a/gprof/gprof.h b/gprof/gprof.h
index e4177a9..94fee0d 100644
--- a/gprof/gprof.h
+++ b/gprof/gprof.h
@@ -128,6 +128,8 @@ extern bool ignore_zeros; /* ignore unused symbols/files */
extern bool line_granularity; /* function or line granularity? */
extern bool print_descriptions; /* output profile description */
extern bool print_path; /* print path or just filename? */
+extern bool ignore_non_functions;/* Ignore non-function symbols. */
+
extern File_Format file_format; /* requested file format */
extern bool first_output; /* no output so far? */
diff --git a/gprof/gprof.texi b/gprof/gprof.texi
index ba05b59..1bf6315 100644
--- a/gprof/gprof.texi
+++ b/gprof/gprof.texi
@@ -294,6 +294,12 @@ function that was loaded directly before it in the executable file.
@c This is compatible with Unix @code{gprof}, but a bad idea.
This option affects both the flat profile and the call graph.
+@item -D
+The @samp{-D} option causes @code{gprof} to ignore symbols which
+are not known to be functions. This option will give more accurate
+profile data on systems where it is supported (Solaris and HPUX for
+example).
+
@item -e @var{function_name}
The @samp{-e @var{function}} option tells @code{gprof} to not print
information about the function @var{function_name} (and its