commit | e1f73bd05a081828efab5b4427d722c80082483c | [log] [tgz] |
---|---|---|
author | Przemyslaw Pietrzkiewicz <ppi@chromium.org> | Tue Aug 04 11:59:34 2015 +0200 |
committer | Przemyslaw Pietrzkiewicz <ppi@chromium.org> | Tue Aug 04 11:59:34 2015 +0200 |
tree | 817236fc511086f06ff184e5a4889afd03a6e13a | |
parent | 45b0b261235a9b42dc36c46f4855726af3a3fbcf [diff] |
Update Devtools README. This drops the section about devtoolslib, which became an implementation detail. mojo_* top-level tools are now *the* supported way of consuming devtools. R=qsr@chromium.org Review URL: https://codereview.chromium.org/1265243002 . Cr-Mirrored-From: https://github.com/domokit/mojo Cr-Mirrored-Commit: 9a988ce4d585654cf13d2ae9ee9a4bf844aff2ee
Unopinionated tools for running, debugging and testing Mojo apps.
git clone https://github.com/domokit/devtools.git
Devtools offers the following tools:
mojo_run
- shell runnermojo_test
- apptest runnermojo_debug
- debugger supporting interactive tracing and debugging of a running mojo shellAdditionally, remote_adb_setup
script helps to configure adb on a remote machine to communicate with a device attached to a local machine, forwarding the ports used by mojo_run
.
mojo_run
allows you to run a Mojo shell either on the host, or on an attached Android device.
mojo_run APP_URL # Run on the host. mojo_run APP_URL --android # Run on Android device. mojo_run "APP_URL APP_ARGUMENTS" # Run an app with startup arguments
Unless running within a Mojo checkout, we need to indicate the path to the shell binary:
mojo_run --shell-path path/to/shell/binary APP_URL
Some applications are running embedded inside a window manager. To start such an app, you have to first start the window manager app, then have it embed the app you are interested in. It is done as follows using the default window manager:
mojo_run "mojo:window_manager APP_URL"
By default, mojo_run
uses mojo:kiosk_wm
as the default window manager. It can be changed using the --window-manager
flag.
To run a Sky app, you need to build sky_viewer.mojo
in a Sky checkout, and indicate the path to the binary using the --map-url
parameter:
mojo_run --map-url mojo:sky_viewer=/path/to/sky/viewer "mojo:window_manager APP_URL"
If the app does not declare a shebang indicating that it needs to be run in sky_viewer
, pass --sky
to map sky_viewer
as a default content handler for dart apps:
mojo_run --map-url mojo:sky_viewer=/path/to/sky/viewer "mojo:window_manager APP_URL" --sky
Note that Sky apps will need the --use-osmesa flag to run over chromoting:
mojo_debug
allows you to interactively inspect a running shell, collect performance traces and attach a gdb debugger.
To collect performance traces and retrieve the result:
mojo_debug tracing start mojo_debug tracing stop [result.json]
The trace file can be then loaded using the trace viewer in Chrome available at about://tracing
.
It is possible to inspect a Mojo Shell process using GDB. The mojo_debug
script can be used to launch GDB and attach it to a running shell process (android only):
mojo_debug gdb attach
Once started, GDB will first stop the Mojo Shell execution, then load symbols from loaded Mojo applications. Please note that this initial step can take some time (up to several minutes in the worst case).
After each execution pause, GDB will update the set of loaded symbols based on the selected thread only. If you need symbols for all threads, use the update-symbols
GDB command:
(gdb) update-symbols
If you only want to update symbols for the current selected thread (for example, after changing threads), use the current
option:
(gdb) update-symbols current
If you want to debug the startup of your application, you can pass --wait-for-debugger
to mojo_run
to have the Mojo Shell stop and wait to be attached by gdb
before continuing.
When Mojo shell crashes on Android (“Unfortunately, Mojo shell has stopped.”) due to a crash in native code, mojo_debug
can be used to find and symbolize the stack trace present in the device log:
mojo_debug device stack
The library is canonically developed in the mojo repository, https://github.com/domokit/devtools is a mirror allowing to consume it separately.