Add an option to step through code for which no source is available


See https://pytools.codeplex.com/workitem/2070 for a scenario where this is useful.


mrolle wrote Jan 3 at 2:43 AM

I case where I would find that useful is where I am in a dynamically generated function (that is, I created a string containing a def and then exec'd it). This function calls another normal function with source code.
If I step into a call to the first function, I get a Disassembly window, and if I step into the second function, I am in the second function, but the Disassembly window is still active and I have to either change windows or delete the Disassembly window. The stack shows the first function as <string>.

The point of this is that if you want to continue when stepping into a function with no source, then be sure to catch a further call back into a function with source.

Zooba wrote Jan 3 at 4:29 AM

Good point. I've changed it to "step through" so we don't forget.

pminaev wrote Jan 3 at 4:48 AM

I'm not actually sure that we can change this. It behaves the same way in languages that do have disassembly (like C# and C++). The point, I believe, is that disassembly view is supposed to be an alternative (to source) view to the frame, and it's furthermore considered always valid for any frame. So once you have it opened, VS assumes that it is what you want to see, even after you step into some code that has valid source - until you manually switch back to source view. And we don't control which document tab opens for the current frame - we just report the document info to the debugger, and it decides what to do with it.

OTOH, the current behavior might make more sense if we can make the disassembly show the actual disassembly (of Python bytecode). Looking at IDebugDisassemblyStream2, it seems flexible enough to allow for custom bytecode.