2016-10-04 18:54:45 +00:00
|
|
|
## Debugging Build Scripts
|
|
|
|
|
|
|
|
While developing your build script, it may be useful to run bash within the
|
|
|
|
container:
|
|
|
|
|
|
|
|
```bash
|
2016-11-29 19:02:02 +00:00
|
|
|
$ python infra/helper.py shell $PROJECT_NAME # runs /bin/bash within container
|
|
|
|
$ compile # run compilation manually
|
2016-10-04 18:54:45 +00:00
|
|
|
```
|
|
|
|
|
2016-11-02 19:42:00 +00:00
|
|
|
## Debugging Fuzzers with GDB
|
2016-10-04 18:57:14 +00:00
|
|
|
|
2018-07-16 04:04:41 +00:00
|
|
|
If you wish to debug a fuzz target with gdb, you may use the base-runner-debug
|
|
|
|
image:
|
2016-10-04 18:57:14 +00:00
|
|
|
|
|
|
|
```bash
|
2018-07-16 04:04:41 +00:00
|
|
|
# Copy input testcase into host output directory so that it can be accessed
|
|
|
|
# within the Docker image.
|
|
|
|
$ cp /path/to/testcase build/out/$PROJECT_NAME
|
|
|
|
|
|
|
|
# Run Docker image containing GDB.
|
|
|
|
$ python infra/helper.py shell base-runner-debug
|
|
|
|
$ gdb --args /out/$PROJECT_NAME/$FUZZ_TARGET_NAME /out/$PROJECT_NAME/testcase
|
2016-10-04 18:57:14 +00:00
|
|
|
```
|
2018-07-16 04:04:41 +00:00
|
|
|
|
|
|
|
Note that the base-runner-debug image does not have access to your sources, so
|
|
|
|
you will not be able to do source code level debugging. We recommend integrating
|
|
|
|
your fuzz target upstream as part of [ideal integration](ideal_integration.md)
|
|
|
|
for debugging purposes.
|