Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 import argparse | 6 import argparse |
| 7 import codecs | 7 import codecs |
| 8 import logging | 8 import logging |
| 9 import os.path | 9 import os.path |
| 10 import requests | 10 import requests |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 'arm-linux-androideabi-4.9', | 215 'arm-linux-androideabi-4.9', |
| 216 'prebuilt', | 216 'prebuilt', |
| 217 # TODO(etiennej): DEPS mac NDK and use it on macs. | 217 # TODO(etiennej): DEPS mac NDK and use it on macs. |
| 218 'linux-x86_64', | 218 'linux-x86_64', |
| 219 'bin', | 219 'bin', |
| 220 'arm-linux-androideabi-gdb') | 220 'arm-linux-androideabi-gdb') |
| 221 python_gdb_script_path = os.path.join(os.path.dirname(__file__), | 221 python_gdb_script_path = os.path.join(os.path.dirname(__file__), |
| 222 'android_gdb', 'session.py') | 222 'android_gdb', 'session.py') |
| 223 debug_session_arguments = {} | 223 debug_session_arguments = {} |
| 224 if args.build_dir: | 224 if args.build_dir: |
| 225 debug_session_arguments["build_directory"] = args.build_dir | 225 debug_session_arguments["build_directory_list"] = args.build_dir |
| 226 else: | 226 else: |
| 227 try: | 227 try: |
| 228 debug_session_arguments["build_directory"] = os.path.join( | 228 debug_session_arguments["build_directory_list"] = os.path.join( |
| 229 _get_dir_above('out'), 'out', 'android_Debug') | 229 _get_dir_above('out'), 'out', 'android_Debug') |
| 230 if not os.path.exists(debug_session_arguments["build_directory"]): | 230 if not os.path.exists(debug_session_arguments["build_directory_list"]): |
| 231 raise DirectoryNotFoundException() | 231 raise DirectoryNotFoundException() |
| 232 except DirectoryNotFoundException: | 232 except DirectoryNotFoundException: |
| 233 logging.fatal("Unable to find the build directory, please specify it " | 233 logging.fatal("Unable to find the build directory, please specify it " |
| 234 "using --build-dir.") | 234 "using --build-dir.") |
| 235 return | 235 return |
| 236 | 236 |
| 237 if args.package_name: | 237 if args.package_name: |
| 238 debug_session_arguments["package_name"] = args.package_name | 238 debug_session_arguments["package_name"] = args.package_name |
| 239 else: | 239 else: |
| 240 debug_session_arguments["package_name"] = _DEFAULT_PACKAGE_NAME | 240 debug_session_arguments["package_name"] = _DEFAULT_PACKAGE_NAME |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 gdb_subparser = gdb_parser.add_subparsers( | 301 gdb_subparser = gdb_parser.add_subparsers( |
| 302 help='Commands to GDB') | 302 help='Commands to GDB') |
| 303 | 303 |
| 304 gdb_attach_parser = gdb_subparser.add_parser( | 304 gdb_attach_parser = gdb_subparser.add_parser( |
| 305 'attach', help='Attach GDB to a running Mojo Shell process') | 305 'attach', help='Attach GDB to a running Mojo Shell process') |
| 306 gdb_attach_parser.add_argument('--adb-path', type=str, | 306 gdb_attach_parser.add_argument('--adb-path', type=str, |
| 307 help='path to the adb tool from the Android SDK (optional)') | 307 help='path to the adb tool from the Android SDK (optional)') |
| 308 gdb_attach_parser.add_argument('--ndk-dir', type=str, | 308 gdb_attach_parser.add_argument('--ndk-dir', type=str, |
| 309 help='path to the directory containing the Android NDK') | 309 help='path to the directory containing the Android NDK') |
| 310 gdb_attach_parser.add_argument('--build-dir', type=str, | 310 gdb_attach_parser.add_argument('--build-dir', type=str, |
| 311 help='path to the build directory') | 311 help='List of paths to build directories, separated by commas') |
|
qsr (NOT THE RIGHT qsr)
2015/09/03 10:34:04
Do you think it is better to do it this way, inste
etiennej
2015/09/03 11:45:44
Good point. I also changed the device stack comman
| |
| 312 gdb_attach_parser.add_argument('--pyelftools-dir', type=str, | 312 gdb_attach_parser.add_argument('--pyelftools-dir', type=str, |
| 313 help='Path to a directory containing third party libraries') | 313 help='Path to a directory containing third party libraries') |
| 314 gdb_attach_parser.add_argument('--gsutil-dir', type=str, | 314 gdb_attach_parser.add_argument('--gsutil-dir', type=str, |
| 315 help='Path to a directory containing gsutil') | 315 help='Path to a directory containing gsutil') |
| 316 gdb_attach_parser.add_argument('--package-name', type=str, | 316 gdb_attach_parser.add_argument('--package-name', type=str, |
| 317 help='Name of the Mojo Shell android package to debug') | 317 help='Name of the Mojo Shell android package to debug') |
| 318 gdb_attach_parser.set_defaults(func=_gdb_attach) | 318 gdb_attach_parser.set_defaults(func=_gdb_attach) |
| 319 | 319 |
| 320 | 320 |
| 321 def main(): | 321 def main(): |
| 322 parser = argparse.ArgumentParser(description='Command-line interface for ' | 322 parser = argparse.ArgumentParser(description='Command-line interface for ' |
| 323 'mojo:debugger') | 323 'mojo:debugger') |
| 324 subparsers = parser.add_subparsers(help='the tool to run') | 324 subparsers = parser.add_subparsers(help='the tool to run') |
| 325 _add_device_command(subparsers) | 325 _add_device_command(subparsers) |
| 326 _add_tracing_command(subparsers) | 326 _add_tracing_command(subparsers) |
| 327 _add_wm_command(subparsers) | 327 _add_wm_command(subparsers) |
| 328 _add_gdb_command(subparsers) | 328 _add_gdb_command(subparsers) |
| 329 | 329 |
| 330 args = parser.parse_args() | 330 args = parser.parse_args() |
| 331 return args.func(args) | 331 return args.func(args) |
| 332 | 332 |
| 333 if __name__ == '__main__': | 333 if __name__ == '__main__': |
| 334 sys.exit(main()) | 334 sys.exit(main()) |
| OLD | NEW |