Debugging

Live Debugging

The GNU Project debugger gdb is installed on the mesh routers. You can start debugging once you got the process id of your application.

$ ps -A | grep myApp
 3436 ?        00:00:00 myApp

Now attach the debugger to the running process.

$ gdb --pid=3436

This starts the debugger and stop your programm. You have to input continue to let it continue running.

Core Dump Debugging

When your application crashes before you can attach the debugger, you can make use of core dumps. Currently for every crashing process a dump is written to /tmp/core-AppName. You have to execute gdb as follows.

$ gdb -c /Path/To/CoreDump /Path/To/App

Remote Debugging

You can use gdb on your computer to debug a program running on the mesh routers. Start the gdbserver on the mesh router and attach it to the running process. You need to specify on which hostname/ip address and port the gdbserver will listen.

$ gdbserver --attach HOST:PORT PID

You have  to connect the gdbserver with your gdb on your computer. Please note that you need an unstripped copy of the program containing debug symbols on your computer.

$ gdb /Path/To/App

Now you have to connect to the gdbserver.

(gdb) target remote REMOTE_HOST:REMOTE_PORT