0

Clarify debugging docs.

Add a section at the top for build configuration. Move the gdbinit
instructions to the configuration section (it's required before
debugging) and remove the details about why this is required (it's
described on the dedicated page that's linked). Add a link to the
corresponding LLDB page.

Mention flag --gtest_break_on_failure for debugging tests.

Clarify LLDB install (the page used to imply that you had to run apt-get
to get the lldbinit file).

Change-Id: Ib292350ee521bf2bc3c4a836523fe070e4d7694e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4482817
Reviewed-by: Yuzhu Shen <yzshen@chromium.org>
Commit-Queue: Brett Wilson <brettw@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1136698}
This commit is contained in:
Brett Wilson
2023-04-27 18:56:54 +00:00
committed by Chromium LUCI CQ
parent c74c87b6fe
commit 41a7de0afb
2 changed files with 25 additions and 9 deletions

@ -22,6 +22,27 @@ GDB-7.7 is required in order to debug Chrome on Linux.
Any prior version will fail to resolve symbols or segfault.
### Setup
#### Build setup
In your build set the GN build variable `symbol_level = 2` for interactive
debugging. (`symbol_level = 1` only provides backtrace information). And while
release-mode debugging is possible, things will be much easier in a debug build.
Set your build args with `gn args out/<your_dir>` (substituting your build
directory), and set:
```
is_debug = true
symbol_level = 2
```
#### GDB setup
The Chrome build requires some GDB configuration for it to be able to find
source files. See [gdbinit](gdbinit.md) to configure GDB. There is a similar
process for [LLDB](lldbinit.md).
### Basic browser process debugging
gdb -tui -ex=r --args out/Debug/chrome --disable-seccomp-sandbox \
@ -392,14 +413,6 @@ You can improve GDB load time significantly at the cost of link time by not
splitting symbols from the object files. In GN, set `use_debug_fission=false` in
your "gn args".
### Source level debug with -fdebug-compilation-dir
When `strip_absolute_paths_from_debug_symbols` is enabled (which is the
default), gdb may not be able to find debug files, making source-level debugging
impossible. See
[gdbinit](https://chromium.googlesource.com/chromium/src/+/main/docs/gdbinit.md)
to configure gdb to be able to find debug files.
## Core files
`ulimit -c unlimited` should cause all Chrome processes (run from that shell) to
@ -423,6 +436,7 @@ Many of our tests bring up windows on screen. This can be annoying (they steal
your focus) and hard to debug (they receive extra events as you mouse over them).
Instead, use `Xvfb` or `Xephyr` to run a nested X session to debug them, as
outlined on [testing/web_tests_linux.md](../testing/web_tests_linux.md).
### Browser tests
By default the `browser_tests` forks a new browser for each test. To debug the
@ -435,6 +449,8 @@ gdb --args out/Debug/browser_tests --single-process-tests --gtest_filter=MyTestN
**note the use of `single-process-tests`** -- this makes the test harness and
browser process share the outermost process.
The switch `--gtest_break_on_failure` can also be useful to automatically stop
debugger upon `ASSERT` or `EXPECT` failures.
To debug a renderer process in this case, use the tips above about renderers.

@ -4,7 +4,7 @@ Usage of Chromium's [lldbinit.py](../tools/lldb/lldbinit.py) is recommended when
debugging with lldb. This is necessary for source-level debugging when
`strip_absolute_paths_from_debug_symbols` is enabled [this is the default].
To install, run `sudo apt-get install lldb`.
If you have not installed LLDB yet, run `sudo apt-get install lldb` to get it.
To use, add the following to your `~/.lldbinit`