Contents | Prev | Next | Index


Debugging

Canterbury Pascal for JVM supports any Java debugger. The following switches or comment embedded directives for debugger support are available in this Pascal compiler:

-D  or  (*D+ *)
This switch or directive causes the Pascal compiler to insert local variable tables and line number tables to the class file output.
-JDB or (*JDB+ *)
This switch or directive does the same as -D , in addition copies of the compiled source files are created using the file extension ".pas.debug.java". These files will then be used instead of the original source files copies by the Java debugger. This is useful when a Java debugger only recognizes source files with the ".java" extension. This switch should be chosen when using the JDB utility which is part of the JDK 1.1.x or Java-2 SDK 1.2.x.

Note: Sun's JDB utitlity always expects to find the source file in the same directory where the compiler-generated class files where written. If the Pascal source file is located in a different directory, then the compiler switch -JDB should be used. This ensures that a copy of the Pascal source file will be written to the output directory of the class file.

Java Application example for Windows 95/98 JDK 1.1.x:

Given the following Pascal program "helloworld.pas":
 
PROGRAM helloworld;
BEGIN
  WriteLn( 'Hello World' );
END.

 

The following commands are needed for compiling and debugging:
 
java mhc.compiler.pas helloworld -m -jdb
jdb helloworld

 
The first executable line of a Java application always is at the "main" method. This is where Canterbury Pascal maps the program or unit body. In the above example, going to the start of the program could be done in JDB by setting a first break point as follows:

stop in helloworld.main
run

Java Applet example for Windows 95/98 JDK 1.1.x:

Given the "Slides.pas" example (see section A First Example), the following commands can be used for compiling and debugging the applet:
 
java mhc.compiler.pas Slides -m -r -jdb
jdb sun.applet.AppletViewer Slides.html


Contents | Prev | Next | Index

Canterbury Pascal for JVM  (Last documentation update Sep 02, 2004)
Copyright © 1999-2004 J.Neuhoff - mhccorp.com  . All rights reserved.
Please send any comments or corrections to neuhoff@mhccorp.com