Bug 1457481 - Add a MOZ_GECKO_PROFILER_PARSE_ELF define that's only true on Android. r=ted
authorMarkus Stange <mstange@themasta.com>
Tue, 02 Oct 2018 01:49:13 +0000
changeset 487496 7c0eb6f58c1cf996836905df9696528a63b78d09
parent 487449 08125cd5d357b9da68af7a4b22122f07fc35243c
child 487497 7566a6bac33d41042243ac2cef94f32b7d0c08df
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
Bug 1457481 - Add a MOZ_GECKO_PROFILER_PARSE_ELF define that's only true on Android. r=ted This will be used to conditionally compile the rust code for ELF binary parsing, which will be used by the profiler to dump symbols from system libraries on Android. Ideally I'd like to make this only apply to Nightly + Beta configurations, and not to Release, but there doesn't seem to be an easy way to differentiate between Beta and Release and doing so might be frowned upon. So now it's going to be built on all channels on Android, even Release, even though developers won't be profiling Release channel builds much, and the extra code size isn't all that valuable for our users. We definitely need this code to be included on the Beta channel, though, because Firefox Focus Nightly uses GeckoView from the Beta channel, and we want to get good profiling information from Focus. Differential Revision: https://phabricator.services.mozilla.com/D7020
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -34,16 +34,30 @@ def gecko_profiler(target):
 def gecko_profiler_define(value):
     if value:
         return True
 set_config('MOZ_GECKO_PROFILER', gecko_profiler_define)
 set_define('MOZ_GECKO_PROFILER', gecko_profiler_define)
+# Whether code to parse ELF binaries should be compiled for the Gecko profiler
+# (for symbol table dumping).
+@depends(gecko_profiler, target)
+def gecko_profiler_parse_elf(value, target):
+    # Currently we only want to build this code on Android, in order to dump
+    # symbols from Android system libraries on the device. For other platforms
+    # there exist alternatives that don't require bloating up our binary size.
+    if value and target.os == 'Android':
+        return True
+set_config('MOZ_GECKO_PROFILER_PARSE_ELF', gecko_profiler_parse_elf)
+set_define('MOZ_GECKO_PROFILER_PARSE_ELF', gecko_profiler_parse_elf)
 option('--enable-dmd', env='MOZ_DMD',
        help='Enable Dark Matter Detector (heap profiler). '
             'Also enables jemalloc, replace-malloc and profiling')
 def dmd(value):
     if value:
         return True