|
| 1 | +# Debugging With GDB/LLDB |
| 2 | + |
| 3 | +Debugging with GDB and LLDB |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +Debugging WebKit can be done through command line debuggers like GDB or LLDB. |
| 8 | + |
| 9 | +## Setting up your Environment |
| 10 | + |
| 11 | +### LLDB |
| 12 | + |
| 13 | +WebKit provides debug helpers under `Tools/lldb/lldb_webkit.py`. |
| 14 | +For automatic loading into LLDB on launch, add the line below to `~/.lldbinit`. |
| 15 | + |
| 16 | +``` |
| 17 | +command script import {Path to WebKit}/Tools/lldb/lldb_webkit.py |
| 18 | +``` |
| 19 | + |
| 20 | +### GDB |
| 21 | + |
| 22 | +`Tools/gdb/webkit.py` extends GDB with WebKit-specific knowledge. |
| 23 | +For automatic loading into GDB on launch, add the lines below to `~/.gdbinit`. |
| 24 | + |
| 25 | +``` |
| 26 | +python |
| 27 | +import sys |
| 28 | +sys.path.insert(0, "{Path to WebKit}/Tools/gdb/") |
| 29 | +import webkit |
| 30 | +``` |
| 31 | + |
| 32 | +## Debug Launch Scripts |
| 33 | + |
| 34 | +WebKit comes with several helper scripts to make launching a debug session quicker. |
| 35 | + |
| 36 | +| Script | Description | |
| 37 | +| ------ | ----------- | |
| 38 | +| debug-minibrowser | Debug the Minibrowser application | |
| 39 | +| debug-safari | Debug the Safari browser | |
| 40 | +| debug-test-runner | Debug WebKitTestRunner | |
| 41 | + |
| 42 | +## Manually Debugging WebKit |
| 43 | + |
| 44 | +The helper scripts above provide an easy way to start debugging, but a user can choose to manually launch WebKit |
| 45 | +using GDB or LLDB directly. |
| 46 | + |
| 47 | +### LLDB |
| 48 | + |
| 49 | +``` |
| 50 | +export DYLD_FRAMEWORK_PATH=WebKitBuild/Debug |
| 51 | +lldb -f WebKitBuild/Debug/DumpRenderTree -- test_file.html |
| 52 | +``` |
| 53 | + |
| 54 | +### GDB |
| 55 | + |
| 56 | +``` |
| 57 | +export DYLD_FRAMEWORK_PATH=WebKitBuild/Debug |
| 58 | +gdb --args WebKitBuild/Debug/DumpRenderTree test_file.html |
| 59 | +``` |
0 commit comments