diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2004-07-20 08:46:24 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2004-07-20 08:46:24 +0000 |
commit | 050bfd576afb6c92b3b63992f51ce0d8562c551f (patch) | |
tree | 0ce4ae59d265cb48be6bebeec098d0b203fa8630 | |
parent | 56bc93eecd71c5407efe6f1f58cfab5db54b04df (diff) |
Fix formats in debug printfs to work correctly on 64-bit archs.
miod@ ok
-rw-r--r-- | usr.bin/gprof/arcs.c | 22 | ||||
-rw-r--r-- | usr.bin/gprof/gprof.c | 26 | ||||
-rw-r--r-- | usr.bin/gprof/printgprof.c | 8 |
3 files changed, 29 insertions, 27 deletions
diff --git a/usr.bin/gprof/arcs.c b/usr.bin/gprof/arcs.c index 3a7998c91ed..02d3713bcef 100644 --- a/usr.bin/gprof/arcs.c +++ b/usr.bin/gprof/arcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arcs.c,v 1.7 2003/06/03 02:56:08 millert Exp $ */ +/* $OpenBSD: arcs.c,v 1.8 2004/07/20 08:46:23 art Exp $ */ /* $NetBSD: arcs.c,v 1.6 1995/04/19 07:15:52 cgd Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)arcs.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: arcs.c,v 1.7 2003/06/03 02:56:08 millert Exp $"; +static char rcsid[] = "$OpenBSD: arcs.c,v 1.8 2004/07/20 08:46:23 art Exp $"; #endif #endif /* not lint */ @@ -45,6 +45,7 @@ int visited; int viable; int newcycle; int oldcycle; +void printsubcycle(cltype *); #endif /* DEBUG */ /* @@ -60,7 +61,7 @@ addarc( parentp , childp , count ) # ifdef DEBUG if ( debug & TALLYDEBUG ) { - printf( "[addarc] %d arcs from %s to %s\n" , + printf( "[addarc] %ld arcs from %s to %s\n" , count , parentp -> name , childp -> name ); } # endif /* DEBUG */ @@ -71,7 +72,7 @@ addarc( parentp , childp , count ) */ # ifdef DEBUG if ( debug & TALLYDEBUG ) { - printf( "[tally] hit %d += %d\n" , + printf( "[tally] hit %ld += %ld\n" , arcp -> arc_count , count ); } # endif /* DEBUG */ @@ -173,7 +174,7 @@ doarcs() */ # ifdef DEBUG if ( debug & BREAKCYCLE ) { - printf("[doarcs] pass %d, cycle(s) %d\n" , pass , ncycle ); + printf("[doarcs] pass %ld, cycle(s) %d\n" , pass , ncycle ); } # endif /* DEBUG */ if ( pass == 1 ) { @@ -341,7 +342,7 @@ timepropagate( parentp ) if ( debug & PROPDEBUG ) { printf( "[dotime] child \t" ); printname( childp ); - printf( " with %f %f %d/%d\n" , + printf( " with %f %f %ld/%ld\n" , childp -> time , childp -> childtime , arcp -> arc_count , childp -> npropcall ); printf( "[dotime] parent\t" ); @@ -379,7 +380,7 @@ cyclelink() */ cyclenl = (nltype *) calloc( ncycle + 1 , sizeof( nltype ) ); if ( cyclenl == 0 ) - errx(0, "No room for %d bytes of cycle headers", + errx(0, "No room for %ld bytes of cycle headers", (ncycle + 1) * sizeof(nltype)); /* * now link cycles to true cycleheads, @@ -482,7 +483,7 @@ cycleanalyze() done = FALSE; cyclestack = (arctype **) calloc( size + 1 , sizeof( arctype *) ); if ( cyclestack == 0 ) { - warnx("No room for %d bytes of cycle stack" , + warnx("No room for %ld bytes of cycle stack" , (size + 1) * sizeof(arctype *)); return (done); } @@ -602,7 +603,7 @@ addcycle( stkstart , stkend ) clp = (cltype *) calloc( 1 , sizeof ( cltype ) + ( size - 1 ) * sizeof( arctype * ) ); if ( clp == 0 ) { - warnx("No room for %d bytes of subcycle storage" , + warnx("No room for %ld bytes of subcycle storage" , sizeof(cltype) + (size - 1) * sizeof(arctype *)); return( FALSE ); } @@ -750,6 +751,7 @@ compresslist() } #ifdef DEBUG +void printsubcycle( clp ) cltype *clp; { @@ -760,7 +762,7 @@ printsubcycle( clp ) printf( "%s <cycle %d>\n" , (*arcpp) -> arc_parentp -> name , (*arcpp) -> arc_parentp -> cycleno ) ; for ( endlist = &clp -> list[ clp -> size ]; arcpp < endlist ; arcpp++ ) - printf( "\t(%d) -> %s\n" , (*arcpp) -> arc_count , + printf( "\t(%ld) -> %s\n" , (*arcpp) -> arc_count , (*arcpp) -> arc_childp -> name ) ; } #endif /* DEBUG */ diff --git a/usr.bin/gprof/gprof.c b/usr.bin/gprof/gprof.c index 1b9f564a0c6..23765929c1f 100644 --- a/usr.bin/gprof/gprof.c +++ b/usr.bin/gprof/gprof.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gprof.c,v 1.13 2003/06/10 22:20:47 deraadt Exp $ */ +/* $OpenBSD: gprof.c,v 1.14 2004/07/20 08:46:23 art Exp $ */ /* $NetBSD: gprof.c,v 1.8 1995/04/19 07:15:59 cgd Exp $ */ /* @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)gprof.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: gprof.c,v 1.13 2003/06/10 22:20:47 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: gprof.c,v 1.14 2004/07/20 08:46:23 art Exp $"; #endif #endif /* not lint */ @@ -228,7 +228,7 @@ getpfile(char *filename) while ( fread( &arc , sizeof arc , 1 , pfile ) == 1 ) { # ifdef DEBUG if ( debug & SAMPLEDEBUG ) { - printf( "[getpfile] frompc 0x%x selfpc 0x%x count %d\n" , + printf( "[getpfile] frompc 0x%lx selfpc 0x%lx count %ld\n" , arc.raw_frompc , arc.raw_selfpc , arc.raw_count ); } # endif /* DEBUG */ @@ -277,15 +277,15 @@ openpfile(char *filename) nsamples = sampbytes / sizeof (UNIT); # ifdef DEBUG if ( debug & SAMPLEDEBUG ) { - printf( "[openpfile] hdr.lpc 0x%x hdr.hpc 0x%x hdr.ncnt %d\n", + printf( "[openpfile] hdr.lpc 0x%lx hdr.hpc 0x%lx hdr.ncnt %d\n", gmonhdr.lpc , gmonhdr.hpc , gmonhdr.ncnt ); - printf( "[openpfile] s_lowpc 0x%x s_highpc 0x%x\n" , + printf( "[openpfile] s_lowpc 0x%lx s_highpc 0x%lx\n" , s_lowpc , s_highpc ); - printf( "[openpfile] lowpc 0x%x highpc 0x%x\n" , + printf( "[openpfile] lowpc 0x%lx highpc 0x%lx\n" , lowpc , highpc ); printf( "[openpfile] sampbytes %d nsamples %d\n" , sampbytes , nsamples ); - printf( "[openpfile] sample rate %d\n" , hz ); + printf( "[openpfile] sample rate %ld\n" , hz ); } # endif /* DEBUG */ return(pfile); @@ -309,7 +309,7 @@ tally(struct rawarc *rawp) childp -> ncall += rawp -> raw_count; # ifdef DEBUG if ( debug & TALLYDEBUG ) { - printf( "[tally] arc from %s to %s traversed %d times\n" , + printf( "[tally] arc from %s to %s traversed %ld times\n" , parentp -> name , childp -> name , rawp -> raw_count ); } # endif /* DEBUG */ @@ -351,7 +351,7 @@ dumpsum(char *sumfile) err(1, "fwrite: %s", sumfile); # ifdef DEBUG if ( debug & SAMPLEDEBUG ) { - printf( "[dumpsum] frompc 0x%x selfpc 0x%x count %d\n" , + printf( "[dumpsum] frompc 0x%lx selfpc 0x%lx count %ld\n" , arc.raw_frompc , arc.raw_selfpc , arc.raw_count ); } # endif /* DEBUG */ @@ -384,7 +384,7 @@ readsamples(FILE *pfile) if (samples == 0) { samples = (UNIT *) calloc(sampbytes, sizeof (UNIT)); if (samples == 0) - errx(1, "No room for %d sample pc's", sampbytes / sizeof (UNIT)); + errx(1, "No room for %ld sample pc's", sampbytes / sizeof (UNIT)); } for (i = 0; i < nsamples; i++) { fread(&sample, sizeof (UNIT), 1, pfile); @@ -452,7 +452,7 @@ asgnsamples(void) time = ccnt; # ifdef DEBUG if ( debug & SAMPLEDEBUG ) { - printf( "[asgnsamples] pcl 0x%x pch 0x%x ccnt %d\n" , + printf( "[asgnsamples] pcl 0x%lx pch 0x%lx ccnt %d\n" , pcl , pch , ccnt ); } # endif /* DEBUG */ @@ -476,7 +476,7 @@ asgnsamples(void) if (overlap > 0) { # ifdef DEBUG if (debug & SAMPLEDEBUG) { - printf("[asgnsamples] (0x%x->0x%x-0x%x) %s gets %f ticks %d overlap\n", + printf("[asgnsamples] (0x%lx->0x%lx-0x%lx) %s gets %f ticks %ld overlap\n", nl[j].value/sizeof(UNIT), svalue0, svalue1, nl[j].name, overlap * time / scale, overlap); @@ -530,7 +530,7 @@ alignentries(void) if (bucket_of_entry < bucket_of_code) { # ifdef DEBUG if (debug & SAMPLEDEBUG) { - printf("[alignentries] pushing svalue 0x%x to 0x%x\n", + printf("[alignentries] pushing svalue 0x%lx to 0x%lx\n", nlp->svalue, nlp->svalue + UNITS_TO_CODE); } # endif /* DEBUG */ diff --git a/usr.bin/gprof/printgprof.c b/usr.bin/gprof/printgprof.c index d6114ee7e18..df5439641af 100644 --- a/usr.bin/gprof/printgprof.c +++ b/usr.bin/gprof/printgprof.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printgprof.c,v 1.9 2003/07/10 00:06:51 david Exp $ */ +/* $OpenBSD: printgprof.c,v 1.10 2004/07/20 08:46:23 art Exp $ */ /* $NetBSD: printgprof.c,v 1.5 1995/04/19 07:16:21 cgd Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)printgprof.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: printgprof.c,v 1.9 2003/07/10 00:06:51 david Exp $"; +static char rcsid[] = "$OpenBSD: printgprof.c,v 1.10 2004/07/20 08:46:23 art Exp $"; #endif #endif /* not lint */ @@ -587,14 +587,14 @@ arccmp( thisp , thatp ) printname( thisparentp ); printf( " calls " ); printname ( thischildp ); - printf( " %f + %f %d/%d\n" , + printf( " %f + %f %ld/%ld\n" , thisp -> arc_time , thisp -> arc_childtime , thisp -> arc_count , thischildp -> ncall ); printf( "[arccmp] " ); printname( thatparentp ); printf( " calls " ); printname( thatchildp ); - printf( " %f + %f %d/%d\n" , + printf( " %f + %f %ld/%ld\n" , thatp -> arc_time , thatp -> arc_childtime , thatp -> arc_count , thatchildp -> ncall ); printf( "\n" ); |