|
2 | 2 |
|
3 | 3 | Unopinionated tools for **running**, **debugging** and **testing** Mojo apps.
|
4 | 4 |
|
5 |
| -## Repo contents |
| 5 | +## Install |
| 6 | + |
| 7 | +``` |
| 8 | +git clone https://github.com/domokit/devtools.git |
| 9 | +``` |
6 | 10 |
|
7 |
| -Devtools offer the following tools: |
| 11 | +## Contents |
8 | 12 |
|
9 |
| - - **mojo_shell** - universall shell runner |
10 |
| - - **debugger** - supports interactive tracing and debugging of a running mojo shell |
11 |
| - - **remote_adb_setup** - configures adb on a remote machine to communicate with |
| 13 | +Devtools offers the following tools: |
| 14 | + |
| 15 | + - `mojo_shell` - universal shell runner |
| 16 | + - `debugger` - supports interactive tracing and debugging of a running mojo |
| 17 | + shell |
| 18 | + - `remote_adb_setup` - configures adb on a remote machine to communicate with |
12 | 19 | a device attached to the local machine
|
13 | 20 |
|
14 |
| -and a Python scripting library designed for being embedded (devtoolslib). |
| 21 | +and a Python scripting library designed for being embedded (`devtoolslib`). |
15 | 22 |
|
16 |
| -### Devtoolslib |
| 23 | +### debugger |
17 | 24 |
|
18 |
| -**devtoolslib** is a Python module containing the core scripting functionality |
19 |
| -for running Mojo apps: shell abstraction with implementations for Android and |
20 |
| -Linux and support for apptest frameworks. The executable scripts in devtools |
21 |
| -are based on this module. |
| 25 | +The `debugger` script allows you to interactively inspect a running shell, |
| 26 | +collect performance traces and attach a gdb debugger. |
22 | 27 |
|
23 |
| -As devtools carry no assumptions about build system or file layout being used, |
24 |
| -one can choose to embed the functionality provided by **devtoolslib** in their |
25 |
| -own wrapper, instead of relying on the provided scripts. For examples, one can |
26 |
| -refer to mojo's [apptest |
27 |
| -runner](https://github.com/domokit/mojo/blob/master/mojo/tools/apptest_runner.py). |
| 28 | +#### Tracing |
| 29 | +To collect [performance |
| 30 | +traces](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) |
| 31 | +and retrieve the result: |
28 | 32 |
|
29 |
| -## Install |
| 33 | +```sh |
| 34 | +debugger tracing start |
| 35 | +debugger tracing stop [result.json] |
| 36 | +``` |
30 | 37 |
|
| 38 | +The trace file can be then loaded using the trace viewer in Chrome available at |
| 39 | +`about://tracing`. |
| 40 | + |
| 41 | +#### GDB |
| 42 | +It is possible to inspect a Mojo Shell process using GDB. The `debugger` script |
| 43 | +can be used to launch GDB and attach it to a running shell process (android |
| 44 | +only): |
| 45 | + |
| 46 | +```sh |
| 47 | +debugger gdb attach |
31 | 48 | ```
|
32 |
| -git clone https://github.com/domokit/devtools.git |
| 49 | + |
| 50 | +#### Android crash stacks |
| 51 | +When Mojo shell crashes on Android ("Unfortunately, Mojo shell has stopped.") |
| 52 | +due to a crash in native code, `debugger` can be used to find and symbolize the |
| 53 | +stack trace present in the device log: |
| 54 | + |
| 55 | +```sh |
| 56 | +debugger device stack |
33 | 57 | ```
|
34 | 58 |
|
| 59 | +### devtoolslib |
| 60 | + |
| 61 | +**devtoolslib** is a Python module containing the core scripting functionality |
| 62 | +for running Mojo apps: shell abstraction with implementations for Android and |
| 63 | +Linux and support for apptest frameworks. The executable scripts in devtools are |
| 64 | +based on this module. One can also choose to embed the functionality provided by |
| 65 | +**devtoolslib** in their own wrapper. |
| 66 | + |
35 | 67 | ## Development
|
36 | 68 |
|
37 | 69 | The library is canonically developed [in the mojo
|
|
0 commit comments