Next: , Previous: Input and Output, Up: Native Mode


13.4 GDB Debugging

You can use GDB to debug the native mode program.

Because the program uses curses to draw, it is easiest to run gdb from a separate terminal and attach to the running program. See the gdb manual (http://sourceware.org/gdb/current/onlinedocs/gdb/) for more information on how this works. Basically, you only need to know its process ID.

If you are in the FreeWPC source tree, you can run make attach to do this automatically. If it finds a running program, it will attach, halt the program (you'll see everything freeze), then give you a debugger prompt.

From here, you can set breakpoints, step through the code, etc. If the program crashes, you can use the bt command to get a backtrace and see exactly where it failed.