gdb and f77

Douglas Bates bates@stat.wisc.edu
29 Apr 1999 13:04:49 -0500


I am trying to debug some code that uses the nlm optimizer but with
analytic gradient and hessian.  The optimization code itself is
written in Fortran ($RSRC/src/appl/uncmin.f).  I compiled 
 Version 0.64.0 Patched (unreleased snapshot) (April 29, 1999)
with the -g flag and ran it under gdb.  When I set a breakpoint at
heschk_ I can trace the execution and I can print the values of local
scalar variables or scalar arguments.  When I try to print the values
of array elements I am always getting a segmentation violation, either 
under the automatic choice of language (Fortran) or manually setting
the language to C.

Has anyone had experience with using gdb on Fortran code compiled with 
g77?  If so, can you tell me what syntax I should use to access an
array element.

This is the sort of thing that happens:
 ...
 ) at uncmin.f:1052
 Current language:  auto; currently fortran
 (gdb) set lang c
 Warning: the current language does not match this frame.
 (gdb) p j
 $1 = 1
 (gdb) p udiag
 $2 = (double precision (*)[536870911]) 0x421aee98
 (gdb) p udiag[1]

 Debugger segmentation fault
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._