Skip to content

Commit 222ee85

Browse files
committed
Add documentation for debugging w/ GDB and LLDB
This add some basic documentation on how to get setup for debugging with GDB and LLDB.
1 parent e236af7 commit 222ee85

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
```

Sources/WebKit/WebKit.docc/WebKit.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ and stay in touch.
7272
### Building and Debugging
7373

7474
- <doc:BuildOptions>
75+
- <doc:DebuggingOnTheCommandLine>
7576
- <doc:DebuggingWithXcode>
7677
- <doc:DebuggingWithVS>
7778
- <doc:Logging>

0 commit comments

Comments
 (0)