where
where( [g_unevaluated] [x_depth] [x_skip] [p_port] ) =>x_result
Description
Prints the functions on the stack and their arguments to the depth specified, or to the bottom of the stack, including the local variables and their bindings.
It is similar to stacktrace, but in addition to printing out the functions on the stack, it also prints out the local variables and their bindings. The where function observes the following rules:
-
When debug mode is on and the
traceArgsstatus switch has been set to non-nil, prints the evaluated function arguments unless g_unevaluated is set tot. -
When debug mode is off,
wherealways prints the unevaluated arguments. -
whereskips over the number of function calls specified by x_skip. -
If there are no functions on the stack (you are at the top, for example)
wheredoes not print anything and returns 0.
This function is usually used inside the break or error handler.
Arguments
Value Returned
Examples
Suppose /tmp/color.il defines function initColor:
(defun initColor (object)
(let ((colorList '(red green yellow)) color)
(setq color (concat (get object 'color)))
(if (memq color colorList)
(printf "color %s initialized" (get object 'name)))
)
)
installDebugger
=> t
1> (sstatus sourceTracing t)
; Turns on sourceTracing to get line numbers
=> t
1> load "/tmp/color.il"
=> t
1> (putprop 'object1 "green" 'color)
=> "green"
1> (initColor 'object1)
*** Error in routine fprintf/sprintf:
Message: *Error* fprintf/sprintf: format spec. incompatible
with data
Debug 2> where
<<< Stack Trace >>>
errorHandler("fprintf/sprintf" 0 t nil ("*Error* fprintf/sprintf: format spec. incompatible with data" nil))
printf("color %s initialized" get(object 'name))
at line 5 in file /tmp/color.il
if(memq(color colorList) printf("color %s initialized" get(object 'name)))
let(((colorList '&) color) (color = concat(get(object &))) if(memq(color colorList) printf("color %s initialized" get(object &))))
colorList = (red green yellow)
color = green
object = object1
initColor('object1)
5
Related Topics
Return to top