XEROX DEBUGGER-CONTEXT 2 4 1 DEBUGGER-CONTEXT 1 4 By: Herb Jellinek (Jellinek.pa@Xerox.com) This document last edited on August 18, 1987. INTRODUCTION When debugging Common Lisp programs, have you ever wished that the Xerox Lisp debugger let you do things in the right lexical context? Ever wish you could access locally-defined functions, return from blocks, or evaluate variables in the debugger without resorting to the inspector? Ever wish you could tell the "big boys" in Washington a thing or two? Well, two out of three ain't bad. DEBUGGER-CONTEXT gives you the ability to access and modify the lexical context of code you are debugging in a straightforward way. USER INTERFACE DEBUGGER-CONTEXT defines two debugger commands that affect the debugger's lexical context. lex [Debugger Command] Sets the lexical context of the debugger window to that of the stack frame selected in the backtrace window (il:lastpos). Henceforth, all evaluation done in this debugger window will be with respect to that lexical environment. The lexical environment of a frame is taken to be the first one encountered as an argument in that frame. Once the lex command is given, selecting other stack frames in the backtrace window will not change the lexical environment; you must issue another lex command to do so. The lexical environment of a frame is taken to be the first one encountered as an argument in that frame. N.B. Any operation performed in a lexical context (as created by the lex command) is done relative to that context. For example, if we do the following: (defun test (a b) (+ a b)) (test 3 t) ; get a warning about b's value retry ; enter the debugger with "Arg not a NUMBER" error and then select the (+ a b) frame in the debugger and say lex (defun frob () (list a b)) Calling (frob) later will return (3 t) even after you've exited the debugger; this is probably not what you want. Moreover, if you store frob on a file and read it back in, its lexical context will be lost, as will the values of a and b. unlex [Debugger Command] Removes the current lexical context; all evaluation will subsequently be done with respect to the current dynamic environment. (LIST ((PAGE NIL (PAPERSIZE LETTER STARTINGPAGE# 54) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO NIL) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE NIL . LETTER) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO NIL) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE NIL . LETTER) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO NIL) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))))) /ÈÈT(È.HHÈÈ(HHÔ.È È(È(ŠŠ8(ŠŠ8DÈÈ PAGEHEADING RUNNINGHEADMODERN TERMINAL MODERN MODERN MODERN MODERNLOGO   HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN +.  [m ãˆjFR+:%>X€ŠUzº