If the problem only occurs with the seccomp sandbox enabled (and the previous tricks don‘t help), you could try enabling core-dumps (see the Core files section). To be able to do so, you will need to pass the -allow-sandbox-debugging option. Note: by default, sandboxed processes can't be attached by a debugger. Right-click on the Task Manager, and enable “Process ID” in the list of columns. Alternatively, you might find out the process ID from Chrome's built-in Task Manager (under the Tools menu). In this case the browser process would be 672 and the (sole) renderer process is 696. Try pstree -p | grep chrome to get something like | |-bash(21969)-chrome(672)-+-chrome(694) Usually ps aux | grep chrome will not give very helpful output.
How to install gdb in linux full#
Note: you might need to use the full path to the script and avoid $HOME or ~/. renderer-cmd-prefix='xterm -title renderer -e gdb -x ~/debug/renderer \Īlso, instead of running gdb, you can use the script above, which let's you select which renderer process to debug. gdb -x ~/debug/browser -args chrome -no-sandbox -disable-hang-monitor \ You can use gdb's command files to accomplish this by putting breakpoints in separate files and instructing gdb to load them. When debugging both the browser and renderer process, you might want to have separate set of breakpoints to hit. Instead, you can set the prefix to point to this shell script: #!/bin/shĮcho "**** Child $$ starting: y to debug" If you are starting multiple renderers then the above means that multiple gdb's start and fight over the console. Go to for more information on how this can be done.įor utilities you can use -utility-startup-dialog to have all utilities prompt, or -utility-startup-dialog=data_ to debug only a particular service type.
You can also use -renderer-startup-dialog and attach to the process in order to debug the renderer code. You may also want to pass -disable-hang-monitor to suppress the hang monitor, which is rather annoying. If that’s what you are doing, you will need to attach your debugger to a running renderer process (see below).
It is generally not an issue, except when you are trying to debug interactions with the sandbox. Note: using the -renderer-cmd-prefix option bypasses the zygote launcher, so the renderers won‘t be sandboxed. If you're using Emacs and M-x gdb, you can do chrome "-renderer-cmd-prefix=gdb -args" To auto-start the renderers in the debugger, send the “run” command to the debugger: chrome -no-sandbox -renderer-cmd-prefix='xterm -title renderer -e gdb \ The “xterm” is necessary or gdb will run in the current terminal, which can get particularly confusing since it’s running in the background, and if you‘re also running the main process in gdb, won’t work at all (the two instances will fight over the terminal). The -no-sandbox flag is needed because otherwise the seccomp sandbox will kill the renderer process on startup, or the setuid sandbox will prevent xterm‘s execution. This command does the trick: chrome -no-sandbox -renderer-cmd-prefix='xterm -title renderer -e gdb -args' Since Chromium itself spawns the renderers, it can be tricky to grab a particular with gdb. Multiprocess Tricks Getting renderer subprocesses into gdb Note that you'll also probably want to use -no-sandbox, as explained below. If you don‘t you’ll get an error message such as “Could not attach to process”. You will probably want to disable this feature by using echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
On distributions that use the Yama LSM (that includes Ubuntu and Chrome OS), process A can attach to process B only if A is an ancestor of B. Basic browser process debugging gdb -tui -ex=r -args out/Debug/chrome -disable-seccomp-sandbox \ GDB-7.7 is required in order to debug Chrome on Linux.Īny prior version will fail to resolve symbols or segfault. Generally, do not use -no-sandbox on waterfall bots, sandbox testing is needed. Use -no-sandbox (but keep this temporary) or an external symbolizer (see tools/valgrind/asan/asan_symbolize.py). The sandbox can interfere with the internal symbolizer. To replicate Window Manager setup on the bots.Source level debug with -fdebug-compilation-dir.Graphical Debugging Aid for Chromium Views.JsDbg - visualize data structures in the browser.Allowing attaching to foreign processes.