Skip to content

Commit 0dcfe4b

Browse files
author
Grok Compression
committed
fuzzer: update README
1 parent cc2127d commit 0dcfe4b

1 file changed

Lines changed: 37 additions & 11 deletions

File tree

tests/fuzzers/README.md

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@ with a hex editor is not directly useful.
3535
### Preliminary steps
3636

3737
```
38-
$ cd /tmp
39-
$ git clone https://github.com/GrokImageCompression/grok
40-
$ cd grok
41-
$ git clone --depth 1 https://github.com/GrokImageCompression/grok-test-data grok-data
42-
$ mkdir build
43-
$ cd build
44-
$ cmake .. -DBUILD_SHARED_LIBS=OFF
45-
$ make -j$(nproc)
46-
$ cd ..
38+
cd /tmp
39+
git clone --recursive https://github.com/GrokImageCompression/grok
40+
git clone --depth 1 https://github.com/GrokImageCompression/grok-test-data grok-data
41+
cd grok
42+
mkdir build
43+
cd build
44+
cmake .. -DBUILD_SHARED_LIBS=OFF
45+
make -j$(nproc)
46+
cd ../..
4747
```
4848

4949
### Build fuzzers and seed corpus
5050

5151
```
52-
$ cd tests/fuzzers
53-
$ make -j$(nproc)
52+
cd grok/tests/fuzzers
53+
make -j$(nproc)
5454
```
5555

5656
Fuzzers created in `/tmp/*_fuzzer`, with `/tmp/*_fuzzer_seed_corpus.zip` corpus files.
@@ -62,6 +62,32 @@ $ /tmp/grk_decompress_fuzzer a_file_name
6262
$ /tmp/grk_compress_fuzzer a_file_name
6363
```
6464

65+
### Build fuzzers for debugging in VSCode
66+
67+
Requires a grok build with debug info (e.g. `Debug` or `RelWithDebInfo`).
68+
From the repository root:
69+
70+
```
71+
gcc -g -O0 -c tests/fuzzers/fuzzingengine.c -o /tmp/fuzzingengine.o
72+
g++ -g -O0 -std=c++20 \
73+
-I src/lib/core -I build/src/lib/core \
74+
tests/fuzzers/grk_decompress_fuzzer.cpp /tmp/fuzzingengine.o \
75+
-o build/bin/grk_decompress_fuzzer \
76+
-Lbuild/bin -lgrokj2k -lhwy -llcms2 -lm -lpthread \
77+
-Wl,-rpath,'$ORIGIN'
78+
g++ -g -O0 -std=c++20 \
79+
-I src/lib/core -I build/src/lib/core \
80+
tests/fuzzers/grk_compress_fuzzer.cpp /tmp/fuzzingengine.o \
81+
-o build/bin/grk_compress_fuzzer \
82+
-Lbuild/bin -lgrokj2k -lhwy -llcms2 -lm -lpthread \
83+
-Wl,-rpath,'$ORIGIN'
84+
```
85+
86+
The fuzzer binaries are now in `build/bin/` with full debug symbols.
87+
To debug a crash, open VSCode and select the **"Compress Fuzzer"**
88+
launch configuration from the Run and Debug panel. It will prompt for
89+
the path to a crash input file. Set breakpoints and press F5.
90+
6591

6692
## OSS-Fuzz crash reports
6793

0 commit comments

Comments
 (0)