3.8. GLIBC Backtrace Support

Sourcery CodeBench supports the backtrace function from GLIBC. Backtracing is supported regardless of optimization, with or without a frame pointer, and in both ARM and Thumb modes.

In order to support backtracing, Sourcery CodeBench enables generation of unwind tables by default when compiling. These tables are used for any stack traversal, including backtrace, C++ exception handling, and POSIX thread cancellation. Where none of these are required, you can reduce application size by compiling with -fno-unwind-tables.

Some stand-alone programs, including bootloaders and the Linux kernel, cannot be built with unwind tables. To accommodate these programs, Sourcery CodeBench suppresses unwind tables for C code if the -ffreestanding option is used. Unwind tables are also suppressed if the -mabi option is provided, as this option is not generally used in user-space programs. To override this behavior, specify -funwind-tables on the arm-none-linux-gnueabi-gcc command line.