Fix preprocessor directive syntax (text after #endif).
The style of this program is still atrocious (not fixed).
This commit is contained in:
parent
1116ad074f
commit
0e6b4b2400
@ -92,7 +92,7 @@ aout_getnfile(const char *filename, char ***defaultEs)
|
||||
printf("[getnfile] 0X%08lx\t%s\n", nl[j].value, nl[j].name);
|
||||
}
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
*defaultEs = excludes;
|
||||
return 0;
|
||||
}
|
||||
@ -160,7 +160,7 @@ getsymtab(FILE *nfile, const char *filename)
|
||||
printf( "[getsymtab] rejecting: 0x%x %s\n" ,
|
||||
nbuf.n_type , strtab + nbuf.n_un.n_strx );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
continue;
|
||||
}
|
||||
npe->value = nbuf.n_value;
|
||||
@ -170,7 +170,7 @@ getsymtab(FILE *nfile, const char *filename)
|
||||
printf( "[getsymtab] %d %s 0x%08lx\n" ,
|
||||
nname , npe -> name , npe -> value );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
npe++;
|
||||
nname++;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ int visited;
|
||||
int viable;
|
||||
int newcycle;
|
||||
int oldcycle;
|
||||
#endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* add (or just increment) an arc
|
||||
@ -64,7 +64,7 @@ addarc( parentp , childp , count )
|
||||
printf( "[addarc] %ld arcs from %s to %s\n" ,
|
||||
count , parentp -> name , childp -> name );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
arcp = arclookup( parentp , childp );
|
||||
if ( arcp != 0 ) {
|
||||
/*
|
||||
@ -75,7 +75,7 @@ addarc( parentp , childp , count )
|
||||
printf( "[tally] hit %ld += %ld\n" ,
|
||||
arcp -> arc_count , count );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
arcp -> arc_count += count;
|
||||
return;
|
||||
}
|
||||
@ -175,7 +175,7 @@ doarcs()
|
||||
if ( debug & BREAKCYCLE ) {
|
||||
printf("[doarcs] pass %ld, cycle(s) %d\n" , pass , ncycle );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
if ( pass == 1 ) {
|
||||
printf( "\n\n%s %s\n%s %d:\n" ,
|
||||
"The following arcs were deleted" ,
|
||||
@ -219,7 +219,7 @@ doarcs()
|
||||
printf( "\n" );
|
||||
}
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
/*
|
||||
* starting from the topological top,
|
||||
* propagate print flags to children.
|
||||
@ -349,7 +349,7 @@ timepropagate( parentp )
|
||||
printname( parentp );
|
||||
printf( "\n[dotime] share %f\n" , share );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
}
|
||||
}
|
||||
|
||||
@ -417,7 +417,7 @@ cyclelink()
|
||||
printname( nlp );
|
||||
printf( " is the head of cycle %d\n" , cycle );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
/*
|
||||
* link members to cycle header
|
||||
*/
|
||||
@ -492,7 +492,7 @@ cycleanalyze()
|
||||
printf( "[cycleanalyze] starting cycle %d of %d, size %d\n" ,
|
||||
cycleno , ncycle , size );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
for ( nlp = cyclenl[ cycleno ] . cnext ; nlp ; nlp = nlp -> cnext ) {
|
||||
stkp = &cyclestack[0];
|
||||
nlp -> flags |= CYCLEHEAD;
|
||||
@ -520,7 +520,7 @@ cycleanalyze()
|
||||
printf("%s visited %d, viable %d, newcycle %d, oldcycle %d\n",
|
||||
"[doarcs]" , visited , viable , newcycle , oldcycle);
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
return( done );
|
||||
}
|
||||
|
||||
@ -535,14 +535,14 @@ descend( node , stkstart , stkp )
|
||||
for ( arcp = node -> children ; arcp ; arcp = arcp -> arc_childlist ) {
|
||||
# ifdef DEBUG
|
||||
visited++;
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
if ( arcp -> arc_childp -> cycleno != node -> cycleno
|
||||
|| ( arcp -> arc_childp -> flags & VISITED )
|
||||
|| ( arcp -> arc_flags & DEADARC ) )
|
||||
continue;
|
||||
# ifdef DEBUG
|
||||
viable++;
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
*stkp = arcp;
|
||||
if ( arcp -> arc_childp -> flags & CYCLEHEAD ) {
|
||||
if ( addcycle( stkstart , stkp ) == FALSE )
|
||||
@ -593,7 +593,7 @@ addcycle( stkstart , stkend )
|
||||
if ( arcpp == endlist ) {
|
||||
# ifdef DEBUG
|
||||
oldcycle++;
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
return( TRUE );
|
||||
}
|
||||
}
|
||||
@ -625,7 +625,7 @@ addcycle( stkstart , stkend )
|
||||
if ( debug & SUBCYCLELIST ) {
|
||||
printsubcycle( clp );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
cyclecnt++;
|
||||
if ( cyclecnt >= CYCLEMAX )
|
||||
return( FALSE );
|
||||
@ -648,7 +648,7 @@ compresslist()
|
||||
int maxnoparentcnt;
|
||||
# ifdef DEBUG
|
||||
const char *type;
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
|
||||
maxexitcnt = 0;
|
||||
maxwithparentcnt = 0;
|
||||
@ -693,7 +693,7 @@ compresslist()
|
||||
maxarcp = maxexitarcp;
|
||||
# ifdef DEBUG
|
||||
type = "exit";
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
} else if ( maxwithparentcnt > 0 ) {
|
||||
/*
|
||||
* second choice is edge leading to node with at least one
|
||||
@ -702,7 +702,7 @@ compresslist()
|
||||
maxarcp = maxwithparentarcp;
|
||||
# ifdef DEBUG
|
||||
type = "internal";
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
} else {
|
||||
/*
|
||||
* last choice is edge leading to node with only this arc as
|
||||
@ -711,7 +711,7 @@ compresslist()
|
||||
maxarcp = maxnoparentarcp;
|
||||
# ifdef DEBUG
|
||||
type = "orphan";
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
}
|
||||
maxarcp -> arc_flags |= DEADARC;
|
||||
maxarcp -> arc_childp -> parentcnt -= 1;
|
||||
@ -723,7 +723,7 @@ compresslist()
|
||||
maxarcp -> arc_count , maxarcp -> arc_childp -> name ,
|
||||
maxarcp -> arc_cyclecnt );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
printf( "\t%s to %s with %ld calls\n" , maxarcp -> arc_parentp -> name ,
|
||||
maxarcp -> arc_childp -> name , maxarcp -> arc_count );
|
||||
prev = &cyclehead;
|
||||
@ -760,7 +760,7 @@ printsubcycle( clp )
|
||||
printf( "\t(%ld) -> %s\n" , (*arcpp) -> arc_count ,
|
||||
(*arcpp) -> arc_childp -> name ) ;
|
||||
}
|
||||
#endif DEBUG
|
||||
#endif /* DEBUG */
|
||||
|
||||
cycletime()
|
||||
{
|
||||
@ -818,7 +818,7 @@ doflags()
|
||||
printf( " inherits printflag %d and propfraction %f\n" ,
|
||||
childp -> printflag , childp -> propfraction );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
if ( ! childp -> printflag ) {
|
||||
/*
|
||||
* printflag is off
|
||||
@ -874,7 +874,7 @@ doflags()
|
||||
printf( "time %f propself %f printtime %f\n" ,
|
||||
childp -> time , childp -> propself , printtime );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,11 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dfn.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
@ -71,7 +75,7 @@ dfn( parentp )
|
||||
printname( parentp );
|
||||
printf( ")\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
/*
|
||||
* if we're already numbered, no need to look any furthur.
|
||||
*/
|
||||
@ -124,7 +128,7 @@ dfn_pre_visit( parentp )
|
||||
printname( parentp );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -184,7 +188,7 @@ dfn_findcycle( childp )
|
||||
printname( cycleheadp );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
if ( cycletop == dfn_depth ) {
|
||||
/*
|
||||
* this is previous function, e.g. this calls itself
|
||||
@ -206,7 +210,7 @@ dfn_findcycle( childp )
|
||||
printname( tailp );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
}
|
||||
/*
|
||||
* if what we think is the top of the cycle
|
||||
@ -221,7 +225,7 @@ dfn_findcycle( childp )
|
||||
printname( cycleheadp );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
}
|
||||
for ( index = cycletop + 1 ; index <= dfn_depth ; index += 1 ) {
|
||||
childp = dfn_stack[ index ].nlentryp;
|
||||
@ -240,7 +244,7 @@ dfn_findcycle( childp )
|
||||
printname( cycleheadp );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
for ( tailp = childp ; tailp->cnext ; tailp = tailp->cnext ) {
|
||||
tailp -> cnext -> cyclehead = cycleheadp;
|
||||
# ifdef DEBUG
|
||||
@ -251,7 +255,7 @@ dfn_findcycle( childp )
|
||||
printname( cycleheadp );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
}
|
||||
} else if ( childp -> cyclehead != cycleheadp /* firewall */ ) {
|
||||
fprintf( stderr ,
|
||||
@ -278,7 +282,7 @@ dfn_self_cycle( parentp )
|
||||
printname( parentp );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -297,7 +301,7 @@ dfn_post_visit( parentp )
|
||||
printname( parentp );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
/*
|
||||
* number functions and things in their cycles
|
||||
* unless the function is itself part of a cycle
|
||||
@ -312,14 +316,14 @@ dfn_post_visit( parentp )
|
||||
printname( memberp );
|
||||
printf( " -> toporder = %d\n" , dfn_counter );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
}
|
||||
} else {
|
||||
# ifdef DEBUG
|
||||
if ( debug & DFNDEBUG ) {
|
||||
printf( "[dfn_post_visit]\t\tis part of a cycle\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
}
|
||||
dfn_depth -= 1;
|
||||
}
|
||||
|
@ -96,9 +96,9 @@ main(argc, argv)
|
||||
debug |= ANYDEBUG;
|
||||
# ifdef DEBUG
|
||||
printf("[main] debug = %d\n", debug);
|
||||
# else not DEBUG
|
||||
# else /* not DEBUG */
|
||||
printf("gprof: -d ignored\n");
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
break;
|
||||
case 'E':
|
||||
++argv;
|
||||
@ -258,7 +258,7 @@ getpfile(filename)
|
||||
printf( "[getpfile] frompc 0x%lx selfpc 0x%lx count %ld\n" ,
|
||||
arc.raw_frompc , arc.raw_selfpc , arc.raw_count );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
/*
|
||||
* add this arc
|
||||
*/
|
||||
@ -330,7 +330,7 @@ openpfile(filename)
|
||||
sampbytes , nsamples );
|
||||
printf( "[openpfile] sample rate %ld\n" , hz );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
return(pfile);
|
||||
}
|
||||
|
||||
@ -355,7 +355,7 @@ tally( rawp )
|
||||
printf( "[tally] arc from %s to %s traversed %ld times\n" ,
|
||||
parentp -> name , childp -> name , rawp -> raw_count );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
addarc( parentp , childp , rawp -> raw_count );
|
||||
}
|
||||
|
||||
@ -405,7 +405,7 @@ dumpsum( sumfile )
|
||||
printf( "[dumpsum] frompc 0x%lx selfpc 0x%lx count %ld\n" ,
|
||||
arc.raw_frompc , arc.raw_selfpc , arc.raw_count );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
}
|
||||
}
|
||||
fclose( sfile );
|
||||
@ -538,7 +538,7 @@ asgnsamples()
|
||||
printf( "[asgnsamples] pcl 0x%lx pch 0x%lx ccnt %.0f\n" ,
|
||||
pcl , pch , ccnt );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
totime += time;
|
||||
for (j = j - 1; j < nname; j++) {
|
||||
svalue0 = nl[j].svalue;
|
||||
@ -564,7 +564,7 @@ asgnsamples()
|
||||
svalue0, svalue1, nl[j].name,
|
||||
overlap * time / scale, overlap);
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
nl[j].time += overlap * time / scale;
|
||||
}
|
||||
}
|
||||
@ -573,7 +573,7 @@ asgnsamples()
|
||||
if (debug & SAMPLEDEBUG) {
|
||||
printf("[asgnsamples] totime %f\n", totime);
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
}
|
||||
|
||||
|
||||
@ -619,7 +619,7 @@ alignentries()
|
||||
nlp->svalue,
|
||||
nlp->svalue + OFFSET_OF_CODE / HISTORICAL_SCALE_2);
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
nlp->svalue += OFFSET_OF_CODE / HISTORICAL_SCALE_2;
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,11 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lookup.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "gprof.h"
|
||||
@ -53,18 +57,18 @@ nllookup( address )
|
||||
register int probes;
|
||||
|
||||
probes = 0;
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
for ( low = 0 , high = nname - 1 ; low != high ; ) {
|
||||
# ifdef DEBUG
|
||||
probes += 1;
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
middle = ( high + low ) >> 1;
|
||||
if ( nl[ middle ].value <= address && nl[ middle+1 ].value > address ) {
|
||||
# ifdef DEBUG
|
||||
if ( debug & LOOKUPDEBUG ) {
|
||||
printf( "[nllookup] %d (%d) probes\n" , probes , nname-1 );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
return &nl[ middle ];
|
||||
}
|
||||
if ( nl[ middle ].value > address ) {
|
||||
@ -78,7 +82,7 @@ nllookup( address )
|
||||
fprintf( stderr , "[nllookup] (%d) binary search fails\n" ,
|
||||
nname-1 );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -98,7 +102,7 @@ arclookup( parentp , childp )
|
||||
printf( "[arclookup] parent %s child %s\n" ,
|
||||
parentp -> name , childp -> name );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
for ( arcp = parentp -> children ; arcp ; arcp = arcp -> arc_childlist ) {
|
||||
# ifdef DEBUG
|
||||
if ( debug & LOOKUPDEBUG ) {
|
||||
@ -106,7 +110,7 @@ arclookup( parentp , childp )
|
||||
arcp -> arc_parentp -> name ,
|
||||
arcp -> arc_childp -> name );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
if ( arcp -> arc_childp == childp ) {
|
||||
return arcp;
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ printname( selfp )
|
||||
if ( debug & PROPDEBUG ) {
|
||||
printf( "%5.2f%% " , selfp -> propfraction );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
}
|
||||
if ( selfp -> cycleno != 0 ) {
|
||||
printf( " <cycle %d>" , selfp -> cycleno );
|
||||
@ -617,7 +617,7 @@ arccmp( thisp , thatp )
|
||||
thatp -> arc_count , thatchildp -> ncall );
|
||||
printf( "\n" );
|
||||
}
|
||||
# endif DEBUG
|
||||
# endif /* DEBUG */
|
||||
if ( thisparentp == thischildp ) {
|
||||
/* this is a self call */
|
||||
return LESSTHAN;
|
||||
|
Loading…
x
Reference in New Issue
Block a user