bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gprof/13325] New: gprof doesn't work when there are histogram data


From: carrot at google dot com
Subject: [Bug gprof/13325] New: gprof doesn't work when there are histogram data before the first symbol
Date: Thu, 20 Oct 2011 02:15:38 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=13325

             Bug #: 13325
           Summary: gprof doesn't work when there are histogram data
                    before the first symbol
           Product: binutils
           Version: 2.23 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gprof
        AssignedTo: address@hidden
        ReportedBy: address@hidden
    Classification: Unclassified


In function hist.c:hist_assign_samples_1, when credit histogram data to symbols
it uses the loop

for (i = 0, j = 1; i < r->num_bins; ++i)
  {
       ...
       for (j = j - 1; j < symtab.len; ++j)
         {
           sym_low_pc = symtab.base[j].hist.scaled_addr;
           sym_high_pc = symtab.base[j + 1].hist.scaled_addr;

           /* If high end of bin is below entry address,
              go for next bin.  */
           if (bin_high_pc < sym_low_pc)
             break;
               ...
          }
  }

Usually the last histogram is belong to symtab.base[j-1], and the current
histogram may also belong to symtab.base[j-1], so the loop starts from (j-1).

Suppose we have a histogram data that isn't belong to any known symbol, and its
address is before the first symbol, when it reaches to the inner loop, j=1,
after entering the inner loop, j = 0, then exit the inner loop. When it reaches
the inner loop again, j = 0 - 1 = 4294967295, which is much larger than the
symbol table length, so the following histogram data will never hit any
symbols.

So the inner loop should never modify j if the histogram doesn't hit any
symbol.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]