Closed Bug 1362277 Opened 7 years ago Closed 2 years ago

Shared library list does not contain an entry for dyld itself

Categories

(Core :: Gecko Profiler, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
97 Branch
Tracking Status
firefox97 --- fixed

People

(Reporter: mstange, Assigned: mstange)

Details

Attachments

(2 files)

Look at the profile from bug 1341913 comment 0, for example: The functions called from dlsym don't have any symbols because we can't associate their addresses with any shared library. That's because they're from dyld itself, which doesn't show up as its own entry in the infoArray in dyld_all_image_infos.

Judging from the code in GDB and in breakpad that look up the load address and the file path of the dyld image, retrieving this information was really tricky in past versions of macOS. Fortunately, the dyld_all_image_infos has grown two new properties recently that make this a lot easier: 10.6 added dyldImageLoadAddress and 10.12 added dyldPath.

I have a patch that uses those properties to add an entry for dyld when we run on 10.12. It's probably not worth worrying about older versions.
Comment on attachment 8864731 [details]
Bug 1362277 - Add dyld to the SharedLibraryInformation list.

https://reviewboard.mozilla.org/r/136384/#review142002

::: tools/profiler/core/shared-libraries-macos.cc:180
(Diff revision 1)
>  
> +  if (aii->version >= 15) {
> +    // Add the entry for dyld itself.
> +    // Prior to version 15 (shipped in 10.12), it was really tricky to find
> +    // out the path to dyld, so we're not going to bother on those versions
> +    // of macOS. Thankfully, version 15 added the dyldPath property.

Seems like you could get *something* useful here for older OS versions as long as you have `dyldImageLoadAddress` just by using `dyld` or maybe hardcoding `/usr/lib/dyld`.
Attachment #8864731 - Flags: review?(ted) → review+

This patch was r+ed before by Ted, but it never landed because I initially intended
to address Ted's review comment (about making it work on 10.11 and below), and
because it needed to be rebased around bug 1374888.
The rebase turned out to be really simple, and Ted's review comment no longer applies
because Firefox no longer runs on 10.11 and below.

Profile with fix: https://share.firefox.dev/3oYzvO6

Pushed by mstange@themasta.com:
https://hg.mozilla.org/integration/autoland/rev/d5e3e93b2ea6
Add an entry for dyld to the shared library list on macOS. r=gerald
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 97 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: