Debugging FTLDNS using gdb
¶
Once you are used to it, you can skip most of the steps. Debugging FTLDNS is quite easy. pihole-FTL
has been designed so that a debugger can be attached to an already running process. This will give you insights into how software (not limited to pihole-FTL
) works.
Prerequirements (only required once)¶
- Install
screen
andgdb
usingsudo apt-get install screen gdb
- Start a screen session (it will allow you to come back even if the SSH connection died)
- If you don't know about
screen
, then read about it (you will love it!)
- If you don't know about
- Start a screen session using
screen
-
Configure
gdb
by installing a globally valid initialization file:echo "handle SIGHUP nostop SIGPIPE nostop SIGTERM nostop SIG32 nostop SIG34 nostop SIG35 nostop" | sudo tee /root/.gdbinit
You can omit this step, however, you will have to remember to run the quoted line on every start of
gdb
in order to properly debug FTL.
Start of debugging session¶
- Use
sudo gdb -p $(pidof pihole-FTL)
to attach the debugger to the already runningpihole-FTL
process - Once loading of the symbols has finished (the
(gdb)
input prompt is shown), entercontinue
to continue the operation ofpihole-FTL
inside the debugger. All debugger features are now available. - When
pihole-FTL
has crashed, copy & paste the terminal output into a (new) issue. Also, typebacktrace
and include its output. We might ask for additional information in order to isolate your particular issue.