Moved the definition of the machine-independent macro UNITS_TO_CODE

from <number of machines> 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.
This commit is contained in:
bde 2002-02-21 07:12:57 +00:00
parent 9fe42a4fee
commit 118c70fed9
11 changed files with 12 additions and 9 deletions

View File

@ -31,6 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)i386.h 8.1 (Berkeley) 6/6/93 * @(#)i386.h 8.1 (Berkeley) 6/6/93
* $FreeBSD$
*/ */
/* /*
@ -38,7 +39,6 @@
* (see asgnsamples for use and explanation.) * (see asgnsamples for use and explanation.)
*/ */
#define OFFSET_OF_CODE 0 #define OFFSET_OF_CODE 0
#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT))
enum opermodes { dummy }; enum opermodes { dummy };
typedef enum opermodes operandenum; typedef enum opermodes operandenum;

View File

@ -31,6 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)i386.h 8.1 (Berkeley) 6/6/93 * @(#)i386.h 8.1 (Berkeley) 6/6/93
* $FreeBSD$
*/ */
/* /*
@ -38,7 +39,6 @@
* (see asgnsamples for use and explanation.) * (see asgnsamples for use and explanation.)
*/ */
#define OFFSET_OF_CODE 0 #define OFFSET_OF_CODE 0
#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT))
enum opermodes { dummy }; enum opermodes { dummy };
typedef enum opermodes operandenum; typedef enum opermodes operandenum;

View File

@ -48,6 +48,8 @@ static const char rcsid[] =
#include <err.h> #include <err.h>
#include "gprof.h" #include "gprof.h"
#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT))
static int valcmp(const void *, const void *); static int valcmp(const void *, const void *);

View File

@ -87,6 +87,8 @@ typedef int64_t UNIT;
#else #else
typedef u_short UNIT; /* unit of profiling */ typedef u_short UNIT; /* unit of profiling */
#endif #endif
#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT))
char *a_outname; char *a_outname;
#define A_OUTNAME "a.out" #define A_OUTNAME "a.out"

View File

@ -31,6 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)hp300.h 8.1 (Berkeley) 6/6/93 * @(#)hp300.h 8.1 (Berkeley) 6/6/93
* $FreeBSD$
*/ */
/* /*
@ -38,7 +39,6 @@
* (see asgnsamples for use and explanation.) * (see asgnsamples for use and explanation.)
*/ */
#define OFFSET_OF_CODE 0 #define OFFSET_OF_CODE 0
#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT))
enum opermodes { dummy }; enum opermodes { dummy };
typedef enum opermodes operandenum; typedef enum opermodes operandenum;

View File

@ -31,6 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)i386.h 8.1 (Berkeley) 6/6/93 * @(#)i386.h 8.1 (Berkeley) 6/6/93
* $FreeBSD$
*/ */
/* /*
@ -38,7 +39,6 @@
* (see asgnsamples for use and explanation.) * (see asgnsamples for use and explanation.)
*/ */
#define OFFSET_OF_CODE 0 #define OFFSET_OF_CODE 0
#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT))
enum opermodes { dummy }; enum opermodes { dummy };
typedef enum opermodes operandenum; typedef enum opermodes operandenum;

View File

@ -39,7 +39,6 @@
* (see asgnsamples for use and explanation.) * (see asgnsamples for use and explanation.)
*/ */
#define OFFSET_OF_CODE 0 #define OFFSET_OF_CODE 0
#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT))
enum opermodes { dummy }; enum opermodes { dummy };
typedef enum opermodes operandenum; typedef enum opermodes operandenum;

View File

@ -37,6 +37,7 @@
* @(#)mips.h 8.1 (Berkeley) 6/6/93 * @(#)mips.h 8.1 (Berkeley) 6/6/93
* *
* From: @(#)sparc.h 5.1 (Berkeley) 7/8/92 * From: @(#)sparc.h 5.1 (Berkeley) 7/8/92
* $FreeBSD$
*/ */
/* /*
@ -44,7 +45,6 @@
* (see asgnsamples for use and explanation.) * (see asgnsamples for use and explanation.)
*/ */
#define OFFSET_OF_CODE 0 #define OFFSET_OF_CODE 0
#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT))
enum opermodes { dummy }; enum opermodes { dummy };
typedef enum opermodes operandenum; typedef enum opermodes operandenum;

View File

@ -35,6 +35,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)sparc.h 8.1 (Berkeley) 6/6/93 * @(#)sparc.h 8.1 (Berkeley) 6/6/93
* $FreeBSD$
*/ */
/* /*
@ -42,7 +43,6 @@
* (see asgnsamples for use and explanation.) * (see asgnsamples for use and explanation.)
*/ */
#define OFFSET_OF_CODE 0 #define OFFSET_OF_CODE 0
#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT))
enum opermodes { dummy }; enum opermodes { dummy };
typedef enum opermodes operandenum; typedef enum opermodes operandenum;

View File

@ -31,6 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)tahoe.h 8.1 (Berkeley) 6/6/93 * @(#)tahoe.h 8.1 (Berkeley) 6/6/93
* $FreeBSD$
*/ */
/* /*
@ -43,7 +44,6 @@
* (see asgnsamples for use and explanation.) * (see asgnsamples for use and explanation.)
*/ */
#define OFFSET_OF_CODE 2 #define OFFSET_OF_CODE 2
#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT))
/* /*
* register for pc relative addressing * register for pc relative addressing

View File

@ -31,6 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)vax.h 8.1 (Berkeley) 6/6/93 * @(#)vax.h 8.1 (Berkeley) 6/6/93
* $FreeBSD$
*/ */
/* /*
@ -43,7 +44,6 @@
* (see asgnsamples for use and explanation.) * (see asgnsamples for use and explanation.)
*/ */
#define OFFSET_OF_CODE 2 #define OFFSET_OF_CODE 2
#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT))
/* /*
* register for pc relative addressing * register for pc relative addressing