Thu Jun 4 11:34:02 1992 Mark Eichin (eichin at cygnus.com)
authorMark Eichin <eichin@cygnus>
Thu, 4 Jun 1992 18:36:56 +0000 (18:36 +0000)
committerMark Eichin <eichin@cygnus>
Thu, 4 Jun 1992 18:36:56 +0000 (18:36 +0000)
* 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.

gprof/ChangeLog [new file with mode: 0644]
gprof/gprof.c
gprof/lookup.c

diff --git a/gprof/ChangeLog b/gprof/ChangeLog
new file mode 100644 (file)
index 0000000..55d328e
--- /dev/null
@@ -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.
index ce4c4e0..88cd5b6 100644 (file)
@@ -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 ) {
index d08a162..1892101 100644 (file)
@@ -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 )