aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gprof/ChangeLog18
-rw-r--r--gprof/alpha.h5
-rw-r--r--gprof/core.c19
-rw-r--r--gprof/gmon.h7
-rw-r--r--gprof/gmon_io.c24
-rw-r--r--gprof/gprof.c4
6 files changed, 65 insertions, 12 deletions
diff --git a/gprof/ChangeLog b/gprof/ChangeLog
index a575dc2..0cee852 100644
--- a/gprof/ChangeLog
+++ b/gprof/ChangeLog
@@ -1,3 +1,21 @@
+Thu Mar 21 17:02:02 1996 David Mosberger-Tang <davidm@azstarnet.com>
+
+ * gprof.c (default_excluded_list): Add "__mcount".
+
+ * gprof.c (main): Change ifdef __osf__ to __alpha__.
+
+ * gmon_io.c (gmon_out_read): If BSD44_FORMAT is defined, get the
+ profiling rate from the header.
+
+ * gmon.h (struct raw_phdr): Only include pad if both __alpha__ and
+ __osf__ are defined. Add new fields if BSD44_FORMAT is defined.
+
+ * alpha.h (MIN_INSN_SIZE): Define.
+ * core.c (MIN_INSN_SIZE): If not defined, define as 1.
+ (core_sym_class): Ignore debugging symbols.
+ (core_create_line_syms): Use MIN_INSN_SIZE when gathering line
+ information.
+
Wed Mar 20 18:15:47 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* cg_print.c (cg_print_function_ordering): Fix __GNUC__ misspelled
diff --git a/gprof/alpha.h b/gprof/alpha.h
index 9eb92bc..b91324e 100644
--- a/gprof/alpha.h
+++ b/gprof/alpha.h
@@ -28,4 +28,9 @@
#define OFFSET_TO_CODE 0
#define UNITS_TO_CODE (OFFSET_TO_CODE / sizeof(UNIT))
+/*
+ * Minimum size of an instruction (in bytes):
+ */
+#define MIN_INSN_SIZE 4
+
#endif /* alpha_h */
diff --git a/gprof/core.c b/gprof/core.c
index d514178..b54c86e 100644
--- a/gprof/core.c
+++ b/gprof/core.c
@@ -3,6 +3,13 @@
#include "core.h"
#include "symtab.h"
+#ifndef MIN_INSN_SIZE
+/* If not defined in MACHINE_H, assume smallest instruction is 1 byte
+ long. THis is safe but may be needlessly slow on machines where
+ all instructions are longer. */
+#define MIN_INSN_SIZE 1
+#endif
+
bfd *core_bfd;
int core_num_syms;
asymbol **core_syms;
@@ -199,15 +206,15 @@ DEFUN (core_sym_class, (sym), asymbol * sym)
char sym_prefix;
int i;
- /*
- * Must be a text symbol, and static text symbols don't qualify if
- * ignore_static_funcs set.
- */
- if (!sym->section)
+ if (sym->section == NULL || (sym->flags & BSF_DEBUGGING) != 0)
{
return 0;
}
+ /*
+ * Must be a text symbol, and static text symbols don't qualify if
+ * ignore_static_funcs set.
+ */
if (ignore_static_funcs && (sym->flags & BSF_LOCAL))
{
DBG (AOUTDEBUG, printf ("[core_sym_class] %s: not a function\n",
@@ -530,7 +537,7 @@ DEFUN (core_create_line_syms, (core_bfd), bfd * core_bfd)
prev_offset = -min_dist;
prev_filename[0] = '\0';
prev_line_num = 0;
- for (offset = 0; offset < core_text_sect->_raw_size; ++offset)
+ for (offset = 0; offset < core_text_sect->_raw_size; offset += MIN_INSN_SIZE)
{
vma = core_text_sect->vma + offset;
if (!get_src_info (vma, &filename, &dummy.name, &dummy.line_num)
diff --git a/gprof/gmon.h b/gprof/gmon.h
index 74cd4b8..488f11e 100644
--- a/gprof/gmon.h
+++ b/gprof/gmon.h
@@ -40,12 +40,17 @@ struct raw_phdr
char low_pc[sizeof (bfd_vma)]; /* base pc address of sample buffer */
char high_pc[sizeof (bfd_vma)]; /* max pc address of sampled buffer */
char ncnt[4]; /* size of sample buffer (plus this header) */
-#ifdef __osf__
+
+#if defined (__alpha__) && defined (__osf__)
/*
* DEC's OSF v3.0 uses 4 bytes of padding to bring the header to
* a size that is a multiple of 8.
*/
char pad[4];
+#elif defined (BSD44_FORMAT)
+ char version[4]; /* version number */
+ char profrate[4]; /* profiling clock rate */
+ char spare[3*4]; /* reserved */
#endif
};
diff --git a/gprof/gmon_io.c b/gprof/gmon_io.c
index 82c3caa..1f0e1ac 100644
--- a/gprof/gmon_io.c
+++ b/gprof/gmon_io.c
@@ -180,9 +180,27 @@ DEFUN (gmon_out_read, (filename), const char *filename)
filename);
done (1);
}
- tmp.low_pc = get_vma (core_bfd, (bfd_byte *) & raw.low_pc[0]);
- tmp.high_pc = get_vma (core_bfd, (bfd_byte *) & raw.high_pc[0]);
- tmp.ncnt = bfd_get_32 (core_bfd, (bfd_byte *) & raw.ncnt[0]);
+ tmp.low_pc = get_vma (core_bfd, (bfd_byte *) &raw.low_pc[0]);
+ tmp.high_pc = get_vma (core_bfd, (bfd_byte *) &raw.high_pc[0]);
+ tmp.ncnt = bfd_get_32 (core_bfd, (bfd_byte *) &raw.ncnt[0]);
+
+#ifdef BSD44_FORMAT
+ {
+ int profrate;
+
+ profrate = bfd_get_32 (core_bfd, (bfd_byte *) &raw.version[0]);
+ if (!s_highpc)
+ hz = profrate;
+ else if (hz != profrate)
+ {
+ fprintf (stderr,
+ "%s: profiling rate incompatible with first gmon file\n",
+ filename);
+ done (1);
+ }
+ }
+#endif
+
if (s_highpc && (tmp.low_pc != h.low_pc ||
tmp.high_pc != h.high_pc || tmp.ncnt != h.ncnt))
{
diff --git a/gprof/gprof.c b/gprof/gprof.c
index 742f0a6..e99f2d2 100644
--- a/gprof/gprof.c
+++ b/gprof/gprof.c
@@ -69,7 +69,7 @@ bfd *abfd;
*/
static char *default_excluded_list[] =
{
- "_gprof_mcount", "mcount", "_mcount", "__mcleanup",
+ "_gprof_mcount", "mcount", "_mcount", "__mcount", "__mcleanup",
"<locore>", "<hicore>",
0
};
@@ -437,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
}