<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40"
xmlns:ns0="http://schemas.microsoft.com/office/2004/12/omml">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--p.MSONORMAL
        {mso-style-builtin:yes;}
li.MSONORMAL
        {mso-style-builtin:yes;}
div.MSONORMAL
        {mso-style-builtin:yes;}
a:link
        {mso-style-priority:99;
        mso-style-builtin:yes;}
span.MSOHYPERLINK
        {mso-style-priority:99;
        mso-style-builtin:yes;}
a:visited
        {mso-style-priority:99;
        mso-style-builtin:yes;}
span.MSOHYPERLINKFOLLOWED
        {mso-style-priority:99;
        mso-style-builtin:yes;}
p.MSOACETATE
        {mso-style-priority:99;
        mso-style-builtin:yes;}
li.MSOACETATE
        {mso-style-priority:99;
        mso-style-builtin:yes;}
div.MSOACETATE
        {mso-style-priority:99;
        mso-style-builtin:yes;}
span.BALLOONTEXTCHAR
        {mso-style-priority:99;}

 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Segoe UI";}
@font-face
        {font-family:"Bookman Old Style";
        panose-1:2 5 6 4 5 5 5 2 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:Tahoma;}
span.BalloonTextChar
        {font-family:Tahoma;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:Arial;
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:Calibri;
        color:#1F497D;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:Arial;
        color:navy;}
span.EmailStyle22
        {mso-style-type:personal;
        font-family:Calibri;
        color:#1F497D;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Thanks for the info. It&#8217;s good to
hear that there will be improvement possible in this area in the future. Although,
the way I interpret your explanation, it&#8217;s not going to be anytime soon (or
even this year), because you need enhancements to the underlying platform to
make this possible.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I&#8217;ve experimented a bit with System.Diagnostics.DebuggerNonUserCodeAttribute
to see if it wasn&#8217;t possible to skip stepping into IronPython code.
Unfortunately, the point where I get stuck in the assembly instructions is in
generated code. I don&#8217;t understand this part of the code well enough to
know if it&#8217;s possible to make the debugger skip these lines. Maybe this
is why you need the changes to the platform?<o:p></o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=3 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
users-bounces@lists.ironpython.com [mailto:users-bounces@lists.ironpython.com] <b><span
style='font-weight:bold'>On Behalf Of </span></b>Shri Borde<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday 11 August 2006 21:04<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Discussion
 of IronPython</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [IronPython]
Debugging support PythonEngine</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color="#1f497d" face=Calibri><span
style='font-size:11.0pt;font-family:Calibri;color:#1F497D'>Yes, we will
definitely be working on improving the debugging support as it is a critical
part of the development process. &nbsp;However, full support will need work in
all parts of the tool chain including VS.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color="#1f497d" face=Calibri><span
style='font-size:11.0pt;font-family:Calibri;color:#1F497D'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color="#1f497d" face=Calibri><span
style='font-size:11.0pt;font-family:Calibri;color:#1F497D'>Python local
variables are implemented as normal MSIL variables (except in cases like
closures). Hence, VS is able to display them.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color="#1f497d" face=Calibri><span
style='font-size:11.0pt;font-family:Calibri;color:#1F497D'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color="#1f497d" face=Calibri><span
style='font-size:11.0pt;font-family:Calibri;color:#1F497D'>Currently, the best
way to debug Python functions in VS while using PythonEngine would be to enable
EngineOptions.</span></font><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>ClrDebuggingEnable</span></font><font size=2
color="#1f497d" face=Calibri><span style='font-size:11.0pt;font-family:Calibri;
color:#1F497D'>, open the PY file in VS and put a breakpoint where you want.
Stepping in and out of Python functions will step you through methods in
IronPython.dll .<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color="#1f497d" face=Calibri><span
style='font-size:11.0pt;font-family:Calibri;color:#1F497D'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><font size=1 face="Segoe UI"><span style='font-size:9.0pt;
font-family:"Segoe UI";font-weight:bold'>From:</span></font></b><font size=1
face="Segoe UI"><span style='font-size:9.0pt;font-family:"Segoe UI"'>
users-bounces@lists.ironpython.com [mailto:users-bounces@lists.ironpython.com] <b><span
style='font-weight:bold'>On Behalf Of </span></b>Kristof Wagemans<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, August 11, 2006
12:36 AM<br>
<b><span style='font-weight:bold'>To:</span></b> '<st1:PersonName w:st="on">Discussion
 of IronPython</st1:PersonName>'<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [IronPython]
Debugging support PythonEngine<o:p></o:p></span></font></p>

</div>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'>Are
there plans to improve the debugging experience in the future or are you at a
point where it is &#8220;as good as it gets&#8221;? Being able to debug makes
writing and using python scripts a lot easier.<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'>Inside
functions I can see not only the function parameters but also the newly defined
local variables. Are these different from the global variables? I would have
expected that the function locals are also stored inside a dictionary.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Is it possible to step into python
functions without getting into assembly instructions? This is very frustrating
and degrades the debugging experience a lot. This is the more important issue
for me. I&#8217;m not going to be using global variables frequently, but mostly
functions loaded in the PythonEngine that are called from C#.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=3 width="100%" align=center>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
users-bounces@lists.ironpython.com [mailto:users-bounces@lists.ironpython.com] <b><span
style='font-weight:bold'>On Behalf Of </span></b>Shri Borde<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday 11 August 2006 0:30<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Discussion
 of IronPython</st1:PersonName><br>
<b><span style='font-weight:bold'>Cc:</span></b> Glenn Hackney<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [IronPython]
Debugging support PythonEngine</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color="#1f497d" face=Calibri><span
style='font-size:11.0pt;font-family:Calibri;color:#1F497D'>If EngineOptions.</span></font><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>ClrDebuggingEnabled
is set, we use AssemblyBuilder, TypeBuilder, etc for PythonEngine.Executed. The
code generated by AssemblyBuilder, TypeBuilder, etc supports PDB debug
information tracking for the methods, and so you will be able to set
breakpoints in the code. However, it does not guarantee a perfect debugging
experience. PythonEngine.ExecuteFile will use a dictionary for storing global
variables, and these will not be visible because VS does not know about the
dictionary. If you use PythonEngine.CreateOptimizedModule, most global
variables are implemented using CLR statics, and so VS may be able to display
them for you. Global variables added using an exec statement will still not be
visible.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color="#1f497d" face=Calibri><span
style='font-size:11.0pt;font-family:Calibri;color:#1F497D'>If EngineOptions.</span></font><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>ClrDebuggingEnabled
is false, we will use System.Reflection.Emit.DynamicMethod. This does not
support debug information tracking at all, and you will not even be able to see
function variables.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>So </span></font><font size=2 color="#1f497d" face=Calibri><span
style='font-size:11.0pt;font-family:Calibri;color:#1F497D'>If EngineOptions.</span></font><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>ClrDebuggingEnabled
is will improve your debugging experience, but it wont give you a perfect
experience.</span></font><font size=2 color="#1f497d" face=Calibri><span
style='font-size:11.0pt;font-family:Calibri;color:#1F497D'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color="#1f497d" face=Calibri><span
style='font-size:11.0pt;font-family:Calibri;color:#1F497D'><o:p>&nbsp;</o:p></span></font></p>

<div>

<p class=MsoNormal><b><font size=2 color="#1f497d" face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:#1F497D;font-weight:bold'>________</span></font></b><font
size=1 color="#1f497d" face="Bookman Old Style"><span style='font-size:8.0pt;
font-family:"Bookman Old Style";color:#1F497D'> <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 color="#1f497d" face="Bookman Old Style"><span
style='font-size:8.0pt;font-family:"Bookman Old Style";color:#1F497D'><a
href="http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038">Do
you want to help develop Dynamic languages on CLR?</a> </span></font><font
size=1 color=white face="Bookman Old Style"><span style='font-size:1.0pt;
font-family:"Bookman Old Style";color:white'>(<a
href="http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038">http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038</a>)</span></font><font
size=1 face="Bookman Old Style"><span style='font-size:8.0pt;font-family:"Bookman Old Style"'><o:p></o:p></span></font></p>

</div>

<div>

<div style='border:none;border-top:solid #91C0FF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><font size=1 face="Segoe UI"><span style='font-size:9.0pt;
font-family:"Segoe UI";font-weight:bold'>From:</span></font></b><font size=1
face="Segoe UI"><span style='font-size:9.0pt;font-family:"Segoe UI"'>
users-bounces@lists.ironpython.com [mailto:users-bounces@lists.ironpython.com] <b><span
style='font-weight:bold'>On Behalf Of </span></b>Kristof Wagemans<br>
<b><span style='font-weight:bold'>Sent:</span></b> Thursday, August 10, 2006
2:10 PM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Discussion
 of IronPython</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> [IronPython] Debugging
support PythonEngine<o:p></o:p></span></font></p>

</div>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I have been experimenting with the debugging support for the
PythonEngine. When I use the following code I have several problems.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>PythonEngine _pe;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>EngineOptions options = new EngineOptions();<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>options.ClrDebuggingEnabled = true;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>_pe = new PythonEngine(options);<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>_pe.ExecuteFile(@&quot;&nbsp; &lt;script&gt;&nbsp; &quot;);<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Test script:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>x = 1<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>y = 2<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>def Add(a, b):<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp; return a + b<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>z = Add(x, y)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>print z<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I opened the script file in Visual Studio and placed a
breakpoint at the beginning of the file. The application runs and breaks at the
correct location. Stepping through the lines works, but I cannot see any values
of the global variables.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>When I try to step into the function I get a notification
that there is no source code available and I must show the disassembly. After I
step several times through the assembly instructions I can return to the
original source code. Inside the function I can see the values of the function
variables.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I have tried debugging ipy.exe with the script and there I
can see the global variables, but I still have the problem with stepping into a
function. In ipy.exe the script file is executed in a different way. Using the
same method I can also see the global variables with my PythonEngine instance.
I apparently don&#8217;t need to set ClrDebuggingEnabled in this case.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>PythonEngine _pe;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>_pe = new PythonEngine();<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>OptimizedEngineModule engineModule =
_pe.CreateOptimizedModule(@&quot;&nbsp; &lt;script&gt;&nbsp; &quot;,
&quot;__main__&quot;, true);<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>engineModule.Execute();<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Are you required to use an OptimizedEngineModule to be able
to debug completely? Am I forgetting some settings for debugging? Can I step
directly into a function without getting into the assembly instructions?<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>