Hi, the current version of showing the backtrace is not async-signal-safe as it uses backtrace_symbols() which, in turn, uses malloc(). The attached patch changes the backtrace printing functionality to instead use backtrace_symbols_fd() and pipes. Also, it does some other work on backtrace printing: - Nowadays the main program has the same debug symbol name as whatever the name of the main program is, rather than MAIN__. Therefore remove special case logic related to that. - Don't filter out stack frames from inside libgfortran, as this might lose information in case the reason for the crash is in the library. - Reformat the output slightly, so the each stack frame fits on one line, and begins with #NUM, similar to GDB. For instance, the small program subroutine c call abort () end subroutine c subroutine b call c end subroutine b subroutine a call b end subroutine a program bt call a end program bt compiled with -g -fno-whole-file now generates Backtrace for this error: #0 /home/janne/src/gfortran/trunk/install/lib64/libgfortran.so.3(+0x182b7)[0x7f9c8a2c42b7] #1 /home/janne/src/gfortran/trunk/install/lib64/libgfortran.so.3(+0x19d07)[0x7f9c8a2c5d07] #2 /home/janne/src/gfortran/trunk/install/lib64/libgfortran.so.3(+0xe1e49)[0x7f9c8a38de49] #3 in b_ at bt.f90:5 (0x400612) #4 in b_ at bt.f90:7 (0x400620) #5 in a_ at bt.f90:11 (0x400630) #6 in bt at bt.f90:15 (0x400640) Aborted In this case the 3 first frames are the output from backtrace_symbols_fd() since addr2line can't get the symbols from libgfortran. With static linking addr2line can see it: Backtrace for this error: #0 in _gfortrani_show_backtrace at backtrace.c:85 (0x405427) #1 in _gfortrani_sys_abort at error.c:176 (0x4007B7) #2 in _gfortran_abort (0x404469) #3 in b_ at bt.f90:5 (0x400402) #4 in b_ at bt.f90:7 (0x400410) #5 in a_ at bt.f90:11 (0x400420) #6 in bt at bt.f90:15 (0x400430) Aborted Regtested on x86_64-unknown-linux-gnu, Ok for trunk? 2011-05-14 Janne Blomqvist PR libfortran/48931 * configure.ac: Check for backtrace_symbols_fd instead of backtrace_symbols. * config.h.in: Regenerated. * configure: Regenerated. * runtime/backtrace.c (local_strcasestr): Remove. (bt_header): New function. (dump_glibc_backtrace): Remove. (show_backtrace): Rework to use backtrace_symbols_fd and pipes, reformat output. -- Janne Blomqvist