When debugging a program built with gcc using GDB on FreeBSD, you might encounter errors if the debug information format is different. Here are some notes on the issue.
Doesn’t Work
When debugging a program built with gcc on FreeBSD’s GDB, you may see an error stating that there is no symbol information.
# gcc -g test.c
# gdb a.out
Works
By setting the debug information to use the DWARF-2 format, symbol information will be displayed in gdb.
# gcc -g -gdwarf-2 test.c
# gdb a.out