Chromium Code Reviews| Index: build/android/tombstones_helper.py |
| diff --git a/build/android/tombstones_helper.py b/build/android/tombstones_helper.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..a2127aed1896bec4cad4e3dfd0a81514505b3339 |
| --- /dev/null |
| +++ b/build/android/tombstones_helper.py |
| @@ -0,0 +1,39 @@ |
| +#!/usr/bin/env python |
|
jbudorick
2017/07/18 14:11:47
This shouldn't be executable and shouldn't start w
BigBossZhiling
2017/07/18 22:16:08
Done.
|
| +# |
|
jbudorick
2017/07/18 14:11:47
This file should be in pylib/ somewhere -- probabl
BigBossZhiling
2017/07/18 22:16:09
Done.
|
| +# Copyright 2017 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import os |
| +import subprocess |
| +import tombstones |
| + |
| +class TombstonesHelper(object): |
|
jbudorick
2017/07/18 14:11:46
I probably wasn't clear enough with my intended de
BigBossZhiling
2017/07/18 22:16:09
Done.
|
| + """ A helper class to coordinate between tombstones.py and stack script. """ |
| + |
| + def __init__(self, apk_under_test=None, |
| + enable_relocation_packing=None, libs_dir=None): |
| + self.apk_under_test = apk_under_test |
| + self.enable_relocation_packing = enable_relocation_packing |
| + self.libs_dir = libs_dir |
| + self.packed_libs = [] |
| + |
| + def UnzipAPK(self): |
| + subprocess.check_call( |
| + ['unzip', '-o', self.apk_under_test, '-d', self.libs_dir]) |
| + if os.path.exists(os.path.join(self.libs_dir, 'lib')): |
| + for root, _, files in os.walk(os.path.join(self.libs_dir, |
| + 'lib')): |
| + for file_name in files: |
| + if file_name.endswith('.so'): |
| + self.packed_libs.append(os.path.join(root, file_name)) |
| + |
| + def ResolveTombstones(self, device, resolve_all_tombstones=True, |
| + include_stack_symbols=False, |
| + wipe_tombstones=True): |
| + if self.enable_relocation_packing and self.apk_under_test: |
| + self.UnzipAPK() |
| + return tombstones.ResolveTombstones( |
| + device, resolve_all_tombstones=resolve_all_tombstones, |
| + include_stack_symbols=include_stack_symbols, |
| + wipe_tombstones=wipe_tombstones, packed_libs=self.packed_libs) |