From: Mark Eichin Date: Thu, 4 Jun 1992 18:36:56 +0000 (+0000) Subject: Thu Jun 4 11:34:02 1992 Mark Eichin (eichin at cygnus.com) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ba79f5fa08a04f1dea43cd8b750125e2ff49fce0;p=binutils-gdb.git Thu Jun 4 11:34:02 1992 Mark Eichin (eichin at cygnus.com) * lookup.c: fixed fencepost in nllookup and added dbg_nllookup for help in debugging the problem (with -DDEBUG) * gprof.c: symbol values are now real values, don't add the vma anymore. (done for solaris; should verify this on other platforms) * ChangeLog: created. --- diff --git a/gprof/ChangeLog b/gprof/ChangeLog new file mode 100644 index 00000000000..55d328eef9b --- /dev/null +++ b/gprof/ChangeLog @@ -0,0 +1,7 @@ +Thu Jun 4 11:34:02 1992 Mark Eichin (eichin at cygnus.com) + + * lookup.c: fixed fencepost in nllookup and added dbg_nllookup for + help in debugging the problem (with -DDEBUG) + * gprof.c: symbol values are now real values, don't add the vma + anymore. (done for solaris; should verify this on other platforms) + * ChangeLog: created. diff --git a/gprof/gprof.c b/gprof/gprof.c index ce4c4e0f338..88cd5b6489c 100644 --- a/gprof/gprof.c +++ b/gprof/gprof.c @@ -265,7 +265,11 @@ bfd *abfd; # endif DEBUG continue; } +#if 0 npe->value = syms[i]->value + syms[i]->section->vma; +#else + npe->value = syms[i]->value; +#endif npe->name = syms[i]->name; # ifdef DEBUG if ( debug & AOUTDEBUG ) { diff --git a/gprof/lookup.c b/gprof/lookup.c index d08a162f9e7..1892101f0ac 100644 --- a/gprof/lookup.c +++ b/gprof/lookup.c @@ -28,6 +28,10 @@ static char sccsid[] = "@(#)lookup.c 5.4 (Berkeley) 6/1/90"; * this deals with misses by mapping them to the next lower * entry point. */ +#ifdef DEBUG +nltype *dbg_nllookup(); +#endif + nltype * nllookup( address ) unsigned long address; @@ -59,9 +63,49 @@ nllookup( address ) low = middle + 1; } } + if(nl[middle+1].value == address) { +# ifdef DEBUG + if (debug & LOOKUPDEBUG ) { + printf("[nllookup] %d (%d) probes, fall off\n", probes, nname-1); + } +# endif + return &nl[middle]; + } + fprintf( stderr , "[nllookup] binary search fails???\n" ); +#ifdef DEBUG + dbg_nllookup(address); +#endif + return 0; +} + +#ifdef DEBUG +nltype * +dbg_nllookup( address ) + unsigned long address; +{ + register long low; + register long middle; + register long high; + fprintf(stderr,"[nllookup] address 0x%x\n",address); + + for ( low = 0 , high = nname - 1 ; low != high ; ) { + + middle = ( high + low ) >> 1; + fprintf(stderr, "[nllookup] low 0x%x middle 0x%x high 0x%x nl[m] 0x%x nl[m+1] 0x%x\n", + low,middle,high,nl[middle].value,nl[middle+1].value); + if ( nl[ middle ].value <= address && nl[ middle+1 ].value > address) { + return &nl[ middle ]; + } + if ( nl[ middle ].value > address ) { + high = middle; + } else { + low = middle + 1; + } + } fprintf( stderr , "[nllookup] binary search fails???\n" ); return 0; } +#endif DEBUG arctype * arclookup( parentp , childp )