// Sets a breakpoint on a given function pointer, that represents some code outside of the Python DLL that can potentially // be invoked as a result of the current step-in operation (in which case it is the step-in target). private void OnPotentialRuntimeExit(DkmThread thread, ulong funcPtr) { if (funcPtr == 0) { return; } if (_pyrtInfo.DLLs.Python.ContainsAddress(funcPtr)) { return; } else if (_pyrtInfo.DLLs.DebuggerHelper != null && _pyrtInfo.DLLs.DebuggerHelper.ContainsAddress(funcPtr)) { return; } else if (_pyrtInfo.DLLs.CTypes != null && _pyrtInfo.DLLs.CTypes.ContainsAddress(funcPtr)) { return; } var bp = _process.CreateBreakpoint(Guids.PythonStepTargetSourceGuid, funcPtr); bp.Enable(); _stepInTargetBreakpoints.Add(bp); }
private static DkmRuntimeInstructionBreakpoint CreateBreakpoint(DkmProcess process, ulong addr, RuntimeDllBreakpointHandler handler, bool enable) { var runtimeBreakpoints = process.GetOrCreateDataItem(() => new RuntimeDllBreakpoints()); var bp = process.CreateBreakpoint(Guids.LocalComponentGuid, addr); if (enable) { bp.Enable(); } runtimeBreakpoints.Handlers.Add(bp.UniqueId, handler); return(bp); }