🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #256

gprof bug

#256
From: Roeber
Date: Mon, 10 Aug 1992 11:52
37 lines
1751 bytes
The top line of the Changelog file is:

Thu Jun 28 17:03:51 1990  Mike Haertel  (mike at ducky)

In reusing some of the gprof code for another program, I came across the
fact that the binary search routine that gprof uses in the val_to_sym function
contains an error such that it can stop the search on the symbol before
the correct one for the case where a pc value exactly matches a symbol
address.  To fix it I made the following change in the val_to_sym function
in the gprof.c file:

    struct mesym *m;
    int gap=nsym/4;
     
    m= &syms[nsym/2];
    for (;;) {
      if (m->value>val) {
        m-=gap;
        gap/=2;
+     } else if ((m + 1)->value == val)
+     {
+       return(m+1);
      } else if ((m+1)->value<val) {
        m+=gap;
        gap/=2;

While this is not a critical problem, it can result in the assignment of
time values to the wrong routines in some cases and should therefor be
fixed.     Fred

    _______________________________________________________
   |  Fred J Roeber,  Raytheon Submarine Signal Division   |
   |  1847 West Main Road,  Mail Stop 188                  |
   |  Portsmouth, RI  02871-1087  (401) 847-8000 (X4205)   |
   |                                                       |
   |                   fjr@ssd.ray.com                     |
   |_______________________________________________________|
Technical Details
Message-ID: <199208101952.AA08786@pike.ssd.ray.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!ssd.ray.COM!fjr

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!ssd.ray.COM!fjr
From: fjr@ssd.ray.COM (Roeber)
Subject: gprof bug
Message-ID: <199208101952.AA08786@pike.ssd.ray.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 10 Aug 1992 11:52:18 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 39