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.
This commit is contained in:
Ian Lance Taylor 1996-03-21 22:07:14 +00:00
parent 9e4ebb1b3a
commit 0f579087ab
6 changed files with 65 additions and 12 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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)

View File

@ -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
};

View File

@ -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))
{

View File

@ -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
}