| OLD | NEW |
| 1 # Devtools | 1 # Devtools |
| 2 | 2 |
| 3 Unopinionated tools for **running**, **debugging** and **testing** Mojo apps. | 3 Unopinionated tools for **running**, **debugging** and **testing** Mojo apps. |
| 4 | 4 |
| 5 ## Install | 5 ## Install |
| 6 | 6 |
| 7 ``` | 7 ``` |
| 8 git clone https://github.com/domokit/devtools.git | 8 git clone https://github.com/domokit/devtools.git |
| 9 ``` | 9 ``` |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 ```sh | 33 ```sh |
| 34 mojo_debug tracing start | 34 mojo_debug tracing start |
| 35 mojo_debug tracing stop [result.json] | 35 mojo_debug tracing stop [result.json] |
| 36 ``` | 36 ``` |
| 37 | 37 |
| 38 The trace file can be then loaded using the trace viewer in Chrome available at | 38 The trace file can be then loaded using the trace viewer in Chrome available at |
| 39 `about://tracing`. | 39 `about://tracing`. |
| 40 | 40 |
| 41 #### GDB | 41 #### GDB |
| 42 It is possible to inspect a Mojo Shell process using GDB. The `debugger` script | 42 It is possible to inspect a Mojo Shell process using GDB. The `mojo_debug` scrip
t |
| 43 can be used to launch GDB and attach it to a running shell process (android | 43 can be used to launch GDB and attach it to a running shell process (android |
| 44 only): | 44 only): |
| 45 | 45 |
| 46 ```sh | 46 ```sh |
| 47 mojo_debug gdb attach | 47 mojo_debug gdb attach |
| 48 ``` | 48 ``` |
| 49 | 49 |
| 50 Once started, GDB will first stop the Mojo Shell execution, then load symbols |
| 51 from loaded Mojo applications. Please note that this initial step can take some |
| 52 time (up to several minutes in the worst case). |
| 53 |
| 54 After each execution pause, GDB will update the set of loaded symbols based on |
| 55 the selected thread only. If you need symbols for all threads, use the |
| 56 `update-symbols` GDB command: |
| 57 ```sh |
| 58 (gdb) update-symbols |
| 59 ``` |
| 60 |
| 61 If you only want to update symbols for the current selected thread (for example, |
| 62 after changing threads), use the `current` option: |
| 63 ```sh |
| 64 (gdb) update-symbols current |
| 65 ``` |
| 66 |
| 50 #### Android crash stacks | 67 #### Android crash stacks |
| 51 When Mojo shell crashes on Android ("Unfortunately, Mojo shell has stopped.") | 68 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 | 69 due to a crash in native code, `mojo_debug` can be used to find and symbolize th
e |
| 53 stack trace present in the device log: | 70 stack trace present in the device log: |
| 54 | 71 |
| 55 ```sh | 72 ```sh |
| 56 mojo_debug device stack | 73 mojo_debug device stack |
| 57 ``` | 74 ``` |
| 58 | 75 |
| 59 ### devtoolslib | 76 ### devtoolslib |
| 60 | 77 |
| 61 **devtoolslib** is a Python module containing the core scripting functionality | 78 **devtoolslib** is a Python module containing the core scripting functionality |
| 62 for running Mojo apps: shell abstraction with implementations for Android and | 79 for running Mojo apps: shell abstraction with implementations for Android and |
| 63 Linux and support for apptest frameworks. The executable scripts in devtools are | 80 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 | 81 based on this module. One can also choose to embed the functionality provided by |
| 65 **devtoolslib** in their own wrapper. | 82 **devtoolslib** in their own wrapper. |
| 66 | 83 |
| 67 ## Development | 84 ## Development |
| 68 | 85 |
| 69 The library is canonically developed [in the mojo | 86 The library is canonically developed [in the mojo |
| 70 repository](https://github.com/domokit/mojo/tree/master/mojo/devtools/common), | 87 repository](https://github.com/domokit/mojo/tree/master/mojo/devtools/common), |
| 71 https://github.com/domokit/devtools is a mirror allowing to consume it | 88 https://github.com/domokit/devtools is a mirror allowing to consume it |
| 72 separately. | 89 separately. |
| OLD | NEW |