debug

 

 

Overview

The debug function provides browser oriented debugging features for Lambdas running on the DRM (Dynamic typed Register Machine) Virtual Machine. Lambdas running on native code or on other virtual machines cannot be debugged with this function. More information on the DRM Virtual Machine can be found in the Virtual Machine Chapter.

The debug function provides commands for setting the Smartbase engine switches and debugger trace settings.

Commands and arguments to the "debug" function:

The Smartbase engine has two major execution settings: JitON and JitOFF. In JitON mode, the Just-In-Time compiler generates actual machine register code for extremely fast execution. In JitOFF mode, the Virtual Machine Emulator is turned on allowing debugger tracing of instructions.

In JitOFF mode, the Smartbase engine allows tracing of VM Emulated instructions IF AND ONLY IF the instructions have been executed as a result of the debugEval function. For example, the following code

(debugEval "(foo testing:)")

will evaluate the phrase "(foo testing:)" with VM instruction tracing on under the following rules and guidelines.

JitON Rule:

If the Smartbase engine JIT is ON, then debugEval will evaluate the specified expression WITHOUT instruction tracing. Instruction tracing is ONLY available with JitOFF.

Trace Rule:

Once inside the debugEval function, with JitOFF, instruction execution will proceed normally until the current debug trace settings requests a trace break. A trace break is always requested under the following trace rules:

Break Rule:

Once inside the debugEval function, with JitOFF, if a trace break is requested, by the above trace rules, then the VM Emulator calls the "debugDetective" function, which has been supplied by the user. As soon as the debugDetective function returns control (or if debugDetective is VOID), the VM Emulator continues instruction evaluation normally, subject to the above trace rules.

debugDetective:

The user supplied debugDetective, in combination with the debugEval function, provide an enhancement to the standard Lisp debugging method, which is to insert writeln instructions at strategic locations in the code. Before the debugDectective function is called, the VM Emulator sets the gTP->DebugSuspended switch to ON so that instuction tracing is inactive until the debugDetective function returns control to the VM Emulator.

The activities of the debugDetective can include the traditional Lisp writeln instructions or they can be as complex and creative as the user supplied debugDetective function can manage.

Once the debugDetective function returns control to the VM Emulator, instruction tracing continues in the normal manner until the debugEval function retiurns control. Instruction tracing is ONLY active while inside the debugEval function when JitOFF is true.

The debugDetective function is called under three circumstances as follows:

;; Called by the debug & debugEval functions when the engine state is changed.

(debugDetective)

;; Called by the VM Emulator when a trace break has been requested.

(debugDetective Lambda CodeL Recursion Rv Av Tv Pv Cv Sv Iv void)

;; Called by the VM Emulator when an error has occured.

(debugDetective Lambda CodeL Recursion Rv Av Tv Pv Cv Sv Iv errMsg)

Usage

The debug function also operates in cooperation with the debugEval, debugDetective, and disassemble functions. For correct operation, the target AIS Lambda must have been compiled with (debug compileon:) so that debug info is generated by the compiler. The disassemble command will display the source for any Lambda compiled with (debug compileon:). The 000045: displacements, shown in these source lines, are those generated from the disassemble command, and represent the closest VM assembler displacement to the start of the specified source line

 

Syntax


Expression:(debug command) ;; Set or get Smartbase engine debug settings

Arguments Name Type Description
Argument:commandString|Symbol The String or Symbol command specifying the action to be taken

Returns: The result of the requested action


 

Examples

Here are a number of links to Lambda coding examples which contain this instruction in various use cases.

 

Argument Types

Here are the links to the data types of the function arguments.

Lambda Boolean Symbol

Here are also a number of links to functions having arguments with any of these data types.

++ += /= *=
-- -= abortTransaction addMethod
append apply argCount argFetch
attachLibrarian badd balance bcompareEQ
bcompareGE bcompareGT bcompareLE bcompareLT
bcompareNE bdiv beginTransaction binaryInsert
binaryNand binaryNor binaryNot binaryNxor
binarySearch bitwiseAnd bitwiseNand bitwiseNor
bitwiseNot bitwiseNxor bitwiseOr bitwiseShiftLeft
bitwiseShiftRight bitwiseXor bmod bmul
boolean callcc ccompareEQ ccompareGE
ccompareGT ccompareLE ccompareLT ccompareNE
cdr character checkPointTransaction class
clear commitTransaction compareEQ compareGE
compareGT compareLE compareLT compareNE
compare comparison compile compress
cons copy count debugBrowsableProcs
debug defchild defclass define(macro)
define defmacro defmethod deforphan
defriend defun delete detachLibrarian
dimension disassemble display downcase
encode evalInSyncLocalContext eval exportCsv
exportSbf exportTab fdisplay fileClose
fileCopy fileDir fileDisplay fileErase
fileOpen fileRead fileWrite filewriteln
findBlock gc getGlobalValue getSymbolTable
globalBinding icompareEQ icompareGE icompareGT
icompareLE icompareLT icompareNE importCsv
importSbf importTab insert inside
inspect integer isAtom isBitVector
isBoolean isBound isByteVector isCharAlphabetic
isCharAlphanumeric isCharLowercase isCharName isCharNumeric
isCharUppercase isCharWhitespace isChar isCharacter
isClass isComplex isDate isDictionary
isDirectory isEqual isError isEven
isExact isFloatVector isIdentical isImmediate
isInexact isInside isIntegerVector isInteger
isLambda isMatrix isMember isMoney
isNegative isNull isNumberMatrix isNumberVector
isNumber isObjectVector isObject isOdd
isPair isPcodeVector isPositive isString
isStructure isSymbol isText isTransaction
isType isVector isZero lambda
length lisp list loadModule
loadWorkspace lock logConsole macroReplace
makeLambda makeQuotedList makeQuotedSymbol member
methodsOf money morph myself
ncompareEQ ncompareGE ncompareGT ncompareLE
ncompareLT ncompareNE new number
offset onError openLog pair
parent parse pointer proplist
proprecord putprop qt quit
refLibrarian ref remProp remove
rename reset saveModule saveObject
saveRepository saveWorkspace send setBlock
setCar setCdr setLastCdr set
setf setq sizeof sort
sql stringCiEQ stringCiGE stringCiGT
stringCiLE stringCiLT stringCiNE string
substringCiEQ substringCiGE substringCiGT substringCiLE
substringCiLT substringCiNE substringEQ substringGE
substringGT substringLE substringLT substringNE
super svmRegression symbolToTypeCode symbol
systemCheck type uniqueInsert unlock
vectorFill version writelg writeln

Analytic Information Server (AIS)

AIS Component Systems

  • Smartbase Engine
  • QT C++ Libraries
  • MySQL Relational Database
  • AIS Lisp Libraries
  • Rapid Analytic Demo IDE