Contents | Prev | Next | Index


Debugging

Canterbury Modula-2 for Java supports any Java debugger. The following switches for debugger support are available in this Modula-2 compiler:

-D
This switch causes the Modula-2 compiler to call JAVAC or JIKES with the -g option. Th resulting byte code is created with debug information.
-L
This switch causes the Modula-2 compiler to insert Modula-2 source lines as comments into the Java output.
-JAVAC or -JIKES
This switch causes Modula-2 to automatically run JAVAC (part of JDK 1.1.x) or Jikes (available from IBM Alphaworks) in a subprocess using the -g option. This generates the final Java byte code with all the needed debug information. It is also possible to invoke JAVAC or Jikes (with the -g option) separately from a command line, after the Modula-2 compilation has been completed.

Java Application example for Win32 JDK 1.1.6:

Given the following Modula-2 module helloworld.mod:
MODULE helloworld;
IMPORT InOut;
BEGIN
  InOut.WriteString( "Hello World" );
  InOut.WriteLn;
END helloworld.

The following commands are needed for compiling and debugging:
java mhc.mod helloworld -m -d -l -javac
jdb helloworld

The following commands do the same:
java mhc.mod helloworld -m -l
javac helloworld.java -g
jdb helloworld

Java Applet example for Win32 JDK 1.1.6:

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

The following commands do the same:
java mhc.mod Slides -m -l
javac Slides.java -g

jdb sun.applet.AppletViewer Slides.html


Contents | Prev | Next | Index

Canterbury Modula-2 for Java  (Last documentation update Feb 8, 2000)
Copyright © 1998 Mill Hill & Canterbury Corporation, Ltd. All rights reserved
Please send any comments or corrections to mhc@webcom.com