|
2004-07-13
| ||
| 22:02 | • Closed ticket [582522ffff]: aliases do not fire exec traces plus 2 other cha... artifact: d74d9c0bf9 user: msofer | |
| 21:26 | • Ticket [582522ffff]: 5 changes artifact: cd2f776fd4 user: dgp | |
|
2003-06-26
| ||
| 22:47 | • Ticket [582522ffff]: 1 change artifact: 942c3fc3ef user: dgp | |
| 17:30 | • Ticket [582522ffff]: 1 change artifact: 3e4312a763 user: dkf | |
|
2002-08-01
| ||
| 02:45 | • Ticket [582522ffff]: 4 changes artifact: 14cb716d8d user: dgp | |
|
2002-07-29
| ||
| 22:54 | • Ticket [582522ffff]: 4 changes artifact: 10fbfd4016 user: msofer | |
| 20:53 | • Ticket [582522ffff]: 4 changes artifact: 0a92fd7bc8 user: msofer | |
| 12:03 | • Ticket [582522ffff]: 4 changes artifact: 2535fb776a user: dgp | |
| 07:17 | • Ticket [582522ffff]: 6 changes artifact: 076f027834 user: msofer | |
|
2002-07-16
| ||
| 22:07 | • New ticket [582522ffff]. artifact: 5085a70c8a user: dgp | |
aliases do not fire exec traces
Closed / Fixed582522ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 22 years ago
Descriptionplain2002-07-16 22:07:25
% proc print args {puts "printtrace $args"}
% proc foo {} {puts orig_foo}
% interp alias {} al_foo {} foo
al_foo
% trace add execution foo enter {print foo}
% trace add execution al_foo enter {print al_foo}
% foo
printtrace foo foo enter
orig_foo
% al_foo
printtrace al_foo al_foo enter
orig_foo
%
The [print foo] trace is missing. It should
have been fired by [al_foo].
The problem seems to be that execution
traces are performed by
TclEvalObjvInternal() and aliases get
evaluated by TclObjInvoke() which
bypasses that and executes the
command procedure directly.
In combination with Bug 582506, it
seems the correct solution may be
to tie execution traces into the
command procedure itself instead
of in TclEvalObjvInternal().
msoferplain2002-07-29 07:17:28
Logged In: YES user_id=148712 Fixed by sending aliases through TEOI. Leaving openas reminder to check into the other suggestion. An alternative would be to eliminate the independent import mechanism, and just use it as a front-end for aliases which are now almost as fast.
dgpplain2002-07-29 12:03:18
Logged In: YES user_id=80530 I haven't reviewed the fix, but be sure to check it carefully that it preserves the same semantics. The difference between "invoke" and "eval" is very important, especially to be sure that aliases in safe interps don't "leak safety".
msoferplain2002-07-29 20:53:14
Logged In: YES user_id=148712 I'm pretty sure safety has been maintained: I only modified AliasObjCmd which processes aliases and never sent the flag TCL_INVOKE_HIDDEN to TclObjInvoke. TEOVI looks for commands using Tcl_GetCommandFromObj(), so essentially using a cached value if (available && valid), and looking up by name otherwise. So the issue is: could the cmdName object have a cached reference to a hidden command? I'll build extra safety and make the Alias structure keep a private copy of the targetCmdName object, so that it never keeps a foreign cached value. BTW, traces on hidden commands are still not being fired ...
msoferplain2002-07-29 22:54:47
Logged In: YES
user_id=148712
OK: if a command is hidden, Tcl_GetCommandFromObj() will
invalidate any cached reference. It works OK:
[mig@mini unix]$ ./tclsh
% proc a {} {puts hello}
% interp alias {} b {} a
b
% b
hello
% interp hide {} a
% b
ambiguous command name "a": after append array auto_execok
auto_import auto_load auto_load_index auto_qualify
Adding this to the testsuite (interp-9.3)
dgpplain2002-08-01 02:45:16
Logged In: YES user_id=80530 interesting. I was actually more concerned about the arguments, making sure that the right ones gets substituted in the right interp.
dkf Ticket [582522ffff]: 1 change
[History diff]2003-06-26 17:30:34
dgp Ticket [582522ffff]: 1 change
[History diff]2003-06-26 22:47:03
dgpplain2004-07-13 21:26:44
Logged In: YES user_id=80530 Anything left to resolve here, or can we close this?
msofer Closed ticket [582522ffff].
[History diff]2004-07-13 22:02:28
Log in (anonymous is fine) to add a comment.