Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: mojo/devtools/common/mojo_debug

Issue 1532893003: Tidy up the debugger. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-2
Patch Set: rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | services/debugger/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 help='start tracing') 102 help='start tracing')
103 start_tracing_parser.set_defaults(func=_tracing_start) 103 start_tracing_parser.set_defaults(func=_tracing_start)
104 104
105 stop_tracing_parser = tracing_subparser.add_parser('stop', 105 stop_tracing_parser = tracing_subparser.add_parser('stop',
106 help='stop tracing and retrieve the result') 106 help='stop tracing and retrieve the result')
107 stop_tracing_parser.add_argument('file_name', type=str, nargs='?', 107 stop_tracing_parser.add_argument('file_name', type=str, nargs='?',
108 help='name of the output file (optional)') 108 help='name of the output file (optional)')
109 stop_tracing_parser.set_defaults(func=_tracing_stop) 109 stop_tracing_parser.set_defaults(func=_tracing_stop)
110 110
111 111
112 def _wm_load(args):
113 """Loads (embeds) the given url in the window manager."""
114 if not _send_request('load', args.url):
115 return 1
116 return 0
117
118
119 def _add_wm_command(subparsers):
120 """Sets up the parser for the 'wm' command."""
121 wm_parser = subparsers.add_parser('wm', help='window manager (requires '
122 'debugger.mojo)')
123 wm_subparser = wm_parser.add_subparsers(
124 help='the command to run')
125
126 wm_load_parser = wm_subparser.add_parser('load',
127 help='load (embed) the given url')
128 wm_load_parser.add_argument('url', type=str,
129 help='the url to load')
130 wm_load_parser.set_defaults(func=_wm_load)
131
132
133 def _device_stack(args): 112 def _device_stack(args):
134 """Runs the device logcat through android_stack_parser.""" 113 """Runs the device logcat through android_stack_parser."""
135 adb_path = args.adb_path if args.adb_path else 'adb' 114 adb_path = args.adb_path if args.adb_path else 'adb'
136 logcat_cmd = [adb_path, 'logcat', '-d'] 115 logcat_cmd = [adb_path, 'logcat', '-d']
137 try: 116 try:
138 logcat = subprocess.Popen(logcat_cmd, stdout=subprocess.PIPE) 117 logcat = subprocess.Popen(logcat_cmd, stdout=subprocess.PIPE)
139 except OSError: 118 except OSError:
140 print 'failed to call adb, make sure it is in PATH or pass --adb-path' 119 print 'failed to call adb, make sure it is in PATH or pass --adb-path'
141 return 1 120 return 1
142 121
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 help='Name of the Mojo Shell android package to debug') 297 help='Name of the Mojo Shell android package to debug')
319 gdb_attach_parser.set_defaults(func=_gdb_attach) 298 gdb_attach_parser.set_defaults(func=_gdb_attach)
320 299
321 300
322 def main(): 301 def main():
323 parser = argparse.ArgumentParser(description='Command-line interface for ' 302 parser = argparse.ArgumentParser(description='Command-line interface for '
324 'mojo:debugger') 303 'mojo:debugger')
325 subparsers = parser.add_subparsers(help='the tool to run') 304 subparsers = parser.add_subparsers(help='the tool to run')
326 _add_device_command(subparsers) 305 _add_device_command(subparsers)
327 _add_tracing_command(subparsers) 306 _add_tracing_command(subparsers)
328 _add_wm_command(subparsers)
329 _add_gdb_command(subparsers) 307 _add_gdb_command(subparsers)
330 308
331 args = parser.parse_args() 309 args = parser.parse_args()
332 return args.func(args) 310 return args.func(args)
333 311
334 if __name__ == '__main__': 312 if __name__ == '__main__':
335 sys.exit(main()) 313 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | services/debugger/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698