<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>
<!--a:link
        {mso-style-priority:99;}
span.MSOHYPERLINK
        {mso-style-priority:99;}
a:visited
        {mso-style-priority:99;}
span.MSOHYPERLINKFOLLOWED
        {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;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:Arial;
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:Calibri;
        color:#1F497D;}
span.EmailStyle19
        {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;}
 /* List Definitions */
 @list l0
        {mso-list-id:646125527;
        mso-list-type:hybrid;
        mso-list-template-ids:2110404764 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:.25in;
        mso-level-number-position:left;
        margin-left:.25in;
        text-indent:-.25in;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
-->
</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'>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.<br>
<br>
<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'>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.<br>
<br>
<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 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 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'>(http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)</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>