DebugBuild (pragma & interface)

Implemented as of Version 2015.r1

By Pragma DebugBuild the compiler is instructed to compile with informations on the current line of luna-code and -file. For this global (one-time) 4 bytes are reserved in memory. Each line of a statement in the Luna-source results in most cases several machine instructions. The compiler inserts for each line of Luna code instructions to update the information before executing the machine code. An update requires 4 clocks.

To query whether a DebugBuild is enabled (0 = false) exists following global constant:

The current line and file can be read by:

Apart from

The updating of a line of code will automatically be suspended on the following conditions:

Example

#pragma DebugBuild true
 
const F_CPU = 16000000
 
avr.device = atmega328p
avr.clock  = F_CPU
avr.stack = 32
 
uart.baud = 19200
uart.recv.enable
uart.send.enable
 
dim m as MemoryBlock
 
print 12;"debugbuild example"
print
 
'allocate a memoryblock
m = new MemoryBlock(16)
 
'force the exception by writing out of bounds
m.byteValue(20) = 123
 
halt()
 
Exception OutOfBoundsMemory
  ' print error message
  #if DEBUGBUILD
    print "*** Exception OutOfBoundsMemory: line ";str(DebugBuild.Row);", in file: '";DebugBuild.File;"' ***"
  #else
    print "*** Exception OutOfBoundsMemory ***"
  #endif
EndException