[IronPython] Debugging support PythonEngine

Shri Borde Shri.Borde at microsoft.com
Fri Aug 18 23:00:20 CEST 2006

We do actually run all our tests using both DynamicMethods and AssemblyBuilder. This has helped us catch bugs in the DynamicMethods implementation. If there is any difference, it is a bug that should be fixed. Running "ipy.exe foo.py" will use the AssemblyBuilder, so that code path is used heavily. In fact, more than DynamicMethods.

The IL generation is actually unaware of whether the method is a DynamicMethod or a MethodBuilder. So there should not be any differences.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of J. Merrill
Sent: Thursday, August 17, 2006 9:44 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Debugging support PythonEngine

Without looking at the IP source, can we be confident that the same IL is produced when a DynamicMethod is created as when AssemblyBuilder is used?  Do the test cases get run with both settings of Options.GenerateDynamicMethods?

One of the most frustrating debugging problems is when code fails when running "normally", but works when attempting to debug, due to the code being generated differently in the two situations.

I have not heard anyone else worry out loud that e.g. the code running when using the console seems to be different than what is obtained using the IronPython.Compiler, etc.  How concerned should we be when we learn that the code paths are very different?

At 05:49 PM 8/17/2006, Shri Borde wrote
>The first issue is probably the same that IL offset 0 does not have any debug information.
>Calling the delegate ?add? steps into a DynamicMethod which confuses VS. A workaround for now is to add this statement before creating the PythonEngine.
>IronPython.Compiler.Options.GenerateDynamicMethods = false; This
>disabled the use of DynamicMethods altogether and will instead use AssemblyBuilder. This is not generally recommended or supported since you are going to leak memory since AssemblyBuilder memory cannot be reclaimed. However, VS seems to be better able to deal with AssemblyBuilder during stepping, and it might be good enough for you. This is a case where we will would need to teach the tool (VS) to handle DynamicMethods differently than it currently does.

J. Merrill / Analytical Software Corp

More information about the Ironpython-users mailing list