From: SourceForge.net <no...@so...> - 2009-11-06 19:40:50
|
Bugs item #752067, was opened at 2003-06-10 19:59 Message generated for change (Comment added) made by crategus You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=752067&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Lisp Core Group: None Status: Open Resolution: None Priority: 2 Private: No Submitted By: Stavros Macrakis (macrakis) Assigned to: Nobody/Anonymous (nobody) Summary: Can't untrace ?meval Initial Comment: If you trace(?meval), you can't untrace it! This is presumably because you are running inside ?meval when untrace tries to untrace, but that's no excuse! (The 22's below are just a trivial case of evaluation.) (C1) 22; (D1) 22 (C2) trace(?meval); (D2) [MEVAL] (C3) 22; 1 Enter ?MEVAL [22] 1 Exit ?MEVAL 22 (D3) 22 (C4) untrace(?meval); 1 Enter ?MEVAL [UNTRACE(MEVAL)] 1 Exit ?MEVAL [MEVAL] (D4) [MEVAL] (C5) 22; 1 Enter ?MEVAL [22] 1 Exit ?MEVAL 22 (D5) 22 (C6) untrace(); 1 Enter ?MEVAL [UNTRACE()] 1 Exit ?MEVAL [MEVAL] (D6) [MEVAL] (C7) 22; 1 Enter ?MEVAL [22] 1 Exit ?MEVAL 22 (D7) 22 ---------------------------------------------------------------------- >Comment By: Dieter Kaiser (crategus) Date: 2009-11-06 20:40 Message: The bug occurs not only for meval but for any traced function which is called while $untrace is executed. Again the bug. We do a Lisp trace for the function trace-handler: (%i2) :lisp (trace trace-handler) ;; Tracing function TRACE-HANDLER. (TRACE-HANDLER) (%i2) trace(?meval); (%o2) [?meval] When we try to untrace meval the routine trace-handler is called for the function meval itself with an argument '(($untrace) meval): (%i3) untrace(?meval); 1. Trace: (TRACE-HANDLER 'MEVAL '((($UNTRACE) MEVAL))) 1 Enter ?meval [untrace(?meval)] 1 Exit ?meval [?meval] 1. Trace: TRACE-HANDLER ==> ((MLIST SIMP) MEVAL) (%o3) [?meval] We trace in addition the function meval1. Now we can observe a call for meval1 with the argument '(($untrace) meval1): (%i4) trace(?meval1); 1. Trace: (TRACE-HANDLER 'MEVAL '((($TRACE) MEVAL1))) 1 Enter ?meval [trace(?meval1)] 1 Exit ?meval [?meval1] 1. Trace: TRACE-HANDLER ==> ((MLIST SIMP) MEVAL1) (%o4) [?meval1] (%i5) untrace(?meval1); 1. Trace: (TRACE-HANDLER 'MEVAL '((($UNTRACE) MEVAL1))) 1 Enter ?meval [untrace(?meval1)] 2. Trace: (TRACE-HANDLER 'MEVAL1 '((($UNTRACE) MEVAL1))) 1 Enter ?meval1 [untrace(?meval1)] 1 Exit ?meval1 [?meval1] 2. Trace: TRACE-HANDLER ==> ((MLIST) MEVAL1) 1 Exit ?meval [?meval1] 1. Trace: TRACE-HANDLER ==> ((MLIST SIMP) MEVAL1) (%o5) [?meval1] This is the code to avoid the bug. We check if we try to untrace the function fun: (defun trace-handler (fun largs) (if (or return-to-trace-handle (and (not (atom (car largs))) (not (atom (caar largs))) (eq (caaar largs) '$untrace) (eq (cadar largs) fun))) ;; We were called by the trace-handler or by $untrace and the function ;; fun is to be untraced. (trace-apply fun largs) ... With this change it works as expected: (%i7) untrace(?meval1); 1 Enter ?meval [untrace(?meval1)] 1 Exit ?meval [?meval1] (%o7) [?meval1] (%i8) untrace(?meval); (%o8) [?meval] (%i9) trace; (%o9) [] Dieter Kaiser ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=752067&group_id=4933 |