I have written a code to print backtrace in a linux machine using a backtrace function call specified in the "execinfo.h" header file. I need to get this code working on a freebsd machine as well. I am getting a compiler error for "execinfo.h" in Freebsd machines. I am thinking of using conditional macros to solve the problem, but I am not able to find a proper documentation for printing backtrace in Freebsd machines.
Up to FreeBSD 10:
libexecinfo is available as devel/libexecinfo in FreeBSD ports. If it does not work you should report the error.
Later versions have libexecinfo in the base system.