Don't spawn debugger.mojo by default in `mojo_run`. This patch replaces `--no-debugger` switch in `mojo_run` with `--debugger`, flipping the default to default to running without debugger. Motivation: simplest actions should be accomplished through simplest command lines. We should not need to remember to pass `--no-debugger` to ensure that shell terminates. Fixes domokit/devtools#40. R=qsr@google.com, qsr@chromium.org Review URL: https://codereview.chromium.org/1311333003 . Cr-Mirrored-From: https://github.com/domokit/mojo Cr-Mirrored-Commit: 708fe8794cc177b08d477f38dbd1f6ee4ebe4dc0
diff --git a/README.md b/README.md index 5367352..e6044b2 100644 --- a/README.md +++ b/README.md
@@ -57,9 +57,16 @@ performance traces and attach a gdb debugger. #### Tracing -To collect [performance +In order to collect [performance traces](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) -and retrieve the result: +interactively through `mojo_debug`, make sure that the app being inspected was +run with `--debugger` switch. E.g.: + +```sh +mojo_run --debugger APP_URL [--android] +``` + +Then, in another shell, tracing can be orchestrated as follows: ```sh mojo_debug tracing start
diff --git a/mojo_debug b/mojo_debug index 31a93de..cc1aa0b 100755 --- a/mojo_debug +++ b/mojo_debug
@@ -45,7 +45,10 @@ else: return requests.get(url) except requests.exceptions.ConnectionError: - print 'Failed to connect to mojo:debugger, make sure the shell is running.' + print ('Failed to connect to debugger.mojo. Make sure the shell is running ' + 'and the app was started with debugger, ie. through ' + '`mojo_run --debugger APP_URL`') + return None @@ -91,7 +94,7 @@ def _add_tracing_command(subparsers): """Sets up the command line parser to manage tracing.""" tracing_parser = subparsers.add_parser('tracing', - help='trace event profiler') + help='tracer (requires debugger.mojo)') tracing_subparser = tracing_parser.add_subparsers( help='the command to run') @@ -115,7 +118,8 @@ def _add_wm_command(subparsers): """Sets up the parser for the 'wm' command.""" - wm_parser = subparsers.add_parser('wm', help='window manager') + wm_parser = subparsers.add_parser('wm', help='window manager (requires ' + 'debugger.mojo)') wm_subparser = wm_parser.add_subparsers( help='the command to run')
diff --git a/mojo_run b/mojo_run index 541afb9..0982ee6 100755 --- a/mojo_run +++ b/mojo_run
@@ -40,10 +40,11 @@ _LEGACY_WM_URL = 'mojo:window_manager' _WM_URL = 'https://core.mojoapps.io/window_manager.mojo' +_DEBUGGER_URL = 'https://core.mojoapps.io/debugger.mojo' def _configure_debugger(shell): - """Configures mojo:debugger to run and sets up port forwarding for its http + """Configures debugger.mojo to run and sets up port forwarding for its http server if the shell is running on a device. Returns: @@ -51,7 +52,7 @@ run with the debugger. """ shell.forward_host_port_to_shell(_MOJO_DEBUGGER_PORT) - return ['mojo:debugger %d' % _MOJO_DEBUGGER_PORT] + return ['%s %d' % (_DEBUGGER_URL, _MOJO_DEBUGGER_PORT)] def main(): @@ -66,8 +67,8 @@ help='Window manager app to be mapped as ' 'mojo:window_manager. By default it is ' + _DEFAULT_WM) - parser.add_argument('--no-debugger', action="store_true", - help='Do not spawn mojo:debugger.') + parser.add_argument('--debugger', action="store_true", + help='Run debugger.mojo along with the app.') script_args, shell_args = parser.parse_known_args() @@ -88,7 +89,7 @@ if script_args.embed: shell_args.append('%s %s' % (script_args.window_manager, script_args.embed)) - if not script_args.no_debugger: + if script_args.debugger: if script_args.verbose: print 'Spawning mojo:debugger, use `mojo_debug` to inspect the shell.' print 'Note that mojo:debugger will prevent the shell from terminating,'