FPP Debugging

From wiki
Jump to: navigation, search

Building With Debuging Symbols

Normally fpp is built without debugging symbols.  This keeps the binaries smaller and take up (ever so slightly) less memory.  When debugging, you will want these symbols to aide in tracking down issues, stack traces, variable names, etc. so we will want to re-build with the debugging symbols.  The easiest way to build this with current FPP images is:

sudo -s # become root
cd /opt/fpp/src # change directory to the source tree
touch Makefile # "Update" the makefile so everything re-builds
echo "CFLAGS+=-g" > Makefile.local # Add the -g flag so GCC gives us symbols
make # do the build

Run In The Debuger

Then, we want to run fppd in the debugger so we can catch crashes, deadlocks, etc.:

gdb --args ./fppd --log-level debug --log-mask most -f

This will start gdb, ready to execute the fppd program, just type run:

run

Crash/Deadlock Analysis

If we deadlock, you can press "ctrl+c" and it will stop execution and drop you to the GDB interactive shell, or a crash will automatically place you at the GDB interactive shell.  Once here, we can look at vaiables, stack traces, threads, etc.  Here are a few helpful commands:

Full Thread Information From All Threads

thread apply all bt full

Print All Variables

Note this will print variables for everything, including all libraries we link to, etc.  This might not be very helpful for us.

set pagination off
info variables

Print Specific Variable

print channelOutputs[0]
x 0x73614

See Source For Something

Running "list" with the name will show 10 lines surrounding something.  Hitting "enter" again will print 10 more, or running "list" again with no args:

list E131Output
list