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.

  • #pragma DebugBuild true

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


The current line and file can be read by:

  • word = DebugBuild.Row
  • string = DebugBuild.File

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

  • Code in Exception-Handlers
  • Code in asm-endasm
  • Declarations or declaration blocks such as „dim“, „struct“, „data“, etc.
  • Command line where the machine code generated does not contain complex expressions or no exception can triggered, such as „nop“, „portb.1 = 1“, „else“, „endif“, „endproc“, „endfunc“, „return“ (without return value), „default“, „endselect“, „class“, „endclass“, „do“, „wend“, „next“, „halt()“ etc.
  • Command line where read the DebugBuild.Row/File
#pragma DebugBuild true
const F_CPU = 16000000
avr.device = atmega328p
avr.clock  = F_CPU
avr.stack = 32
uart.baud = 19200
dim m as MemoryBlock
print 12;"debugbuild example"
'allocate a memoryblock
m = new MemoryBlock(16)
'force the exception by writing out of bounds
m.byteValue(20) = 123
Exception OutOfBoundsMemory
  ' print error message
    print "*** Exception OutOfBoundsMemory: line ";str(DebugBuild.Row);", in file: '";DebugBuild.File;"' ***"
    print "*** Exception OutOfBoundsMemory ***"