Skip to content

Commit 0a7c606

Browse files
committed
Add debugging with GDB instructions
1 parent b3e5d6d commit 0a7c606

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

WebKitFuzz/README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,31 @@ into the `build/` directory.
4545
process for the purposes of building a separate target binary that will call and start the
4646
WebKit processes.
4747

48-
4. Run the fuzzer binary from the build directory (`build/`) with the following command. The sample can either be a path to a file or a URL beginning with `http` or `https`.
48+
4. Run the fuzzer binary from the build directory (`build/`) with the following command. The sample can either be a path to a file or a URL beginning with `http` or `https`. If you don't set a `log_path`, then the crash will instead print to stdout.
4949
```
5050
ASAN_OPTIONS=detect_leaks=0,exitcode=42,log_path=asan_logs/crash ASAN_SYMBOLIZER_PATH=</path/to/llvm-symbolizer> LD_LIBRARY_PATH=lib/ ./bin/webkitfuzz </path/to/sample> <timeout in sec>
5151
```
52+
## Debugging with GDB
53+
54+
To debug the WebKit Web Process with gdb you can use `gdbserver`. Run webkitfuzz
55+
with the following command. I suggest using a long timeout, like 3600s or 1 hr,
56+
to ensure you have enough time to debug.
57+
```
58+
WEB_PROCESS_CMD_PREFIX='/usr/bin/gdbserver localhost:8080' ASAN_OPTIONS=detect_leaks=0,exitcode=42 LD_LIBRARY_PATH=lib/ ./bin/webkitfuzz http://poc.com 3600
59+
```
60+
From another terminal, you'll connect to the gdbserver as:
61+
```
62+
$ gdb bin/WebKitWebProcess
63+
(gdb) target remote localhost:8081
64+
```
65+
66+
If you're running on the same machine, then I suggest also running the following
67+
to save *a lot* of time. This will tell gdb that it doesn't have to send the
68+
symbols from the server to the client, but actually you can find them locally at
69+
this path.
70+
```
71+
(gdb) set sysroot /
72+
```
5273

5374
## Other Tips and Tricks
5475

@@ -92,4 +113,4 @@ run the build script, you'll see which compiler is running. For example:
92113
-- The CXX compiler identification is Clang 13.0.1
93114
```
94115
In this case you'd want to make sure you link to your llvm-symoblizer-13 binary
95-
since you're using clang-13.
116+
since you're using clang-13.

0 commit comments

Comments
 (0)