diff options
author | Mark Eichin <eichin@cygnus> | 1992-06-04 18:36:56 +0000 |
---|---|---|
committer | Mark Eichin <eichin@cygnus> | 1992-06-04 18:36:56 +0000 |
commit | ba79f5fa08a04f1dea43cd8b750125e2ff49fce0 (patch) | |
tree | 7dea4912a29877f1c12280bde89625b46f2febb1 /gprof | |
parent | f0e9ba1e6317d118af28ab75a2f8be30bc47071c (diff) | |
download | gdb-ba79f5fa08a04f1dea43cd8b750125e2ff49fce0.zip gdb-ba79f5fa08a04f1dea43cd8b750125e2ff49fce0.tar.gz gdb-ba79f5fa08a04f1dea43cd8b750125e2ff49fce0.tar.bz2 |
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.
Diffstat (limited to 'gprof')
-rw-r--r-- | gprof/ChangeLog | 7 | ||||
-rw-r--r-- | gprof/gprof.c | 4 | ||||
-rw-r--r-- | gprof/lookup.c | 44 |
3 files changed, 55 insertions, 0 deletions
diff --git a/gprof/ChangeLog b/gprof/ChangeLog new file mode 100644 index 0000000..55d328e --- /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 ce4c4e0..88cd5b6 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 d08a162..1892101 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 ) |