Bug 1621468 - Stop using `fix_stack_using_bpsyms.py` in `dmd.py`. r=gsvelto
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 16 Mar 2020 01:15:27 +0000
changeset 518885 10998b6bf6d86d1201bdc9c0027154cf42970315
parent 518884 77436c074c255a2b407685db4c4e5b9e5707b331
child 518886 0fdeafcdcb41a6e7def0650ef1d93e3e5bef9299
push id37218
push userrmaries@mozilla.com
push dateMon, 16 Mar 2020 09:28:04 +0000
treeherdermozilla-central@6199f7b91e8b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgsvelto
bugs1621468
milestone76.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1621468 - Stop using `fix_stack_using_bpsyms.py` in `dmd.py`. r=gsvelto This uses `fix-stacks`'s new Breakpad symbols support from https://github.com/mozilla/fix-stacks/pull/16. The patch also updates some comments in `dmd.py` to account for some very slight changes in `fix-stacks`'s output. Differential Revision: https://phabricator.services.mozilla.com/D66363
memory/replace/dmd/dmd.py
taskcluster/ci/fetch/toolchains.yml
tools/rb/fix_stacks.py
--- a/memory/replace/dmd/dmd.py
+++ b/memory/replace/dmd/dmd.py
@@ -212,20 +212,20 @@ variable is used to find breakpad symbol
 def fixStackTraces(inputFilename, isZipped, opener):
     # This append() call is needed to make the import statements work when this
     # script is installed as a symlink.
     sys.path.append(os.path.dirname(__file__))
 
     bpsyms = os.environ.get('BREAKPAD_SYMBOLS_PATH', None)
     sysname = platform.system()
     if bpsyms and os.path.exists(bpsyms):
-        import fix_stack_using_bpsyms as fixModule
+        import fix_stacks as fixModule
 
         def fix(line):
-            return fixModule.fixSymbols(line, bpsyms, jsonEscape=True)
+            return fixModule.fixSymbols(line, jsonMode=True, breakpadSymsDir=bpsyms)
 
     elif sysname in ('Linux', 'Darwin', 'Windows'):
         import fix_stacks as fixModule
 
         def fix(line): return fixModule.fixSymbols(line, jsonMode=True)
 
     else:
         fix = None
@@ -340,20 +340,20 @@ def getDigestFromFile(args, inputFile):
             #
             # Linux debug, with stack fixing using breakpad syms:
             # `#01: replace_realloc(void*, unsigned long) [../dmd/DMD.cpp:1110]`
             #
             # Linux opt, with native stack fixing:
             # `#02: TestFull(char const*, int, char const*, int) (../dmd/test/SmokeDMD.cpp:165)`
             #
             # Mac opt, with native stack fixing:
-            # `#03: RunTests() (../build/tests/bin/SmokeDMD +0x21f9)`
+            # `#03: RunTests() (../build/tests/bin/SmokeDMD + 0x21f9)`
             #
             # Windows opt, with native stack fixing failing due to a missing PDB:
-            # `#04: ??? (..\\build\\tests\\bin\\SmokeDMD.exe +0x1c58)`
+            # `#04: ??? (..\\build\\tests\\bin\\SmokeDMD.exe + 0x1c58)`
             #
             # If we see three such frames, we replace the entire stack trace
             # with a single, predictable frame. This imprecise matching will at
             # least detect if stack fixing fails completely.
             dmd_frame_matches = 0
             for frameKey in frameKeys:
                 frameDesc = frameTable[frameKey]
                 if 'DMD' in frameDesc:
--- a/taskcluster/ci/fetch/toolchains.yml
+++ b/taskcluster/ci/fetch/toolchains.yml
@@ -466,9 +466,9 @@ dump-syms:
         # 0.0.4 + fix for Windows cross builds
         revision: c75b1fb14f07650d9490b788710af2367c7e00d0
 
 fix-stacks:
     description: fix-stacks source code
     fetch:
         type: git
         repo: https://github.com/mozilla/fix-stacks/
-        revision: b0abef037e6fd46a2debce83c1a7612c6f35c599
+        revision: 15304c4cf0bcd6e4feeadd065dba4af25c0d3e87
--- a/tools/rb/fix_stacks.py
+++ b/tools/rb/fix_stacks.py
@@ -16,17 +16,17 @@ import sys
 
 # Matches lines produced by MozFormatCodeAddress(), e.g.
 # `#01: ???[tests/example +0x43a0]`.
 line_re = re.compile("#\d+: .+\[.+ \+0x[0-9A-Fa-f]+\]")
 
 fix_stacks = None
 
 
-def fixSymbols(line, jsonMode=False, slowWarning=False):
+def fixSymbols(line, jsonMode=False, slowWarning=False, breakpadSymsDir=None):
     global fix_stacks
 
     result = line_re.search(line)
     if result is None:
         return line
 
     if not fix_stacks:
         # Look in MOZ_FETCHES_DIR (for automation), then in MOZBUILD_STATE_PATH
@@ -44,16 +44,25 @@ def fixSymbols(line, jsonMode=False, slo
             fix_stacks_exe = fix_stacks_exe + '.exe'
 
         if not (os.path.isfile(fix_stacks_exe) and os.access(fix_stacks_exe, os.X_OK)):
             raise Exception('cannot find `fix-stacks`; please run `./mach bootstrap`')
 
         args = [fix_stacks_exe]
         if jsonMode:
             args.append('-j')
+        if breakpadSymsDir:
+            # `fileid` should be packaged next to `fix_stacks.py`.
+            here = os.path.dirname(__file__)
+            fileid_exe = os.path.join(here, 'fileid')
+            if platform.system() == 'Windows':
+                fileid_exe = fileid_exe + '.exe'
+
+            args.append('-b')
+            args.append(breakpadSymsDir + "," + fileid_exe)
 
         fix_stacks = Popen(args, stdin=PIPE, stdout=PIPE, stderr=None)
 
         if slowWarning:
             print("Initializing stack-fixing for the first stack frame, this may take a while...")
 
     # Sometimes `line` is lacking a trailing newline. If we pass such a `line`
     # to `fix-stacks` it will wait until it receives a newline, causing this