| OLD | NEW |
| 1 # Android Debugging Instructions | 1 # Android Debugging Instructions |
| 2 | 2 |
| 3 Chrome on Android has java and c/c++ code. Each "side" have its own set of tools | 3 Chrome on Android has java and c/c++ code. Each "side" have its own set of tools |
| 4 for debugging. Here's some tips. | 4 for debugging. Here's some tips. |
| 5 | 5 |
| 6 [TOC] | 6 [TOC] |
| 7 | 7 |
| 8 ## Setting up command line flags | 8 ## Setting up command line flags |
| 9 | 9 |
| 10 Various commands below requires setting up command line flags. | 10 Various commands below requires setting up command line flags. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 Example: | 86 Example: |
| 87 | 87 |
| 88 ```java | 88 ```java |
| 89 @ViewDebug.ExportedProperty(category="chrome") | 89 @ViewDebug.ExportedProperty(category="chrome") |
| 90 private int mSuperNiftyDrawingProperty; | 90 private int mSuperNiftyDrawingProperty; |
| 91 ``` | 91 ``` |
| 92 | 92 |
| 93 ## Debugging Java | 93 ## Debugging Java |
| 94 | 94 |
| 95 ### Eclipse |
| 95 * In Eclipse, make a debug configuration of type "Remote Java Application". | 96 * In Eclipse, make a debug configuration of type "Remote Java Application". |
| 96 Choose a "Name" and set "Port" to `8700`. | 97 Choose a "Name" and set "Port" to `8700`. |
| 97 | 98 |
| 98 * Make sure Eclipse Preferences > Run/Debug > Launching > "Build (if required) | 99 * Make sure Eclipse Preferences > Run/Debug > Launching > "Build (if required) |
| 99 before launching" is unchecked. | 100 before launching" is unchecked. |
| 100 | 101 |
| 101 * Run Android Device Monitor: | 102 * Run Android Device Monitor: |
| 102 | 103 |
| 103 ```shell | 104 ```shell |
| 104 third_party/android_tools/sdk/tools/monitor | 105 third_party/android_tools/sdk/tools/monitor |
| 105 ``` | 106 ``` |
| 106 | 107 |
| 107 * Now select the process you want to debug in Device Monitor (the port column | 108 * Now select the process you want to debug in Device Monitor (the port column |
| 108 should now mention 8700 or xxxx/8700). | 109 should now mention 8700 or xxxx/8700). |
| 109 | 110 |
| 110 * Run your debug configuration, and switch to the Debug perspective. | 111 * Run your debug configuration, and switch to the Debug perspective. |
| 111 | 112 |
| 113 ### Android Studio |
| 114 * Build and install the desired target |
| 115 |
| 116 * Click the "Attach debugger to Android process" (see |
| 117 [here](https://developer.android.com/studio/debug/index.html) for more) |
| 118 |
| 112 ## Waiting for Java Debugger on Early Startup | 119 ## Waiting for Java Debugger on Early Startup |
| 113 | 120 |
| 114 * To debug early startup, pass `--wait-for-java-debugger` as a command line | 121 * To debug early startup, pass `--wait-for-java-debugger` as a command line |
| 115 flag. | 122 flag. |
| 116 | 123 |
| 117 ## Debugging C/C++ | 124 ## Debugging C/C++ |
| 118 | 125 |
| 119 Under `build/android`, there are a few scripts: | 126 Under `build/android`, there are a few scripts: |
| 120 | 127 |
| 121 ```shell | 128 ```shell |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 build/android/adb_gdb --output-directory=out/Default --package-name=org.chromium
.native_test | 248 build/android/adb_gdb --output-directory=out/Default --package-name=org.chromium
.native_test |
| 242 ``` | 249 ``` |
| 243 | 250 |
| 244 After attaching gdb to the process you can use it normally. For example: | 251 After attaching gdb to the process you can use it normally. For example: |
| 245 | 252 |
| 246 ``` | 253 ``` |
| 247 (gdb) break main | 254 (gdb) break main |
| 248 Breakpoint 1 at 0x9750793c: main. (2 locations) | 255 Breakpoint 1 at 0x9750793c: main. (2 locations) |
| 249 (gdb) continue | 256 (gdb) continue |
| 250 ``` | 257 ``` |
| OLD | NEW |