Commit 91621ea4 authored by oysteine's avatar oysteine Committed by Commit bot

Reland: "Telemetry: Last ditch effort to dump symbols on tab crashes if none are found"

Relanding https://codereview.chromium.org/318123002/ as the Telemetry unittests run fine on the trybots with this again.

TBR=tonyg,dtu
BUG=

Review URL: https://codereview.chromium.org/589673002

Cr-Commit-Position: refs/heads/master@{#296079}
parent 50f9789a
...@@ -258,17 +258,15 @@ class DesktopBrowserBackend(chrome_browser_backend.ChromeBrowserBackend): ...@@ -258,17 +258,15 @@ class DesktopBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
logging.warning('minidump_stackwalk binary not found.') logging.warning('minidump_stackwalk binary not found.')
return None return None
symbols = glob.glob(os.path.join(self._browser_directory, '*.breakpad*'))
if not symbols:
logging.warning('No breakpad symbols found.')
return None
with open(minidump, 'rb') as infile: with open(minidump, 'rb') as infile:
minidump += '.stripped' minidump += '.stripped'
with open(minidump, 'wb') as outfile: with open(minidump, 'wb') as outfile:
outfile.write(''.join(infile.read().partition('MDMP')[1:])) outfile.write(''.join(infile.read().partition('MDMP')[1:]))
symbols_path = os.path.join(self._tmp_minidump_dir, 'symbols') symbols_path = os.path.join(self._tmp_minidump_dir, 'symbols')
symbols = glob.glob(os.path.join(self._browser_directory, '*.breakpad*'))
if symbols:
for symbol in sorted(symbols, key=os.path.getmtime, reverse=True): for symbol in sorted(symbols, key=os.path.getmtime, reverse=True):
if not os.path.isfile(symbol): if not os.path.isfile(symbol):
continue continue
...@@ -283,6 +281,24 @@ class DesktopBrowserBackend(chrome_browser_backend.ChromeBrowserBackend): ...@@ -283,6 +281,24 @@ class DesktopBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
continue continue
os.makedirs(symbol_path) os.makedirs(symbol_path)
shutil.copyfile(symbol, os.path.join(symbol_path, binary + '.sym')) shutil.copyfile(symbol, os.path.join(symbol_path, binary + '.sym'))
else:
logging.info('Dumping breakpad symbols')
generate_breakpad_symbols_path = os.path.join(
util.GetChromiumSrcDir(), "components", "breakpad",
"tools", "generate_breakpad_symbols.py")
cmd = [
sys.executable,
generate_breakpad_symbols_path,
'--binary=%s' % self._executable,
'--symbols-dir=%s' % symbols_path,
'--build-dir=%s' % self._browser_directory,
]
try:
subprocess.check_output(cmd, stderr=open(os.devnull, 'w'))
except subprocess.CalledProcessError:
logging.warning('Failed to execute "%s"' % ' '.join(cmd))
return None
return subprocess.check_output([stackwalk, minidump, symbols_path], return subprocess.check_output([stackwalk, minidump, symbols_path],
stderr=open(os.devnull, 'w')) stderr=open(os.devnull, 'w'))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment