Closed Bug 444034 Opened 12 years ago Closed 12 years ago

jprof fails to sort symbols correctly

Categories

(Core :: General, defect, major)

x86
Linux
defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla1.9.1b1

People

(Reporter: jcranmer, Assigned: jcranmer)

Details

Attachments

(1 file)

While trying to do some profiling of code, I found that a startling 97.7% of time was spent in the function name "Flist." A little bit of sleuthing showed that to be the last symbol (it's not even a function) defined in the executable. Given that the profile report shows no calls in JS despite knowledge that heavy JS usage is present (as well as other relevant JS called), as well as similar statistics showing no XPCOM or NSPR or NSS code, all of which are dynamically linked.

Looking at the code tells me that it fails to resolve these, especially with this dynamic run: b7f196b7 8be585c. The former is the address, the latter the highest known address.
More fun to the puzzle:
The symbols are loaded (and so are non-function string names, but that's an easy if statement), but the array is not sorted properly:

it goes b15a5000...b7fe9654, 08048114..08be585c
And, in short, the failing code was the sort code. This code works:

static int symbolOrder(void const* a, void const* b)
{
  Symbol const* ap = (Symbol const *)a;
  Symbol const* bp = (Symbol const *)b;
  return ap->address == bp->address ? 0 :
    (ap->address > bp->address ? 1 : -1);
}
Changing the name to be representative of the error which causes this as opposed to the error which is the effect.
Summary: jprof fails to resolve symbol names in shared libraries → jprof fails to sort symbols correctly
Version: 1.9.0 Branch → Trunk
Attached patch fix the problemSplinter Review
A little tardier than I said, but here's a patch nonetheless.
Assignee: nobody → Pidgeot18
Status: NEW → ASSIGNED
Attachment #340023 - Flags: review?
Attachment #340023 - Flags: review? → review?(dbaron)
Comment on attachment 340023 [details] [diff] [review]
fix the problem

r=dbaron
Attachment #340023 - Flags: review?(dbaron) → review+
Checked in as changeset 3bfd66c81a78.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.1b1
You need to log in before you can comment on or make changes to this bug.