Using the debugger in Visual Studio
FTN95 is accompanied by a debugger for both Win32 and .NET
platforms that is integrated into Microsoft Visual Studio and FTN95 Express. There is also
an external debugger (see Using SDBG)
for the Win32 platform.
In order to use the integrated debugger, you must select an appropriate
project mode. The standard debugging modes are Debug and Checkmate.
Checkmate is normally preferred (to get started using the debugger see
A simple Fortran project). In both Debug and Checkmate mode it is
recommended that you use the compiler options /FULL_DEBUG (in
order to view Fortran PARAMETERs) and /STANDARD_ERROR_REPORTS (so that,
when an exception occurs, the debugger stops at the relevant
line rather than the exit point).
There are differences between Win32 and .NET which become apparent when
debugging. Code that successfully compiles for Win32 may fail under .NET. For
example, the type checking of subroutine arguments is stronger for .NET. In
particular, the passing of Fortran character variables is more restrictive.
Where possible there is something to be said for testing under both Win32
When using the debugger and stepping through code under .NET, entering a
subprogram invokes the JIT compiler. In very unusual circumstances, code
that successfully compiles with FTN95 may fail to pass the JIT
compiler leading to a System.ExecutionEngineException on entry to the
subprogram. The root of the problem could be anywhere in the subprogram
and it may be necessary to comment out whole sections of the subprogram in
order to locate the offending code.