Name

Debug — The Laszlo debugger

Synopsis

JavaScript: Debug
Type: Object
Access: public
Build Flags: debug
Topic: LZX.Debugging
Declared in: WEB-INF/lps/lfc/compiler/LzRuntime.lzs

Description

Automatically created when an application is compiled in debug mode (requested by either using the canvas (LzCanvas)debug='true' attribute or by loading the application using the ?debug=true option).

Development Note

This is defined here rather than in debug/LzDebug so that a few bootstrap methods can be hung off it to handle logging of errors and warnings as early as possible.

Details

Static Properties (12)

atFreshLine
static public var atFreshLine = true;
Generic low-level output
atPrompt
static public var atPrompt = false;
backtraceStack
static private var backtraceStack = { ... };
Backtrace stack
_dbg_name
static private var _dbg_name = Debug;
See yourself
id_to_object_table
static private var id_to_object_table;
Debug ID table
internalPropertyPrefixes
static private var internalPropertyPrefixes;
Array of prefixes that indicate internal properties to the inspector. If Debug.showInternalProperties is false, any properties with a prefix in this set will not be displayed.
objseq
static private var objseq = 0.0;
Debug ID counter
printLength
static public var printLength = 1024;
Debug.write will truncate the printed representation of any object whose length is greater than Debug.printLength (default value 1024). See also: Debug.inspect.printLength
printPretty
static public var printPretty = true;
Debug.write will print 'pretty' versions of objects if this is true (default is true).
showInternalProperties
static public var showInternalProperties = false;
Debug.inspect will show internal properties if this is true (default is false).
singleEscapeCharacters
static private var singleEscapeCharacters = { ... };
Hash of characters to escape in strings when printPretty is false. (These are the ECMAScript SingleEscapeCharacter's for String Literals (7.8.4).
sourceWarningHistory
static private var sourceWarningHistory;

Static Methods (36)

abbreviate()
static private function abbreviate(s, l);
Abbreviate a string
addText()
static private function addText(msg);
Doc'd on real definition Bootstrap version
backtrace()
static public function backtrace(skip);
Snapshot the current call stack into a LzBacktrace object which can be printed or inspected Only available if lfc is compiled with --option debugBacktrace=true
debug()
static public function debug(control, args);
Display an debug on the console Takes a format control and any number of arguments. Cf., Debug.format
error()
static public function error(control, args);
Display an error on the console Takes a format control and any number of arguments. Cf., Debug.format
evalCarefully()
static private function evalCarefully(fileName, lineNumber, closure, context);
In the DHTML runtime, the checking is done by subroutines, for compactness.
format()
static public function format(control : string, args);
Formatted output. Formats its arguments using formatToString().
formatToString()
static public function formatToString(control : string, args) : LzMessage;
Formatted output to string Formats its arguments according to the control string The standard printf conversions are accepted, with the exception of `a`, `n`, and `p`. `e`, `f`, and `g` conversions are accepted but equivalent to `f`. The `h` and `l` length modifiers are accepted but ignored. No errors are signalled for invalid format controls or insufficient arguments. There is an additional format specifier `w` that formats the argument as if by `Debug.__String` with the 'pretty' option and creates a 'hotlink' so the object can be inspected. If alternate format is requested (#), `w` uses the full `Debug.__String` format used by write(). `%w` format obeys printLength. If a precision is specified, that is used as printLength.
freshLine()
static public function freshLine();
Puts the typeout on a fresh line
freshPrompt()
static public function freshPrompt();
Emit a prompt if not at one
functionName()
static private function functionName(fn, isGlobal : Boolean);
Compute a function name if you can
IDForObject()
static private function IDForObject(obj : object, force : boolean);
Return the unique ID for an object either by finding the object in the table, or if it is not in the table by creating a new entry and ID for it. Assigns unique names to function objects so they can be distinguished. Normally only objects will be assigned an ID, pass force=true to force non-object to be interned.
info()
static public function info(control, args);
Display an info on the console Takes a format control and any number of arguments. Cf., Debug.format
inspect()
static public function inspect(obj : Object, reserved : Null);
Display the properties of an object on the debug console. Debug.inspect displays each of the properties of its argument object using Debug.write. Properties that have complex values (or long representations that are abbreviated) are displayed as links. Clicking on the link will invoke Debug.inspect on that object.
inspectInternal()
static private function inspectInternal(obj, showInternalProperties);
Body of inspect: print the object and its properties, making links for exploring properties that are objects
internalProperty()
static private function internalProperty(str);
Internal property predicate. Tests to see if str has a prefix in Debug.internalPropertyPrefixes.
log()
static private function log(msg);
Doc'd on real definition Bootstrap version
makeObjectLink()
static private function makeObjectLink(obj, id);
Make a hyperlink to display an object by id, if id is not supplied, try to find it first
monitor()
static public function monitor();
monitorMessage()
static private function monitorMessage(control : String, args);
Create a monitor message from a format string
ObjectForID()
static private function ObjectForID(id);
Find the object associated with a particular debug ID
pad()
static public function pad(str, len : Number, dec : Number, pad : String, sign : String, radix : Number, force : Boolean);
pad or trim a string to a specified length
stackOverflow()
static private function stackOverflow();
__String()
static private function __String(thing : any, pretty : Boolean, limit : Number);
Coerce to an informative string for debugging Singleton types and atomic types are represented by themselves. Strings are quoted. Other types are printed as a type followed by a description. By default an object is described by its properties, a function by its name (if available). Objects are given an id that can be used to distinguish and inspect them. Classes and instances may define their own _dbg_name method (which must return a string) or property (which must be a string) to override the default description.
stringEscape()
static private function stringEscape(s, quoted);
Escape a string
trace()
static public function trace(who : Object, what : String);
Trace a method of an object. Will trace the named method of the object and print a message to the Debug console each time it is called or returned from. When called, the message will give a timestamp, the name of the function and the arguments it was called with. When returned from, the message will give the name of the function and the value it returned (if any). If backtraces are enabled, inspecting the message will reveal the call chain that caused the modification.
traceMessage()
static private function traceMessage(control : String, args);
Create a trace message from a format string
__typeof()
static private function __typeof(thing);
Compute an informative type string for debugging. Classes and instances can define their own _dbg_typename method (which must return a string) or property (which must be a string) to override the default behavior. This function returns the first of the following values: - thing._dbg_typename(), if thing._dbg_typename is a function and returns a non-null value. - thing._dbg_typename, if it's a string. - the __proto__'s constructor name, which should reflect instanceof if it does not, the reputed type will be enclosed in ?'s, indicating a possibly corrupted object - as a last resort: typeof(thing) If the prototype is is a complex prototype (if it is not the constructor prototype) a unique ID (of the prototype) is appended. If the object has a length, that is appended in parentheses.
unmonitor()
static public function unmonitor();
untrace()
static public function untrace(who : Object, what : String);
Stop tracing a method of an object.
versionInfo()
static public function versionInfo();
Display version info
warn()
static public function warn(control, args);
Display a warning on the console Takes a format control and any number of arguments. Cf., Debug.format
write()
static public function write();
Display one or more objects on the debug console. Note: format() allows more control over displaying multiple objects. Use it instead of Debug.write. Debug.write displays objects on the debug console in an informative format. Simple objects are represented as themselves. Printed Complex objects are represented by their type and a concise description. Long representations (and long Strings) are abbreviated if they are longer than printLength. Complex objects and abbreviated objects presented as links. Clicking on the link will invoke inspect() on the object, giving more detail.
__write()
static private function __write(msg);
All output passes through here. Maintains freshLine state. Optionally logs all output acccording to the setting of _dbg_log_all_writes
writeInternal()
static private function writeInternal(objects);
Implements write() in the core debugger
xmlEscape()
static private function xmlEscape(ts);

JavaScript Synopsis

public var Debug = { ... };