Monday, November 16, 2015, 5:27:47 何游鑫:
Hi, I'm using IronPython embedding in vs2012 with c# code. and I need to watch the Var's Value when the script is debugging? is the current Version IronPython support this ? if it suppord ,Is there any method which I can use ?or when the IronPython can support it ? Could you please give me some help ? you can see my project there:[https://github.com/heyxEvget/IronPython-Debugger/tree/master/SoftWare] I use this code: engine.SetTrace(OnTraceback); private void OnTraceback(TraceBackFrame frame, string result, object payload) { switch (result) { case "call": TracebackCall(); break; case "line": TracebackLine(); break; case "return": TracebackReturn(); break; } } |
What you basically need is to check your variable at every line. Without peeking into the line, it's impossible to tell what it does. Of course, you can dig up the engine's assignment subroutine and set a C#-level
debug thingamajig on them. But that's out of cscope of IronPython's facilities.
It's only useful to check if the variable is in scope (in the frame's locals and globals).
Unless you're interested in mutations of a mutable object rather than assignings - then it might be better to set checks on the mutation functions.
In addition to that, you may peek if the current line is an assignment operator
or includes a dictionary assignment/update and things like `vars()' result.
This is too much for a one-off task but looks promising in you're writing a
production-grade debugger.
--
Regards,
Ivan Pozdeev
_______________________________________________ Ironpython-users mailing list Ironpython-users@python.org https://mail.python.org/mailman/listinfo/ironpython-users