This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/30498] Support traceback (backtrace) on errors
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Feb 2007 09:55:54 -0000
- Subject: [Bug libfortran/30498] Support traceback (backtrace) on errors
- References: <bug-30498-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #8 from burnus at gcc dot gnu dot org 2007-02-09 09:55 -------
Hi,
> I cannot judge how much work this would be, but would it be possible to extend
> this patch a little further so that these backtraces can be requested by the
> user?
Well, this is possible if one combines this patch with the ISO C Bindings of
our fortran-experiments branch. One could then simply use:
integer, parameter :: SIGBUS = 7
integer :: res
interface
function kill(pid, signal) bind(c, name='kill')
use :: ISO_C_BINDING
integer(C_INT),value :: pid, signal
integer(C_INT),bind(c) :: kill
end function kill
end interface
res = kill(0,SIGBUS)
To get a backtrace. Alternatively, with the current patch and the main branch,
one only needs to generate somehow SIGSEGV, SIGFPE, SIGILL or SIGBUS. For
instance as follows:
-ffpe-trap=zero -fbacktrace with
r = 0.0
r = 1.0/r
which gives a nice backtrace.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30498