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: unassig...@sourceware.org ReportedBy: car...@google.com 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. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils