From 4cd016e8fd79a4e78b95e1cc843a99e01327885b Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Thu, 21 Feb 2002 07:12:57 +0000 Subject: [PATCH] Moved the definition of the machine-independent macro UNITS_TO_CODE from machine-dependent headers to the one non-header here it is used so that it is easier to fix. This macro just divides the machine-dependent offset OFFSET_OF_CODE by the machine-independent scale factor sizeof(UNIT), as required for bug for bug compatibility with the scaling of pc's in gprof.c. UNIT is the type of a profiling counter, and its size has nothing to do with the correct scale factor except both are usually 2. --- usr.bin/gprof/alpha.h | 2 +- usr.bin/gprof/amd64.h | 2 +- usr.bin/gprof/gprof.c | 2 ++ usr.bin/gprof/gprof.h | 2 ++ usr.bin/gprof/hp300.h | 2 +- usr.bin/gprof/i386.h | 2 +- usr.bin/gprof/ia64.h | 1 - usr.bin/gprof/mips.h | 2 +- usr.bin/gprof/sparc.h | 2 +- usr.bin/gprof/tahoe.h | 2 +- usr.bin/gprof/vax.h | 2 +- 11 files changed, 12 insertions(+), 9 deletions(-) diff --git a/usr.bin/gprof/alpha.h b/usr.bin/gprof/alpha.h index 067e019be34c..823d6562d105 100644 --- a/usr.bin/gprof/alpha.h +++ b/usr.bin/gprof/alpha.h @@ -31,6 +31,7 @@ * SUCH DAMAGE. * * @(#)i386.h 8.1 (Berkeley) 6/6/93 + * $FreeBSD$ */ /* @@ -38,7 +39,6 @@ * (see asgnsamples for use and explanation.) */ #define OFFSET_OF_CODE 0 -#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT)) enum opermodes { dummy }; typedef enum opermodes operandenum; diff --git a/usr.bin/gprof/amd64.h b/usr.bin/gprof/amd64.h index 067e019be34c..823d6562d105 100644 --- a/usr.bin/gprof/amd64.h +++ b/usr.bin/gprof/amd64.h @@ -31,6 +31,7 @@ * SUCH DAMAGE. * * @(#)i386.h 8.1 (Berkeley) 6/6/93 + * $FreeBSD$ */ /* @@ -38,7 +39,6 @@ * (see asgnsamples for use and explanation.) */ #define OFFSET_OF_CODE 0 -#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT)) enum opermodes { dummy }; typedef enum opermodes operandenum; diff --git a/usr.bin/gprof/gprof.c b/usr.bin/gprof/gprof.c index 79dafc7720ba..4ba5e1ebcdf0 100644 --- a/usr.bin/gprof/gprof.c +++ b/usr.bin/gprof/gprof.c @@ -48,6 +48,8 @@ static const char rcsid[] = #include #include "gprof.h" +#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT)) + static int valcmp(const void *, const void *); diff --git a/usr.bin/gprof/gprof.h b/usr.bin/gprof/gprof.h index ee0976eff44b..4d2b949402df 100644 --- a/usr.bin/gprof/gprof.h +++ b/usr.bin/gprof/gprof.h @@ -87,6 +87,8 @@ typedef int64_t UNIT; #else typedef u_short UNIT; /* unit of profiling */ #endif +#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT)) + char *a_outname; #define A_OUTNAME "a.out" diff --git a/usr.bin/gprof/hp300.h b/usr.bin/gprof/hp300.h index 15b9597c8740..37e6350b8983 100644 --- a/usr.bin/gprof/hp300.h +++ b/usr.bin/gprof/hp300.h @@ -31,6 +31,7 @@ * SUCH DAMAGE. * * @(#)hp300.h 8.1 (Berkeley) 6/6/93 + * $FreeBSD$ */ /* @@ -38,7 +39,6 @@ * (see asgnsamples for use and explanation.) */ #define OFFSET_OF_CODE 0 -#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT)) enum opermodes { dummy }; typedef enum opermodes operandenum; diff --git a/usr.bin/gprof/i386.h b/usr.bin/gprof/i386.h index 067e019be34c..823d6562d105 100644 --- a/usr.bin/gprof/i386.h +++ b/usr.bin/gprof/i386.h @@ -31,6 +31,7 @@ * SUCH DAMAGE. * * @(#)i386.h 8.1 (Berkeley) 6/6/93 + * $FreeBSD$ */ /* @@ -38,7 +39,6 @@ * (see asgnsamples for use and explanation.) */ #define OFFSET_OF_CODE 0 -#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT)) enum opermodes { dummy }; typedef enum opermodes operandenum; diff --git a/usr.bin/gprof/ia64.h b/usr.bin/gprof/ia64.h index 8e925b3e1718..823d6562d105 100644 --- a/usr.bin/gprof/ia64.h +++ b/usr.bin/gprof/ia64.h @@ -39,7 +39,6 @@ * (see asgnsamples for use and explanation.) */ #define OFFSET_OF_CODE 0 -#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT)) enum opermodes { dummy }; typedef enum opermodes operandenum; diff --git a/usr.bin/gprof/mips.h b/usr.bin/gprof/mips.h index cd67a43677ca..7a48afa57911 100644 --- a/usr.bin/gprof/mips.h +++ b/usr.bin/gprof/mips.h @@ -37,6 +37,7 @@ * @(#)mips.h 8.1 (Berkeley) 6/6/93 * * From: @(#)sparc.h 5.1 (Berkeley) 7/8/92 + * $FreeBSD$ */ /* @@ -44,7 +45,6 @@ * (see asgnsamples for use and explanation.) */ #define OFFSET_OF_CODE 0 -#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT)) enum opermodes { dummy }; typedef enum opermodes operandenum; diff --git a/usr.bin/gprof/sparc.h b/usr.bin/gprof/sparc.h index e2455eaa9f8a..856e6ad2f2cd 100644 --- a/usr.bin/gprof/sparc.h +++ b/usr.bin/gprof/sparc.h @@ -35,6 +35,7 @@ * SUCH DAMAGE. * * @(#)sparc.h 8.1 (Berkeley) 6/6/93 + * $FreeBSD$ */ /* @@ -42,7 +43,6 @@ * (see asgnsamples for use and explanation.) */ #define OFFSET_OF_CODE 0 -#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT)) enum opermodes { dummy }; typedef enum opermodes operandenum; diff --git a/usr.bin/gprof/tahoe.h b/usr.bin/gprof/tahoe.h index d82359a24002..0a639756c619 100644 --- a/usr.bin/gprof/tahoe.h +++ b/usr.bin/gprof/tahoe.h @@ -31,6 +31,7 @@ * SUCH DAMAGE. * * @(#)tahoe.h 8.1 (Berkeley) 6/6/93 + * $FreeBSD$ */ /* @@ -43,7 +44,6 @@ * (see asgnsamples for use and explanation.) */ #define OFFSET_OF_CODE 2 -#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT)) /* * register for pc relative addressing diff --git a/usr.bin/gprof/vax.h b/usr.bin/gprof/vax.h index 33c5822504bd..cb24524f2015 100644 --- a/usr.bin/gprof/vax.h +++ b/usr.bin/gprof/vax.h @@ -31,6 +31,7 @@ * SUCH DAMAGE. * * @(#)vax.h 8.1 (Berkeley) 6/6/93 + * $FreeBSD$ */ /* @@ -43,7 +44,6 @@ * (see asgnsamples for use and explanation.) */ #define OFFSET_OF_CODE 2 -#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT)) /* * register for pc relative addressing