Hello, I am trying to generate a backtrace into a file of the stack when a program errors. I can see the gcc functions backtrace_symbols and backtrace. But when I add it to a small C program and build I cannot find the execinfo.h file and the two relevant functions. The progarm I use is reproduced below (from the example): #include #include #include /* Obtain a backtrace and print it to stdout. */ void print_trace (void) { void *array[10]; size_t size; char **strings; size_t i; size = backtrace (array, 10); strings = backtrace_symbols (array, size); printf ("Obtained %zd stack frames.\n", size); for (i = 0; i < size; i++) printf ("%s\n", strings[i]); free (strings); } /* A dummy function to make the backtrace more interesting. */ void dummy_function (void) { print_trace (); } int main (void) { dummy_function (); return 0; } My version is: gcc -v Reading specs from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/specs Configured with: /gates/sfw10/builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure --prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ --enable-shared Thread model: posix gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath) Please help if you can...I just need to get a stack dump similar to the one you see when analysing a core file using gdb. Cheers, Alex -- View this message in context: http://www.nabble.com/How-to-get-a-backtrace-from-a-C-module-tf2740773.html#a7647122 Sent from the gcc - Help mailing list archive at Nabble.com.