[IronPython] Debugging support PythonEngine

Kristof Wagemans kristof.wagemans at gmail.com
Thu Aug 10 23:10:25 CEST 2006

I have been experimenting with the debugging support for the PythonEngine.
When I use the following code I have several problems.


PythonEngine _pe;

EngineOptions options = new EngineOptions();

options.ClrDebuggingEnabled = true;

_pe = new PythonEngine(options);

_pe.ExecuteFile(@"  <script>  ");


Test script:


x = 1

y = 2


def Add(a, b):

    return a + b


z = Add(x, y)

print z



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.

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.

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't need to set ClrDebuggingEnabled in this case.


PythonEngine _pe;

_pe = new PythonEngine();

OptimizedEngineModule engineModule = _pe.CreateOptimizedModule(@"  <script>
", "__main__", true);



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?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060810/96044f80/attachment.html>

More information about the Ironpython-users mailing list