| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 from skypy.skyserver import SkyServer | 6 from skypy.skyserver import SkyServer |
| 7 import argparse | 7 import argparse |
| 8 import hashlib | 8 import hashlib |
| 9 import json | 9 import json |
| 10 import logging | 10 import logging |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 PID_FILE_KEYS = frozenset([ | 37 PID_FILE_KEYS = frozenset([ |
| 38 'remote_sky_server_port', | 38 'remote_sky_server_port', |
| 39 'sky_server_pid', | 39 'sky_server_pid', |
| 40 'sky_server_port', | 40 'sky_server_port', |
| 41 'sky_server_root', | 41 'sky_server_root', |
| 42 'build_dir', | 42 'build_dir', |
| 43 'sky_shell_pid', | 43 'sky_shell_pid', |
| 44 'remote_gdbserver_port', | 44 'remote_gdbserver_port', |
| 45 ]) | 45 ]) |
| 46 | 46 |
| 47 # TODO(iansf): Fix undefined behavior when you have more than one device attache
d. | 47 SYSTEM_LIBS_ROOT_PATH = '/tmp/device_libs' |
| 48 SYSTEM_LIBS_ROOT_PATH = '/tmp/device_libs/%s' % (subprocess.check_output(['adb',
'get-serialno']).strip()) | |
| 49 | 48 |
| 50 _IGNORED_PATTERNS = [ | 49 _IGNORED_PATTERNS = [ |
| 51 # Ignored because they're not indicative of specific errors. | 50 # Ignored because they're not indicative of specific errors. |
| 52 re.compile(r'^$'), | 51 re.compile(r'^$'), |
| 53 re.compile(r'^Analyzing \['), | 52 re.compile(r'^Analyzing \['), |
| 54 re.compile(r'^No issues found'), | 53 re.compile(r'^No issues found'), |
| 55 re.compile(r'^[0-9]+ errors? and [0-9]+ warnings? found.'), | 54 re.compile(r'^[0-9]+ errors? and [0-9]+ warnings? found.'), |
| 56 re.compile(r'^([0-9]+|No) (error|warning|issue)s? found.'), | 55 re.compile(r'^([0-9]+|No) (error|warning|issue)s? found.'), |
| 57 | 56 |
| 58 # TODO: Remove once sdk-extensions are in place | 57 # TODO: Remove once sdk-extensions are in place |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 ] | 335 ] |
| 337 gdb_path = '/usr/bin/gdb' | 336 gdb_path = '/usr/bin/gdb' |
| 338 | 337 |
| 339 eval_commands = [ | 338 eval_commands = [ |
| 340 'directory %s' % SRC_ROOT, | 339 'directory %s' % SRC_ROOT, |
| 341 # TODO(eseidel): What file do I point it at? The apk? | 340 # TODO(eseidel): What file do I point it at? The apk? |
| 342 #'file %s' % self.paths.mojo_shell_path, | 341 #'file %s' % self.paths.mojo_shell_path, |
| 343 'target remote localhost:%s' % GDB_PORT, | 342 'target remote localhost:%s' % GDB_PORT, |
| 344 ] | 343 ] |
| 345 | 344 |
| 346 system_lib_dirs = self._pull_system_libraries(pids, | 345 # TODO(iansf): Fix undefined behavior when you have more than one device
attached. |
| 347 SYSTEM_LIBS_ROOT_PATH) | 346 device_id = subprocess.check_output([ADB_PATH, 'get-serialno']).strip() |
| 348 eval_commands.append( | 347 device_libs_path = os.path.join(SYSTEM_LIBS_ROOT_PATH, device_id) |
| 349 'set solib-absolute-prefix %s' % SYSTEM_LIBS_ROOT_PATH) | 348 |
| 349 system_lib_dirs = self._pull_system_libraries(pids, device_libs_path) |
| 350 eval_commands.append('set solib-absolute-prefix %s' % device_libs_path) |
| 350 | 351 |
| 351 symbol_search_paths = system_lib_dirs + symbol_search_paths | 352 symbol_search_paths = system_lib_dirs + symbol_search_paths |
| 352 | 353 |
| 353 # TODO(eseidel): We need to look up the toolchain somehow? | 354 # TODO(eseidel): We need to look up the toolchain somehow? |
| 354 if platform.system() == 'Darwin': | 355 if platform.system() == 'Darwin': |
| 355 gdb_path = os.path.join(SRC_ROOT, 'third_party/android_tools/ndk/' | 356 gdb_path = os.path.join(SRC_ROOT, 'third_party/android_tools/ndk/' |
| 356 'toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/' | 357 'toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/' |
| 357 'bin/arm-linux-androideabi-gdb') | 358 'bin/arm-linux-androideabi-gdb') |
| 358 else: | 359 else: |
| 359 gdb_path = os.path.join(SRC_ROOT, 'third_party/android_tools/ndk/' | 360 gdb_path = os.path.join(SRC_ROOT, 'third_party/android_tools/ndk/' |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 args = parser.parse_args() | 533 args = parser.parse_args() |
| 533 pids = Pids.read_from(PID_FILE_PATH, PID_FILE_KEYS) | 534 pids = Pids.read_from(PID_FILE_PATH, PID_FILE_KEYS) |
| 534 exit_code = args.func(args, pids) | 535 exit_code = args.func(args, pids) |
| 535 # We could do this with an at-exit handler instead? | 536 # We could do this with an at-exit handler instead? |
| 536 pids.write_to(PID_FILE_PATH) | 537 pids.write_to(PID_FILE_PATH) |
| 537 sys.exit(exit_code) | 538 sys.exit(exit_code) |
| 538 | 539 |
| 539 | 540 |
| 540 if __name__ == '__main__': | 541 if __name__ == '__main__': |
| 541 SkyShellRunner().main() | 542 SkyShellRunner().main() |
| OLD | NEW |