Oberon-2 debugging example for Java
Canterbury Oberon-2 for Java supports any Java debugger. The following switches for debugger support are available in this Oberon-2 compiler:
- -D
- This switch causes the Oberon-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 Oberon-2 compiler to insert Oberon-2 source lines as comments into the Java output.
- -JAVAC
- This switch causes Oberon-2 to automatically run JAVAC (part of JDK) 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 (with the -g option) separately from a command line, after the Oberon-2 compilation has been completed.
- -JIKES
- This switch causes Oberon-2 to automatically run Jikes (available from Sourceforge) 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 Jikes (with the -g option) separately from a command line, after the Oberon-2 compilation has been completed.
Java Application example for Win32 J2SE 1.4.x:
Given the following Oberon-2 module helloworld.obn:
MODULE helloworld;
IMPORT Out;
BEGIN
Out.String( "Hello World" );
Out.Ln;
END helloworld.The following commands are needed for compiling and debugging:
java mhc.obn helloworld -m -d -l -javac
jdb helloworldThe following commands do the same:
java mhc.obn helloworld -m -l
javac helloworld.java -g
jdb helloworld
Java Applet example for Win32 J2SE 1.4.x:
Given the Slides.obn file (see Oberon-2 example), the following commands can be used for compiling and debugging the applet:
java mhc.obn Slides -m -d -l -javac
jdb sun.applet.AppletViewer Slides.htmlThe following commands do the same:
java mhc.obn Slides -m -l
javac Slides.java -g
jdb sun.applet.AppletViewer Slides.html
