Closed Bug 1634785 Opened 5 years ago Closed 9 months ago

De-duplicate SharedLibraries code - use BaseProfiler implementation in Gecko Profiler code

Categories

(Core :: Gecko Profiler, task, P1)

task

Tracking

()

RESOLVED FIXED
135 Branch
Tracking Status
firefox135 --- fixed

People

(Reporter: mstange, Assigned: canova)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxp])

Attachments

(9 files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

We currently have two implementations of SharedLibraries: https://searchfox.org/mozilla-central/search?q=&path=shared-libraries

Once Gecko profiler code can depend on BaseProfiler code, we can unify them.

Whiteboard: [fxp]

We will remove the libxul implementation soon and use the one in mozglue.
We can't keep these structs inside the mozglue, so we have to move them to
somewhere else in libxul. This file made the most sense since it's the one who
implements their methods.

Assignee: nobody → canaltinova
Status: NEW → ASSIGNED

These methods were already inside the shared libraries that was in
tools/profiler. Adding these methods here to make the implementations closer
and make the deduplication easier in the following commits.

Again removing some unused/unneeded things so it's going to be easier to
deduplicate the files.

While testing the de-duplication on Linux and macOS, I noticed that the
symbolication was completely broken due to having incorrect library names in
libs array. They were always like: "<obj-dir>/dist/bin/libxul.so" instead of
"libxul.so". The library names are found from their paths, and apparently we
were using an incorrect path separator for Linux and macOS, "" instead of "/".

This method was used only internally, and having this method declaration causes
issues. That's this method was already like this in tools/profiler version of
this but it wasn't implemented here.

This patch finally removes the shared libraries code that was inside
tools/profiler and uses the one in base profiler everywhere.

Now that we only have one implementation of this code, we don't have to
differentiate it with "BaseProfiler".

We already had this early return on the shared-libraries code that was on the
tools/profiler directory. Adding this check here as well to keep the both files
in sync. It will help us deduplicating the shared libraries code later.

Priority: P3 → P1
Pushed by canaltinova@gmail.com: https://hg.mozilla.org/integration/autoland/rev/bf73d2f240f1 Move SharedLibrary IPC ParamTraits outside of shared library header file r=mstange,profiler-reviewers https://hg.mozilla.org/integration/autoland/rev/2abc88b08f69 Add missing shared libraries methods to the baseprofiler implementation r=mstange,profiler-reviewers https://hg.mozilla.org/integration/autoland/rev/f9b6ae065ffc Make the base profiler shared libraries file closer to gecko profiler one r=mstange,profiler-reviewers https://hg.mozilla.org/integration/autoland/rev/32b940c88cca Fix how shared library names are found on linux and macOS r=mstange,profiler-reviewers https://hg.mozilla.org/integration/autoland/rev/42d0181c117a Do not expose AddSharedLibraryFromModuleInfo that's only used internally r=mstange,profiler-reviewers https://hg.mozilla.org/integration/autoland/rev/1c43270bdcaf Return early for ntdll.dll if EAF+ is enabled on mozglue SharedLibrary as well r=mstange,profiler-reviewers,bobowen https://hg.mozilla.org/integration/autoland/rev/cb492d775d37 Deduplicate shared libraries code r=mstange,profiler-reviewers https://hg.mozilla.org/integration/autoland/rev/3ea11e90d26d Rename BaseProfilerSharedLibraries.h to SharedLibraries.h r=mstange,profiler-reviewers

Currently Bug 1920956 is blocking this and can't land it until it's fixed.

Flags: needinfo?(canaltinova)

Well, I said recent in the commit title but it's actually 3 years old change.
It was implemented in Bug 1741760. Looks like it was writing garbage code IDs
to the modules that aren't ELF files without this change. So I think it's good
to have it in our copy as well.

Pushed by canaltinova@gmail.com: https://hg.mozilla.org/integration/autoland/rev/b49494dec386 Move SharedLibrary IPC ParamTraits outside of shared library header file r=aabh,mstange,profiler-reviewers https://hg.mozilla.org/integration/autoland/rev/dbbb6a6563e8 Add missing shared libraries methods to the baseprofiler implementation r=mstange,profiler-reviewers https://hg.mozilla.org/integration/autoland/rev/34ae05420bc4 Make the base profiler shared libraries file closer to gecko profiler one r=mstange,profiler-reviewers https://hg.mozilla.org/integration/autoland/rev/c447ddfd70a2 Fix how shared library names are found on linux and macOS r=mstange,profiler-reviewers https://hg.mozilla.org/integration/autoland/rev/8524486a6d36 Do not expose AddSharedLibraryFromModuleInfo that's only used internally r=mstange,profiler-reviewers https://hg.mozilla.org/integration/autoland/rev/4f17a5b45353 Return early for ntdll.dll if EAF+ is enabled on mozglue SharedLibrary as well r=mstange,profiler-reviewers,bobowen https://hg.mozilla.org/integration/autoland/rev/9a91de226e6d Apply recent breakpad changes to baseprofiler copy r=mstange,profiler-reviewers https://hg.mozilla.org/integration/autoland/rev/8ad3b7e6de23 Deduplicate shared libraries code r=mstange,profiler-reviewers https://hg.mozilla.org/integration/autoland/rev/6b399daabb18 Rename BaseProfilerSharedLibraries.h to SharedLibraries.h r=mstange,profiler-reviewers
Regressions: 1935437
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: