<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 98.1p1 release (March 2nd, 1998) originally by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>Debugging of Procedures and Modules</TITLE> <META NAME="description" CONTENT="Debugging of Procedures and Modules"> <META NAME="keywords" CONTENT="vol1"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <LINK REL="STYLESHEET" HREF="vol1.css"> <LINK REL="previous" HREF="node48.html"> <LINK REL="up" HREF="node48.html"> <LINK REL="next" HREF="node50.html"> </HEAD> <BODY > <!--Navigation Panel--> <A NAME="tex2html1094" HREF="node50.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="icons.gif/next_motif.gif"></A> <A NAME="tex2html1090" HREF="node48.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="icons.gif/up_motif.gif"></A> <A NAME="tex2html1086" HREF="node48.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="icons.gif/previous_motif.gif"></A> <A NAME="tex2html1092" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="icons.gif/contents_motif.gif"></A> <A NAME="tex2html1093" HREF="node216.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="icons.gif/index_motif.gif"></A> <BR> <B> Next:</B> <A NAME="tex2html1095" HREF="node50.html">Catalogs in MIDAS</A> <B> Up:</B> <A NAME="tex2html1091" HREF="node48.html">Running a Program within</A> <B> Previous:</B> <A NAME="tex2html1087" HREF="node48.html">Running a Program within</A> <BR> <BR> <!--End of Navigation Panel--> <H2><A NAME="SECTION00681000000000000000"> </A><A NAME="2509"> </A> <A NAME="debugging-procedures-and-modules"> </A> <BR> Debugging of Procedures and Modules </H2> <P> Normally, the command lines of a MIDAS procedure are not displayed on the terminal. To control the display of the lines of a MIDAS procedure, use the command <TT>ECHO</TT>. With <TT>ECHO/ON</TT> the lines of a MIDAS procedure are displayed on the terminal as they are read from the file and executed. This way, it is possible to get an impression of how much time various parts of a procedure need. <BR> With <TT>ECHO/FULL</TT> the lines are displayed as they are read and if symbols have to be substituted, the lines are again displayed after substitution. To avoid echoing and return to a <I>silent</I> mode, enter <TT>ECHO/OFF</TT>. <BR> The <TT>ECHO</TT> command has as parameter the procedure-level-interval where it should be applicable. Thus you can, e.g., display only the lines of a MIDAS procedure executing at level 2, etc. Echoing each command line of a MIDAS procedure will identify most of the syntax and other obvious errors. However, this may not be sufficient for long and complicated procedures. <BR> For these cases use the Midas Command Language Debugger: <BR> <BR> <TT>DEBUG/PROCEDURE levla,levlb ON/OFF</TT> !en/disable procedure debugging <BR> <TT>DEBUG/MODULE levla,levlb ON/OFF</TT> !en/disable module (F 77, C) debugging <BR> <TT>SHOW/CODE comnd/qualif</TT> !display the code of related procedure <BR> <BR> Once procedure debugging<A NAME="2523"> </A> is switched on, e.g., via <TT>DEBUG/PROC 1,3 ON</TT>, all MIDAS procedures executing at level 1, 2 or 3 start up in stepwise debugging mode. The prompt changes to <TT>Mdb</TT> and each command line is displayed on the terminal, and only executed when you hit <!-- MATH: $\fbox{\tt Return}$ --> <IMG WIDTH="83" HEIGHT="27" ALIGN="BOTTOM" BORDER="0" SRC="img214.gif" ALT="\fbox{\tt Return}">. Furthermore, a set of basic debugging commands may be executed, e.g. listing the preprocessed procedure code, setting and clearing break points, and switching from stepwise to continuous mode. Also the keywords may be inspected at any moment. This is an important tool because local keywords cannot be checked otherwise; once the procedure terminates, all local keywords disappear. <BR> If you want to execute any other command, enter <TT>PAUSE</TT> to interrupt the procedure you're debugging, execute any other command you want, and enter <TT>CONTINUE</TT> to continue debugging the procedure. <BR> When you are in the debugger (indicated via the <TT>Mdb</TT> prompt), use the command <TT>`h'</TT> (for HELP) to display all the available debug commands. <BR> To switch the debugging mode for procedures off, use <TT>DEBUG/PROC 1,3 off</TT>. <BR> <BR> If you must debug your application program, first compile and link that program with the debugger of your host system. Make sure, that this is the same debugger as the one stored in a system keyword of MIDAS (via the command <TT>SET/MIDAS_SYSTEM debug=...</TT>). Enter the command <TT>DEBUG/MODULE</TT> to switch on the debugging mode for applications. Subsequently, your application (as well as all other programs activated via the MIDAS <TT>RUN</TT> command) will be started with the debugger of your system and you can debug it in the usual way.<BLOCKQUOTE> <DIV ALIGN="CENTER"> <B>Note</DIV> <I>Typing <TT>$dbx myprog.exe</TT> (e.g. on a SUN) would also start up program <TT>myprog.exe</TT> in debug mode. But that would not tie the application into the MIDAS environment, i.e. the keywords would not be set correctly.</I></B></BLOCKQUOTE> <BR> If you just want to list the preprocessed code of a MIDAS procedure use the command <TT>TRANSLATE/SHOW proc</TT>. <TT>TRANSLATE/SHOW proc X</TT> will also check all commands in the procedure for completeness, so it's a good idea to execute that command for all your MIDAS procedures. <BR> The command <TT>SHOW/CODE comnd/qualif</TT> will display the code of the procedure which is actually executed when you enter <TT>comnd/qualif</TT> as a MIDAS command.<BLOCKQUOTE> <DIV ALIGN="CENTER"> <B>Note</DIV> <I>For a detailed description of the integration of user applications into MIDAS as well as complete examples (in FORTRAN and C) see the MIDAS Environment Document.</I></B></BLOCKQUOTE> <P> <HR> <!--Navigation Panel--> <A NAME="tex2html1094" HREF="node50.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="icons.gif/next_motif.gif"></A> <A NAME="tex2html1090" HREF="node48.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="icons.gif/up_motif.gif"></A> <A NAME="tex2html1086" HREF="node48.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="icons.gif/previous_motif.gif"></A> <A NAME="tex2html1092" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="icons.gif/contents_motif.gif"></A> <A NAME="tex2html1093" HREF="node216.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="icons.gif/index_motif.gif"></A> <BR> <B> Next:</B> <A NAME="tex2html1095" HREF="node50.html">Catalogs in MIDAS</A> <B> Up:</B> <A NAME="tex2html1091" HREF="node48.html">Running a Program within</A> <B> Previous:</B> <A NAME="tex2html1087" HREF="node48.html">Running a Program within</A> <!--End of Navigation Panel--> <ADDRESS> <I>Petra Nass</I> <BR><I>1999-06-09</I> </ADDRESS> </BODY> </HTML>