deep

a Cross Development Platform for Java

User Tools

Site Tools


dev:logging

This is an old revision of the document!


Logging and Error Reporting

Logging

The class StdStreams in the package ch.ntb.inf.deep.host defines three output streams.

  • log: is used for normal logging (e.g. successful compilation)
  • vrb: for debugging purposes
  • err: for errors

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

Für die Fehler-Ausgabe sollte die Klasse ErrorReporter im Package ch.ntb.inf.deep.host verwendet werden. Bei jeder Ausgabe eines Fehlers wird die statische Variable nofErrors inkrementiert. Der Launcher überprüft vor jedem Schritt diese Variable und bricht nach einem Fehler ab.

Der ErrorReporter benötigt die Datei ErrorMsg.txt im rsc Ordner. In dieser Datei werden die Fehler-Nummern mit ihren Beschreibungen und möglichen Lösungen eingetragen.

Die Methoden error(int errNr) und error(int errNr, String additonalInfo) greifen auf ErrorMsg.txt zu. Die Methoden suchen in der Datei die übergebene Fehlernummer, und geben diese mit der Beschreibung und falls vorhanden mit den möglichen Lösungen aus. Die zusätzlichen Informationen, wie z.B. Datei- und Zeilennummerangaben, werden hinten angefügt.

Im Weitern gibt es noch die Methode error(String errMsg), diese gibt die Fehlermeldung direkt aus, ohne dass eine Fehlernummer dafür definiert werden muss.

Stopping after Error

Der Launcher prüft vor jedem weiteren Schritt, ob kein Fehler aufgetreten ist. Was aber passiert, wenn innerhalb eines Schrittes (z.B. der Berechnung der Codegenerierung) ein Fehler auftritt, und zwar so, dass dieser Teil nicht mehr abgeschlossen werden kann? Das ist z.B. der Fall, wenn kein Register mehr alloziert werden kann. Unter Umständen ist die Aufruferkette sehr gross und wir wollen nur im äussersten Rufer, dem Launcher jeweils nofErrors prüfen.
Alle Methoden sollen so geschrieben werden, dass im Fehlerfall der ErrorReporter aufgerufen wird, aber die Methode trotzdem einen brauchbaren Rückgabewert liefert (also z.B. einfach das Register 0 oder den Node 0) und so die äusseren Methoden durchlaufen. U.U. können auch spezielle Objekte extra dafür geschaffen werden.
Es macht trotzdem Sinn daneben auch Assertions einzubauen. Diese sind dann nützlich, wenn wir als Entwickler den Fehler genau zu lokalisieren versuchen.


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

Debugger: 900 - 999

ErrorNr Description Solution
900connection lost
dev/logging.1429340125.txt.gz · Last modified: 2016/02/25 13:33 (external edit)