This is easiest to reproduce with a hello world type one-liner, as in:
Then setting a breakpoint on print and running it. The breakpoint may not light up before the program actually starts, and so it is skipped. This is very rare in the most common local x86 case, but can be seen more often when debugging x64, and even more often
when debugging a remote machine, since the transport overhead in this case makes the debugger more likely to lose the race.
The underlying cause here is that we don't enable Python debugging until the helper DLL (with the trace function) is loaded into the process - even if we did, we couldn't hit breakpoints without a trace func. And the helper DLL is loaded asynchronously on a
background thread via CreateRemoteThread(LoadLibrary), since that's the easiest way to inject a DLL into the running process.
The fix for this should be to block Python eval loop from running at the moment where we begin attaching and until the helper DLL is fully loaded and initialized.