Logging and Error Reporting

Logging

The class StdStreams in the package org.deepjava.host defines three output streams.

Assertions

For development assertions should be extensively used. Make sure that they are enabled in eclipse with -ea as argument for the VM.

Debug Output

Debug output is very convenient during the development process. For efficiency reasons we use the following scheme: Every class has a constant debug of type boolean. If debug == true the compiler inserts write statements to StdStreams.vrb. To enable debug output you have to edit the source code (switch on debug). In the productive code their is no runtime penalty.

Error Reporting

The class org.deepjava.host.ErrorReporter is used for reporting errors. Each error increments nofErrors. The launcher checks this variable and stops if necessary.

The ErrorReporter needs the file ErrorMsg.txt in the folder rsc. This text file contains error numbers, descriptions and possible solution. The methods error(int errNr) and error(int errNr, String additonalInfo) access ErrorMsg.txt.

Further, there is a method error(String errMsg). It allows for outputting a message without error number.

Stopping after Error

The launcher checks if no error occured before starting the next step. However, what happens if there is an error within a step (e.g. while allocating registers) and it's not possible to complete this step? We do not want to check for nofErrors within each step.
Every method should call the error reporter in case of an error and at the same time it should return a useable value (e.g. register 0 or node 0). If necessary special objects should be created for this purpose.
Use assertions whenever possible. They will be switched of in the productive code but can be enabled during the development process.


Error Numbers

General: 000 - 099

ErrorNr Description Solution
10feature not yet implemented
11file not found

Launcher: 100 - 199

ErrorNr Description Solution
100no target connection (build project first)

Configuration: 200 - 299

ErrorNr Description Solution
200wrong number format
201missing right parenthesis
202missing right brace
203missing right bracket
204missing quotation mark
205IO-Exception
206Unexpected Symbol
207missing left brace
208missing left bracket
209missing semicolon
210missing assignment sign
220no such device
221no devicescreate device before adding segments
222syntax error
223inconsistent attributes
224invalid type
225invalid parameter
226overwrite protected
227undefined constant
228max number of reached
229missing tag
230no such register
231no default segment defined
232no system table segment defined
233to set an init value is not supported
234fix addresses for methods are only in exception methods supported
235no such segment

Class File Reader++: 300 - 399

ErrorNr Description Solution
300class file not found
301systemmethod not found
302id for Systemmethod out of range
303changing parent dirs of class files
304illegal parent dir of class files

CFG: 400 - 499

ErrorNr Description Solution
400cfgNode not found

SSA: 500 - 599

ErrorNr Description Solution
500generation of the linenumber table failed
510translation of finally block in exceptions failed, use Java6 or later

Code Generator: 600 - 699

ErrorNr Description Solution
600no code generated
601method has too many parameters
602fixup out of range
603not enough GPR's for locals
604not enough FPR's for locals
610result of SSA instruction has wrong type
611operand of SSA instruction has wrong type
612operand of SSA new instruction has wrong type
620SSA return instruction not implemented
621SSA branch instruction not implemented
623sCcompl or sCcompg is not followed by branch instruction
625SSA instruction not implemented
630initialization failed, unsafe class not found
631initialization failed, method in unsafe class not found
632initialization failed, low level class not found
633initialization failed, method in low level class not found
634class not found

Linker: 700 - 799

ErrorNr Description Solution
701Class not loaded
710Segment not found
711Segment size error
720Address not set
721Offset not set
722Index not set
723ID not set
724Base address not set
790Runtime System error

Downloader/Programmer: 800 - 899

ErrorNr Description Solution
800target not found!(USB connection failed)
801a error occurs while downloading!(Try to reopen)
802no target image to load
803connection to target lost
804reopen failed
805starting of Device failed
806bdi is not in Debug mode
807memmory writer is not implemented
808bypass is not unlocked
809programming failed
810programmer not found
811class to connect to programmer not found
812plugin not found
813BDI packet wrong, try to reset BDI
814ready bit not set, try to reset BDI

Debugger: 900 - 999

ErrorNr Description Solution
900connection lost