1

Resolved

Modules loaded before attaching in mixed-mode do not resolve breakpoints

description

(from https://pytools.codeplex.com/discussions/527400)

When the module is loaded when debugger is attached, the debugger directly intercepts the creation of the code object for code of that module, and uses information in that object (and specifically, co_filename) to create the VS module object. This works because co_filename is always .py.

However, when you attach to a process that is already running and had loaded some modules, there's no way to enumerate all existing code objects in it. So our fallback is to inspect sys.modules, and look at the __file__ attribute of the objects inside. This breaks down here because __file__ will actually use .pyc for anything other than the entry point module (when using python.exe), and the code that matches breakpoint filenames does not do anything special to match .py vs .pyc.

comments