andybons | e6a8f2bd | 2015-08-31 22:46:01 | [diff] [blame] | 1 | # Tips for debugging on Linux |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 2 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 3 | This page is for Chromium-specific debugging tips; learning how to run gdb is |
| 4 | out of scope. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 5 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 6 | [TOC] |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 7 | |
| 8 | ## Symbolized stack trace |
| 9 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 10 | The sandbox can interfere with the internal symbolizer. Use `--no-sandbox` (but |
| 11 | keep this temporary) or an external symbolizer (see |
| 12 | `tools/valgrind/asan/asan_symbolize.py`). |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 13 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 14 | Generally, do not use `--no-sandbox` on waterfall bots, sandbox testing is |
| 15 | needed. Talk to security@chromium.org. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 16 | |
| 17 | ## GDB |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 18 | |
nodir | a6074d4c | 2015-09-01 04:26:45 | [diff] [blame] | 19 | *** promo |
| 20 | GDB-7.7 is required in order to debug Chrome on Linux. |
| 21 | *** |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 22 | |
| 23 | Any prior version will fail to resolve symbols or segfault. |
| 24 | |
Brett Wilson | 41a7de0 | 2023-04-27 18:56:54 | [diff] [blame] | 25 | ### Setup |
| 26 | |
| 27 | #### Build setup |
| 28 | |
| 29 | In your build set the GN build variable `symbol_level = 2` for interactive |
| 30 | debugging. (`symbol_level = 1` only provides backtrace information). And while |
| 31 | release-mode debugging is possible, things will be much easier in a debug build. |
| 32 | Set your build args with `gn args out/<your_dir>` (substituting your build |
| 33 | directory), and set: |
| 34 | |
| 35 | ``` |
| 36 | is_debug = true |
| 37 | symbol_level = 2 |
| 38 | ``` |
| 39 | |
| 40 | #### GDB setup |
| 41 | |
| 42 | The Chrome build requires some GDB configuration for it to be able to find |
Taiyo Mizuhashi | d0f90c9d | 2023-05-31 00:55:23 | [diff] [blame] | 43 | source files. See [gdbinit](../gdbinit.md) to configure GDB. There is a similar |
| 44 | process for [LLDB](../lldbinit.md). |
Brett Wilson | 41a7de0 | 2023-04-27 18:56:54 | [diff] [blame] | 45 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 46 | ### Basic browser process debugging |
| 47 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 48 | gdb -tui -ex=r --args out/Debug/chrome --disable-seccomp-sandbox \ |
| 49 | http://google.com |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 50 | |
| 51 | ### Allowing attaching to foreign processes |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 52 | |
| 53 | On distributions that use the |
| 54 | [Yama LSM](https://www.kernel.org/doc/Documentation/security/Yama.txt) (that |
| 55 | includes Ubuntu and Chrome OS), process A can attach to process B only if A is |
| 56 | an ancestor of B. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 57 | |
| 58 | You will probably want to disable this feature by using |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 59 | |
| 60 | echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 61 | |
| 62 | If you don't you'll get an error message such as "Could not attach to process". |
| 63 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 64 | Note that you'll also probably want to use `--no-sandbox`, as explained below. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 65 | |
| 66 | ### Multiprocess Tricks |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 67 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 68 | #### Getting renderer subprocesses into gdb |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 69 | |
| 70 | Since Chromium itself spawns the renderers, it can be tricky to grab a |
| 71 | particular with gdb. This command does the trick: |
| 72 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 73 | ``` |
| 74 | chrome --no-sandbox --renderer-cmd-prefix='xterm -title renderer -e gdb --args' |
| 75 | ``` |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 76 | |
| 77 | The `--no-sandbox` flag is needed because otherwise the seccomp sandbox will |
| 78 | kill the renderer process on startup, or the setuid sandbox will prevent xterm's |
| 79 | execution. The "xterm" is necessary or gdb will run in the current terminal, |
| 80 | which can get particularly confusing since it's running in the background, and |
| 81 | if you're also running the main process in gdb, won't work at all (the two |
| 82 | instances will fight over the terminal). To auto-start the renderers in the |
| 83 | debugger, send the "run" command to the debugger: |
| 84 | |
nodir | a6074d4c | 2015-09-01 04:26:45 | [diff] [blame] | 85 | chrome --no-sandbox --renderer-cmd-prefix='xterm -title renderer -e gdb \ |
Zhang Hao | a9522488 | 2021-05-12 11:26:36 | [diff] [blame] | 86 | -ex run --args' |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 87 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 88 | If you're using Emacs and `M-x gdb`, you can do |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 89 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 90 | chrome "--renderer-cmd-prefix=gdb --args" |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 91 | |
nodir | a6074d4c | 2015-09-01 04:26:45 | [diff] [blame] | 92 | *** note |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 93 | Note: using the `--renderer-cmd-prefix` option bypasses the zygote launcher, so |
| 94 | the renderers won't be sandboxed. It is generally not an issue, except when you |
| 95 | are trying to debug interactions with the sandbox. If that's what you are doing, |
| 96 | you will need to attach your debugger to a running renderer process (see below). |
nodir | a6074d4c | 2015-09-01 04:26:45 | [diff] [blame] | 97 | *** |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 98 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 99 | You may also want to pass `--disable-hang-monitor` to suppress the hang monitor, |
| 100 | which is rather annoying. |
| 101 | |
| 102 | You can also use `--renderer-startup-dialog` and attach to the process in order |
| 103 | to debug the renderer code. Go to |
xiaoyin.l | 1003c0b | 2016-12-06 02:51:17 | [diff] [blame] | 104 | https://www.chromium.org/blink/getting-started-with-blink-debugging for more |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 105 | information on how this can be done. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 106 | |
Alex Gough | 2092674 | 2021-05-13 20:11:30 | [diff] [blame] | 107 | For utilities you can use `--utility-startup-dialog` to have all utilities |
| 108 | prompt, or `--utility-startup-dialog=data_decoder.mojom.DataDecoderService` |
| 109 | to debug only a particular service type. |
| 110 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 111 | #### Choosing which renderers to debug |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 112 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 113 | If you are starting multiple renderers then the above means that multiple gdb's |
| 114 | start and fight over the console. Instead, you can set the prefix to point to |
| 115 | this shell script: |
| 116 | |
| 117 | ```sh |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 118 | #!/bin/sh |
| 119 | |
| 120 | echo "**** Child $$ starting: y to debug" |
| 121 | read input |
| 122 | if [ "$input" = "y" ] ; then |
| 123 | gdb --args $* |
| 124 | else |
| 125 | $* |
| 126 | fi |
| 127 | ``` |
| 128 | |
Robert Flack | cdbf8c4a | 2022-11-18 18:12:34 | [diff] [blame] | 129 | #### Choosing renderer to debug by URL |
| 130 | |
| 131 | In most cases you'll want to debug the renderer which is loading a particular |
| 132 | site. If you want a script which will automatically debug the renderer which has |
| 133 | visited a given target URL and continue all other renderers, you can use the |
| 134 | following: |
| 135 | |
| 136 | ```sh |
| 137 | ./third_party/blink/tools/debug_renderer out/Default/content_shell https://example.domain/path |
| 138 | ``` |
| 139 | |
| 140 | The script also supports specifying a different URL than the navigation URL. |
| 141 | This is useful when the renderer you want to debug is not the top frame but one |
| 142 | of the subframes on the page. For example, you could debug a particular subframe |
| 143 | on a page with: |
| 144 | |
| 145 | ```sh |
| 146 | ./third_party/blink/tools/debug_renderer -d https://subframe.url/path out/Default/content_shell https://example.domain/path |
| 147 | ``` |
| 148 | |
| 149 | However, if you need more fine-grained control over which renderers to debug |
| 150 | you can run chrome or content_shell directly with the |
| 151 | `--wait-for-debugger-on-navigation` flag which will pause each renderer at the |
| 152 | point of navigation (when the URL is known). |
| 153 | |
| 154 | This will result in a series of lines such as the following in the output: |
| 155 | ``` |
| 156 | ...:content_switches_internal.cc(119)] Renderer url="https://example.domain/path" (PID) paused waiting for debugger to attach. Send SIGUSR1 to unpause. |
| 157 | ``` |
| 158 | |
| 159 | You can signal the renderers you aren't interested in to continue running with: |
| 160 | ```sh |
| 161 | kill -s SIGUSR1 <pid> |
| 162 | ``` |
| 163 | |
| 164 | And debug the renderer you are interested in debugging with: |
| 165 | ```sh |
| 166 | gdb -p <pid> |
| 167 | ``` |
| 168 | |
Robert Flack | 6bbefe7 | 2023-02-24 18:49:51 | [diff] [blame] | 169 | #### Debugging run_web_tests.py renderers |
| 170 | |
| 171 | The `debug_renderer` script can also be used to debug the renderer running |
Jonathan Lee | e95877f | 2023-09-26 21:16:30 | [diff] [blame] | 172 | a web test. To do so, simply call `run_{web,wpt}_tests.py` from `debug_renderer` |
| 173 | with all of the standard arguments for `run_{web,wpt}_tests.py`. For example: |
Robert Flack | 6bbefe7 | 2023-02-24 18:49:51 | [diff] [blame] | 174 | |
| 175 | ```sh |
| 176 | ./third_party/blink/tools/debug_renderer ./third_party/blink/tools/run_web_tests.py [run_web_test args] |
| 177 | ``` |
| 178 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 179 | #### Selective breakpoints |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 180 | |
| 181 | When debugging both the browser and renderer process, you might want to have |
| 182 | separate set of breakpoints to hit. You can use gdb's command files to |
| 183 | accomplish this by putting breakpoints in separate files and instructing gdb to |
| 184 | load them. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 185 | |
| 186 | ``` |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 187 | gdb -x ~/debug/browser --args chrome --no-sandbox --disable-hang-monitor \ |
| 188 | --renderer-cmd-prefix='xterm -title renderer -e gdb -x ~/debug/renderer \ |
| 189 | --args ' |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 190 | ``` |
| 191 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 192 | Also, instead of running gdb, you can use the script above, which let's you |
| 193 | select which renderer process to debug. Note: you might need to use the full |
| 194 | path to the script and avoid `$HOME` or `~/.` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 195 | |
| 196 | #### Connecting to a running renderer |
| 197 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 198 | Usually `ps aux | grep chrome` will not give very helpful output. Try |
| 199 | `pstree -p | grep chrome` to get something like |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 200 | |
| 201 | ``` |
| 202 | | |-bash(21969)---chrome(672)-+-chrome(694) |
| 203 | | | |-chrome(695)---chrome(696)-+-{chrome}(697) |
| 204 | | | | \-{chrome}(709) |
| 205 | | | |-{chrome}(675) |
| 206 | | | |-{chrome}(678) |
| 207 | | | |-{chrome}(679) |
| 208 | | | |-{chrome}(680) |
| 209 | | | |-{chrome}(681) |
| 210 | | | |-{chrome}(682) |
| 211 | | | |-{chrome}(684) |
| 212 | | | |-{chrome}(685) |
| 213 | | | |-{chrome}(705) |
| 214 | | | \-{chrome}(717) |
| 215 | ``` |
| 216 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 217 | Most of those are threads. In this case the browser process would be 672 and the |
| 218 | (sole) renderer process is 696. You can use `gdb -p 696` to attach. |
| 219 | Alternatively, you might find out the process ID from Chrome's built-in Task |
| 220 | Manager (under the Tools menu). Right-click on the Task Manager, and enable |
| 221 | "Process ID" in the list of columns. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 222 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 223 | Note: by default, sandboxed processes can't be attached by a debugger. To be |
| 224 | able to do so, you will need to pass the `--allow-sandbox-debugging` option. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 225 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 226 | If the problem only occurs with the seccomp sandbox enabled (and the previous |
| 227 | tricks don't help), you could try enabling core-dumps (see the **Core files** |
| 228 | section). That would allow you to get a backtrace and see some local variables, |
| 229 | though you won't be able to step through the running program. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 230 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 231 | Note: If you're interested in debugging LinuxSandboxIPC process, you can attach |
| 232 | to 694 in the above diagram. The LinuxSandboxIPC process has the same command |
| 233 | line flag as the browser process so that it's easy to identify it if you run |
| 234 | `pstree -pa`. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 235 | |
| 236 | #### Getting GPU subprocesses into gdb |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 237 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 238 | Use `--gpu-launcher` flag instead of `--renderer-cmd-prefix` in the instructions |
| 239 | for renderer above. |
| 240 | |
| 241 | #### Getting `browser_tests` launched browsers into gdb |
| 242 | |
| 243 | Use environment variable `BROWSER_WRAPPER` instead of `--renderer-cmd-prefix` |
| 244 | switch in the instructions above. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 245 | |
| 246 | Example: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 247 | |
| 248 | ```shell |
| 249 | BROWSER_WRAPPER='xterm -title renderer -e gdb --eval-command=run \ |
| 250 | --eval-command=quit --args' out/Debug/browser_tests --gtest_filter=Print |
| 251 | ``` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 252 | |
| 253 | #### Plugin Processes |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 254 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 255 | Same strategies as renderers above, but the flag is called `--plugin-launcher`: |
| 256 | |
| 257 | chrome --plugin-launcher='xterm -e gdb --args' |
| 258 | |
nodir | a6074d4c | 2015-09-01 04:26:45 | [diff] [blame] | 259 | *** note |
| 260 | Note: For now, this does not currently apply to PPAPI plugins because they |
| 261 | currently run in the renderer process. |
| 262 | *** |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 263 | |
| 264 | #### Single-Process mode |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 265 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 266 | Depending on whether it's relevant to the problem, it's often easier to just run |
| 267 | in "single process" mode where the renderer threads are in-process. Then you can |
| 268 | just run gdb on the main process. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 269 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 270 | gdb --args chrome --single-process |
| 271 | |
| 272 | Currently, the `--disable-gpu` flag is also required, as there are known crashes |
| 273 | that occur under TextureImageTransportSurface without it. The crash described in |
xiaoyin.l | 1003c0b | 2016-12-06 02:51:17 | [diff] [blame] | 274 | https://crbug.com/361689 can also sometimes occur, but that crash can be |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 275 | continued from without harm. |
| 276 | |
| 277 | Note that for technical reasons plugins cannot be in-process, so |
| 278 | `--single-process` only puts the renderers in the browser process. The flag is |
| 279 | still useful for debugging plugins (since it's only two processes instead of |
| 280 | three) but you'll still need to use `--plugin-launcher` or another approach. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 281 | |
| 282 | ### Printing Chromium types |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 283 | |
Tom Anderson | f06ac38 | 2019-04-10 03:49:38 | [diff] [blame] | 284 | gdb 7 lets us use Python to write pretty-printers for Chromium types. See |
Taiyo Mizuhashi | d0f90c9d | 2023-05-31 00:55:23 | [diff] [blame] | 285 | [gdbinit](../gdbinit.md) |
Tom Anderson | f06ac38 | 2019-04-10 03:49:38 | [diff] [blame] | 286 | to enable pretty-printing of Chromium types. This will import Blink |
| 287 | pretty-printers as well. |
Kenichi Ishibashi | e17b8d9f | 2018-04-26 03:32:46 | [diff] [blame] | 288 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 289 | Pretty printers for std types shouldn't be necessary in gdb 7, but they're |
| 290 | provided here in case you're using an older gdb. Put the following into |
| 291 | `~/.gdbinit`: |
| 292 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 293 | ``` |
| 294 | # Print a C++ string. |
| 295 | define ps |
| 296 | print $arg0.c_str() |
| 297 | end |
| 298 | |
| 299 | # Print a C++ wstring or wchar_t*. |
| 300 | define pws |
| 301 | printf "\"" |
| 302 | set $c = (wchar_t*)$arg0 |
| 303 | while ( *$c ) |
| 304 | if ( *$c > 0x7f ) |
| 305 | printf "[%x]", *$c |
| 306 | else |
| 307 | printf "%c", *$c |
| 308 | end |
| 309 | set $c++ |
| 310 | end |
| 311 | printf "\"\n" |
| 312 | end |
| 313 | ``` |
| 314 | |
| 315 | [More STL GDB macros](http://www.yolinux.com/TUTORIALS/src/dbinit_stl_views-1.01.txt) |
| 316 | |
Christian Biesinger | 3332bb3a | 2019-08-13 05:45:23 | [diff] [blame] | 317 | ### JsDbg -- visualize data structures in the browser |
| 318 | |
| 319 | JsDbg is a debugger plugin to display various Chrome data structures in a |
| 320 | browser window, such as the accessibility tree, layout object tree, DOM tree, |
| 321 | and others. |
| 322 | [Installation instructions are here](https://github.com/MicrosoftEdge/JsDbg), |
| 323 | and see [here](https://github.com/MicrosoftEdge/JsDbg/blob/master/docs/FEATURES.md) |
| 324 | for screenshots and an introduction. |
| 325 | |
| 326 | For Googlers, please see [go/jsdbg](https://goto.google.com/jsdbg) for |
| 327 | installation instructions. |
| 328 | |
| 329 | ### Time travel debugging with rr |
| 330 | |
| 331 | You can use [rr](https://rr-project.org) for time travel debugging, so you |
| 332 | can also step or execute backwards. This works by first recording a trace |
L. David Baron | e99d91eb | 2021-03-30 20:18:00 | [diff] [blame] | 333 | and then debugging based on that. |
Christian Biesinger | 3332bb3a | 2019-08-13 05:45:23 | [diff] [blame] | 334 | |
Jie Sheng | 01180e6 | 2025-03-29 03:48:01 | [diff] [blame] | 335 | For Googlers, if you have a remote cloud machine, please follow this |
| 336 | [instruction](https://engdoc.corp.google.com/eng/doc/devguide/debugging/rr.md#setting-up-rr) |
| 337 | to set up the machine in order to use the rr tool. |
| 338 | |
Steve Kobes | 8ce3e44d | 2022-01-28 22:36:59 | [diff] [blame] | 339 | You need an up-to-date version of rr, since rr is frequently updated to support |
| 340 | new parts of the Linux system call API surface that Chromium uses. If you have |
| 341 | any issues with the latest release version, try compiling rr |
L. David Baron | e99d91eb | 2021-03-30 20:18:00 | [diff] [blame] | 342 | [from source](https://github.com/rr-debugger/rr/wiki/Building-And-Installing). |
Robert Flack | c9e6995 | 2020-05-13 19:52:31 | [diff] [blame] | 343 | |
Christian Biesinger | 3332bb3a | 2019-08-13 05:45:23 | [diff] [blame] | 344 | Once installed, you can use it like this: |
| 345 | ``` |
Steve Kobes | 8ce3e44d | 2022-01-28 22:36:59 | [diff] [blame] | 346 | rr record out/Debug/content_shell --single-process |
Christian Biesinger | 3332bb3a | 2019-08-13 05:45:23 | [diff] [blame] | 347 | rr replay |
Steve Kobes | 8ce3e44d | 2022-01-28 22:36:59 | [diff] [blame] | 348 | (rr) c |
| 349 | (rr) break blink::NGBlockNode::Layout |
| 350 | (rr) rc # reverse-continue to the last Layout call |
| 351 | (rr) jsdbg # run JsDbg as described above to find the interesting object |
| 352 | (rr) watch -l box_->frame_rect_.size_.width_.value_ |
| 353 | (rr) rc # reverse-continue to the last time the width was changed |
| 354 | (rr) rn # reverse-next to the previous line |
| 355 | (rr) reverse-fin # run to where this function was called from |
Christian Biesinger | 3332bb3a | 2019-08-13 05:45:23 | [diff] [blame] | 356 | ``` |
| 357 | |
L. David Baron | e99d91eb | 2021-03-30 20:18:00 | [diff] [blame] | 358 | You can debug multi-process chrome using `rr -f [PID]` |
Steve Kobes | 8ce3e44d | 2022-01-28 22:36:59 | [diff] [blame] | 359 | for processes `fork()`ed from a [zygote process](zygote.md) without exec, |
| 360 | which includes renderer processes, |
| 361 | or `rr -p [PID]` for other processes. |
| 362 | To find the process id you can either run `rr ps` after recording, or for |
| 363 | renderer processes use `--vmodule=render_frame_impl=1` which will log a |
| 364 | message on navigations. Example: |
Robert Flack | e13e0b1 | 2020-04-16 17:03:58 | [diff] [blame] | 365 | |
| 366 | ``` |
Steve Kobes | 8ce3e44d | 2022-01-28 22:36:59 | [diff] [blame] | 367 | $ rr record out/Debug/content_shell --disable-hang-monitor --vmodule=render_frame_impl=1 https://www.google.com/ |
Robert Flack | e13e0b1 | 2020-04-16 17:03:58 | [diff] [blame] | 368 | rr: Saving execution to trace directory `...'. |
| 369 | ... |
| 370 | [128515:128515:0320/164124.768687:VERBOSE1:render_frame_impl.cc(4244)] Committed provisional load: https://www.google.com/ |
| 371 | ``` |
| 372 | |
| 373 | From the log message we can see that the site was loaded into process 128515 |
| 374 | and can set a breakpoint for when that process is forked. |
| 375 | |
| 376 | ``` |
| 377 | rr replay -f 128515 |
| 378 | ``` |
| 379 | |
L. David Baron | e99d91eb | 2021-03-30 20:18:00 | [diff] [blame] | 380 | If you want to call debugging functions from gdb that use `LOG()`, |
Steve Kobes | 8ce3e44d | 2022-01-28 22:36:59 | [diff] [blame] | 381 | then those functions need to disable the printing of timestamps using |
| 382 | [`SetLogItems`](https://source.chromium.org/search?q=SetLogItems&sq=&ss=chromium%2Fchromium%2Fsrc). |
| 383 | See `LayoutObject::ShowLayoutObject()` for an example of this, and |
| 384 | [issue 2829](https://github.com/rr-debugger/rr/issues/2829) for why it is needed. |
L. David Baron | e99d91eb | 2021-03-30 20:18:00 | [diff] [blame] | 385 | |
Steve Kobes | 8ce3e44d | 2022-01-28 22:36:59 | [diff] [blame] | 386 | If rr doesn't work correctly, the rr developers are generally quite responsive |
| 387 | to [bug reports](https://github.com/rr-debugger/rr/issues), |
L. David Baron | e99d91eb | 2021-03-30 20:18:00 | [diff] [blame] | 388 | especially ones that have enough information so that |
| 389 | they don't have to build Chromium. |
| 390 | |
| 391 | See Also: |
Steve Kobes | 8ce3e44d | 2022-01-28 22:36:59 | [diff] [blame] | 392 | |
L. David Baron | e99d91eb | 2021-03-30 20:18:00 | [diff] [blame] | 393 | * [The Chromium Chronicle #13: Time-Travel Debugging with RR](https://developer.chrome.com/blog/chromium-chronicle-13/) |
Steve Kobes | 8ce3e44d | 2022-01-28 22:36:59 | [diff] [blame] | 394 | * [@davidbaron demo using rr](https://twitter.com/davidbaron/status/1473761042278887433) |
| 395 | * [@davidbaron demo using pernosco](https://twitter.com/davidbaron/status/1475836824409022469) |
| 396 | (Googlers: see [go/pernosco](https://goto.google.com/pernosco)) |
L. David Baron | e99d91eb | 2021-03-30 20:18:00 | [diff] [blame] | 397 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 398 | ### Graphical Debugging Aid for Chromium Views |
| 399 | |
| 400 | The following link describes a tool that can be used on Linux, Windows and Mac under GDB. |
| 401 | |
sisidovski | f270241c | 2021-08-04 07:07:44 | [diff] [blame] | 402 | [graphical_debugging_aid_chromium_views](../graphical_debugging_aid_chromium_views.md) |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 403 | |
| 404 | ### Faster startup |
| 405 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 406 | Use the `gdb-add-index` script (e.g. |
| 407 | `build/gdb-add-index out/Debug/browser_tests`) |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 408 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 409 | Only makes sense if you run the binary multiple times or maybe if you use the |
nodir | a6074d4c | 2015-09-01 04:26:45 | [diff] [blame] | 410 | component build since most `.so` files won't require reindexing on a rebuild. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 411 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 412 | See |
| 413 | https://groups.google.com/a/chromium.org/forum/#!searchin/chromium-dev/gdb-add-index/chromium-dev/ELRuj1BDCL4/5Ki4LGx41CcJ |
| 414 | for more info. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 415 | |
Takuto Ikuta | a093dc2 | 2020-11-11 03:17:50 | [diff] [blame] | 416 | You can improve GDB load time significantly at the cost of link time by not |
brettw | 20d800c | 2016-04-12 00:10:49 | [diff] [blame] | 417 | splitting symbols from the object files. In GN, set `use_debug_fission=false` in |
| 418 | your "gn args". |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 419 | |
| 420 | ## Core files |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 421 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 422 | `ulimit -c unlimited` should cause all Chrome processes (run from that shell) to |
| 423 | dump cores, with the possible exception of some sandboxed processes. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 424 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 425 | Some sandboxed subprocesses might not dump cores unless you pass the |
| 426 | `--allow-sandbox-debugging` flag. |
| 427 | |
| 428 | If the problem is a freeze rather than a crash, you may be able to trigger a |
| 429 | core-dump by sending SIGABRT to the relevant process: |
| 430 | |
| 431 | kill -6 [process id] |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 432 | |
| 433 | ## Breakpad minidump files |
| 434 | |
Tom Anderson | abdbd6a | 2020-01-09 16:59:27 | [diff] [blame] | 435 | See [minidump_to_core.md](minidump_to_core.md) |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 436 | |
| 437 | ## Running Tests |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 438 | |
| 439 | Many of our tests bring up windows on screen. This can be annoying (they steal |
| 440 | your focus) and hard to debug (they receive extra events as you mouse over them). |
| 441 | Instead, use `Xvfb` or `Xephyr` to run a nested X session to debug them, as |
sisidovski | f270241c | 2021-08-04 07:07:44 | [diff] [blame] | 442 | outlined on [testing/web_tests_linux.md](../testing/web_tests_linux.md). |
Brett Wilson | 41a7de0 | 2023-04-27 18:56:54 | [diff] [blame] | 443 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 444 | ### Browser tests |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 445 | |
| 446 | By default the `browser_tests` forks a new browser for each test. To debug the |
| 447 | browser side of a single test, use a command like |
| 448 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 449 | ``` |
Thomas Lukaszewicz | 2c5fb614 | 2019-10-14 19:20:05 | [diff] [blame] | 450 | gdb --args out/Debug/browser_tests --single-process-tests --gtest_filter=MyTestName |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 451 | ``` |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 452 | |
Thomas Lukaszewicz | 2c5fb614 | 2019-10-14 19:20:05 | [diff] [blame] | 453 | **note the use of `single-process-tests`** -- this makes the test harness and |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 454 | browser process share the outermost process. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 455 | |
Brett Wilson | 41a7de0 | 2023-04-27 18:56:54 | [diff] [blame] | 456 | The switch `--gtest_break_on_failure` can also be useful to automatically stop |
| 457 | debugger upon `ASSERT` or `EXPECT` failures. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 458 | |
| 459 | To debug a renderer process in this case, use the tips above about renderers. |
| 460 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 461 | ### Web tests |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 462 | |
sisidovski | f270241c | 2021-08-04 07:07:44 | [diff] [blame] | 463 | See [testing/web_tests_linux.md](../testing/web_tests_linux.md) for some tips. In particular, |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 464 | note that it's possible to debug a web test via `ssh`ing to a Linux box; you |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 465 | don't need anything on screen if you use `Xvfb`. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 466 | |
| 467 | ### UI tests |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 468 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 469 | UI tests are run in forked browsers. Unlike browser tests, you cannot do any |
| 470 | single process tricks here to debug the browser. See below about |
| 471 | `BROWSER_WRAPPER`. |
| 472 | |
| 473 | To pass flags to the browser, use a command line like |
| 474 | `--extra-chrome-flags="--foo --bar"`. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 475 | |
| 476 | ### Timeouts |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 477 | |
| 478 | UI tests have a confusing array of timeouts in place. (Pawel is working on |
| 479 | reducing the number of timeouts.) To disable them while you debug, set the |
| 480 | timeout flags to a large value: |
| 481 | |
| 482 | * `--test-timeout=100000000` |
| 483 | * `--ui-test-action-timeout=100000000` |
| 484 | * `--ui-test-terminate-timeout=100000000` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 485 | |
| 486 | ### To replicate Window Manager setup on the bots |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 487 | |
| 488 | Chromium try bots and main waterfall's bots run tests under Xvfb&openbox |
| 489 | combination. Xvfb is an X11 server that redirects the graphical output to the |
| 490 | memory, and openbox is a simple window manager that is running on top of Xvfb. |
| 491 | The behavior of openbox is markedly different when it comes to focus management |
| 492 | and other window tasks, so test that runs fine locally may fail or be flaky on |
| 493 | try bots. To run the tests on a local machine as on a bot, follow these steps: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 494 | |
| 495 | Make sure you have openbox: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 496 | |
| 497 | apt-get install openbox |
| 498 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 499 | Start Xvfb and openbox on a particular display: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 500 | |
| 501 | Xvfb :6.0 -screen 0 1280x1024x24 & DISPLAY=:6.0 openbox & |
| 502 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 503 | Run your tests with graphics output redirected to that display: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 504 | |
| 505 | DISPLAY=:6.0 out/Debug/browser_tests --gtest_filter="MyBrowserTest.MyActivateWindowTest" |
| 506 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 507 | You can look at a snapshot of the output by: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 508 | |
| 509 | xwd -display :6.0 -root | xwud |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 510 | |
| 511 | Alternatively, you can use testing/xvfb.py to set up your environment for you: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 512 | |
thomasanderson | 3d07428 | 2016-12-06 18:21:12 | [diff] [blame] | 513 | testing/xvfb.py out/Debug/browser_tests \ |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 514 | --gtest_filter="MyBrowserTest.MyActivateWindowTest" |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 515 | |
nodir | a6074d4c | 2015-09-01 04:26:45 | [diff] [blame] | 516 | ### BROWSER_WRAPPER |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 517 | |
| 518 | You can also get the browser under a debugger by setting the `BROWSER_WRAPPER` |
| 519 | environment variable. (You can use this for `browser_tests` too, but see above |
| 520 | for discussion of a simpler way.) |
| 521 | |
| 522 | BROWSER_WRAPPER='xterm -e gdb --args' out/Debug/browser_tests |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 523 | |
qyearsley | c0dc6f4 | 2016-12-02 22:13:39 | [diff] [blame] | 524 | ### Replicating try bot Slowness |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 525 | |
qyearsley | c0dc6f4 | 2016-12-02 22:13:39 | [diff] [blame] | 526 | Try bots are pretty stressed, and can sometimes expose timing issues you can't |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 527 | normally reproduce locally. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 528 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 529 | You can simulate this by shutting down all but one of the CPUs |
| 530 | (http://www.cyberciti.biz/faq/debian-rhel-centos-redhat-suse-hotplug-cpu/) and |
| 531 | running a CPU loading tool (e.g., http://www.devin.com/lookbusy/). Now run your |
qyearsley | c0dc6f4 | 2016-12-02 22:13:39 | [diff] [blame] | 532 | test. It will run slowly, but any flakiness found by the try bot should replicate |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 533 | locally now - and often nearly 100% of the time. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 534 | |
| 535 | ## Logging |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 536 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 537 | ### Seeing all LOG(foo) messages |
| 538 | |
| 539 | Default log level hides `LOG(INFO)`. Run with `--log-level=0` and |
| 540 | `--enable-logging=stderr` flags. |
| 541 | |
qyearsley | c0dc6f4 | 2016-12-02 22:13:39 | [diff] [blame] | 542 | Newer versions of Chromium with VLOG may need --v=1 too. For more VLOG tips, see |
xiaoyin.l | 1003c0b | 2016-12-06 02:51:17 | [diff] [blame] | 543 | [the chromium-dev thread](https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/dcd0cd7752b35de6?pli=1). |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 544 | |
| 545 | ### Seeing IPC debug messages |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 546 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 547 | Run with `CHROME_IPC_LOGGING=1` eg. |
| 548 | |
| 549 | CHROME_IPC_LOGGING=1 out/Debug/chrome |
| 550 | |
| 551 | or within gdb: |
| 552 | |
| 553 | set environment CHROME_IPC_LOGGING 1 |
| 554 | |
| 555 | If some messages show as unknown, check if the list of IPC message headers in |
nodir | a6074d4c | 2015-09-01 04:26:45 | [diff] [blame] | 556 | [chrome/common/logging_chrome.cc](/chrome/common/logging_chrome.cc) is |
thakis | 3e861de | 2016-06-14 14:24:01 | [diff] [blame] | 557 | up to date. In case this file reference goes out of date, try looking for usage |
nodir | a6074d4c | 2015-09-01 04:26:45 | [diff] [blame] | 558 | of macros like `IPC_MESSAGE_LOG_ENABLED` or `IPC_MESSAGE_MACROS_LOG_ENABLED`. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 559 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 560 | ## Profiling |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 561 | |
| 562 | See |
| 563 | https://sites.google.com/a/chromium.org/dev/developers/profiling-chromium-and-webkit |
Tom Anderson | 93e49e49 | 2019-12-23 19:55:37 | [diff] [blame] | 564 | and [Linux Profiling](profiling.md). |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 565 | |
| 566 | ## i18n |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 567 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 568 | We obey your system locale. Try something like: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 569 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 570 | LANG=ja_JP.UTF-8 out/Debug/chrome |
| 571 | |
| 572 | If this doesn't work, make sure that the `LANGUAGE`, `LC_ALL` and `LC_MESSAGE` |
| 573 | environment variables aren't set -- they have higher priority than LANG in the |
| 574 | order listed. Alternatively, just do this: |
| 575 | |
| 576 | LANGUAGE=fr out/Debug/chrome |
| 577 | |
| 578 | Note that because we use GTK, some locale data comes from the system -- for |
| 579 | example, file save boxes and whether the current language is considered RTL. |
| 580 | Without all the language data available, Chrome will use a mixture of your |
| 581 | system language and the language you run Chrome in. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 582 | |
| 583 | Here's how to install the Arabic (ar) and Hebrew (he) language packs: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 584 | |
| 585 | sudo apt-get install language-pack-ar language-pack-he \ |
| 586 | language-pack-gnome-ar language-pack-gnome-he |
| 587 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 588 | Note that the `--lang` flag does **not** work properly for this. |
| 589 | |
Tom Anderson | 287339e | 2018-08-22 21:52:02 | [diff] [blame] | 590 | On non-Debian systems, you need the `gtk30.mo` files. (Please update these docs |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 591 | with the appropriate instructions if you know what they are.) |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 592 | |
| 593 | ## Breakpad |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 594 | |
Tom Anderson | 93e49e49 | 2019-12-23 19:55:37 | [diff] [blame] | 595 | See the last section of [Linux Crash Dumping](crash_dumping.md). |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 596 | |
| 597 | ## Drag and Drop |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 598 | |
| 599 | If you break in a debugger during a drag, Chrome will have grabbed your mouse |
| 600 | and keyboard so you won't be able to interact with the debugger! To work around |
| 601 | this, run via `Xephyr`. Instructions for how to use `Xephyr` are on the |
sisidovski | f270241c | 2021-08-04 07:07:44 | [diff] [blame] | 602 | [Running web tests on Linux](../testing/web_tests_linux.md) page. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 603 | |
| 604 | ## Tracking Down Bugs |
| 605 | |
| 606 | ### Isolating Regressions |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 607 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 608 | Old builds are archived here: |
xiaoyin.l | 1003c0b | 2016-12-06 02:51:17 | [diff] [blame] | 609 | https://build.chromium.org/buildbot/snapshots/chromium-rel-linux/ |
nodir | a6074d4c | 2015-09-01 04:26:45 | [diff] [blame] | 610 | (TODO: does not exist). |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 611 | |
| 612 | `tools/bisect-builds.py` in the tree automates bisecting through the archived |
| 613 | builds. Despite a computer science education, I am still amazed how quickly |
| 614 | binary search will find its target. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 615 | |
| 616 | ### Screen recording for bug reports |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 617 | |
| 618 | sudo apt-get install gtk-recordmydesktop |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 619 | |
| 620 | ## Version-specific issues |
| 621 | |
| 622 | ### Google Chrome |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 623 | |
| 624 | Google Chrome binaries don't include symbols. Googlers can read where to get |
| 625 | symbols from |
| 626 | [the Google-internal wiki](http://wiki/Main/ChromeOfficialBuildLinux#The_Build_Archive). |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 627 | |
| 628 | ### Ubuntu Chromium |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 629 | |
| 630 | Since we don't build the Ubuntu packages (Ubuntu does) we can't get useful |
| 631 | backtraces from them. Direct users to https://wiki.ubuntu.com/Chromium/Debugging |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 632 | |
| 633 | ### Fedora's Chromium |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 634 | |
| 635 | Like Ubuntu, but direct users to |
| 636 | https://fedoraproject.org/wiki/TomCallaway/Chromium_Debug |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 637 | |
| 638 | ### Xlib |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 639 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 640 | If you're trying to track down X errors like: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 641 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 642 | ``` |
| 643 | The program 'chrome' received an X Window System error. |
| 644 | This probably reflects a bug in the program. |
| 645 | The error was 'BadDrawable (invalid Pixmap or Window parameter)'. |
| 646 | ``` |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 647 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 648 | Some strategies are: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 649 | |
| 650 | * pass `--sync` on the command line to make all X calls synchronous |
| 651 | * run chrome via [xtrace](http://xtrace.alioth.debian.org/) |
| 652 | * turn on IPC debugging (see above section) |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 653 | |
| 654 | ### Window Managers |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 655 | |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 656 | To test on various window managers, you can use a nested X server like `Xephyr`. |
| 657 | Instructions for how to use `Xephyr` are on the |
sisidovski | f270241c | 2021-08-04 07:07:44 | [diff] [blame] | 658 | [Running web tests on Linux](../testing/web_tests_linux.md) page. |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 659 | |
| 660 | If you need to test something with hardware accelerated compositing |
| 661 | (e.g., compiz), you can use `Xgl` (`sudo apt-get install xserver-xgl`). E.g.: |
| 662 | |
| 663 | Xgl :1 -ac -accel glx:pbuffer -accel xv:pbuffer -screen 1024x768 |
| 664 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 665 | ## Mozilla Tips |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 666 | |
| 667 | https://developer.mozilla.org/en/Debugging_Mozilla_on_Linux_FAQ |
Joshua Pawlicki | c2464187d | 2022-02-23 14:27:51 | [diff] [blame] | 668 | |
| 669 | ## Google Chrome Symbol Files |
| 670 | |
| 671 | Symbols for Google Chrome's official builds are available from |
| 672 | `https://edgedl.me.gvt1.com/chrome/linux/symbols/google-chrome-debug-info-linux64-${VERSION}.zip` |
| 673 | where ${VERSION} is any version of Google Chrome that has recently been served |
Robert Flack | cdbf8c4a | 2022-11-18 18:12:34 | [diff] [blame] | 674 | to Stable, Beta, or Unstable (Dev) channels on Linux. |