• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2layout: default
3title: Debugging
4parent: Advanced topics
5nav_order: 4
6permalink: /advanced-topics/debugging/
7---
8
9# Debugging issues
10{: .no_toc}
11
12- TOC
13{:toc}
14---
15
16## Debugging build scripts
17
18While developing your build script, it may be useful to run bash within the
19container:
20
21```bash
22$ python infra/helper.py shell $PROJECT_NAME  # runs /bin/bash within container
23$ compile                                     # runs compilation manually
24```
25
26## Debugging fuzzers with GDB
27
28If you wish to debug a fuzz target with gdb, you can use the base-runner-debug
29image:
30
31```bash
32# Copy input testcase into host output directory so it can be accessed
33# within the Docker image.
34$ cp /path/to/testcase build/out/$PROJECT_NAME
35
36# Run the Docker image containing GDB.
37$ python infra/helper.py shell base-runner-debug
38$ gdb --args /out/$PROJECT_NAME/$FUZZ_TARGET_NAME /out/$PROJECT_NAME/testcase
39```
40
41**Note:** The `base-runner-debug` image does not have access to your sources, so
42you will not be able to do source code level debugging. We recommend integrating
43your fuzz target upstream as part of
44[ideal integration]({{ site.baseurl }}/advanced-topics/ideal-integration/)
45for debugging purposes.
46