Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/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.
| |
| 2 # | |
|
jbudorick
2017/07/18 14:11:47
This file should be in pylib/ somewhere -- probabl
BigBossZhiling
2017/07/18 22:16:09
Done.
| |
| 3 # Copyright 2017 The Chromium Authors. All rights reserved. | |
| 4 # Use of this source code is governed by a BSD-style license that can be | |
| 5 # found in the LICENSE file. | |
| 6 | |
| 7 import os | |
| 8 import subprocess | |
| 9 import tombstones | |
| 10 | |
| 11 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.
| |
| 12 """ A helper class to coordinate between tombstones.py and stack script. """ | |
| 13 | |
| 14 def __init__(self, apk_under_test=None, | |
| 15 enable_relocation_packing=None, libs_dir=None): | |
| 16 self.apk_under_test = apk_under_test | |
| 17 self.enable_relocation_packing = enable_relocation_packing | |
| 18 self.libs_dir = libs_dir | |
| 19 self.packed_libs = [] | |
| 20 | |
| 21 def UnzipAPK(self): | |
| 22 subprocess.check_call( | |
| 23 ['unzip', '-o', self.apk_under_test, '-d', self.libs_dir]) | |
| 24 if os.path.exists(os.path.join(self.libs_dir, 'lib')): | |
| 25 for root, _, files in os.walk(os.path.join(self.libs_dir, | |
| 26 'lib')): | |
| 27 for file_name in files: | |
| 28 if file_name.endswith('.so'): | |
| 29 self.packed_libs.append(os.path.join(root, file_name)) | |
| 30 | |
| 31 def ResolveTombstones(self, device, resolve_all_tombstones=True, | |
| 32 include_stack_symbols=False, | |
| 33 wipe_tombstones=True): | |
| 34 if self.enable_relocation_packing and self.apk_under_test: | |
| 35 self.UnzipAPK() | |
| 36 return tombstones.ResolveTombstones( | |
| 37 device, resolve_all_tombstones=resolve_all_tombstones, | |
| 38 include_stack_symbols=include_stack_symbols, | |
| 39 wipe_tombstones=wipe_tombstones, packed_libs=self.packed_libs) | |
| OLD | NEW |