private void OnEnterBreakMode(EnvDTE.dbgEventReason Reason, ref EnvDTE.dbgExecutionAction ExecutionAction)
        {
            int       activeProcessId = _serviceProvider.GetDTE().Debugger.CurrentProcess.ProcessID;
            AD7Engine engine          = AD7Engine.GetEngines().SingleOrDefault(target => target.Process != null && target.Process.Id == activeProcessId);

            if (engine != null)
            {
                long?activeThreadId = ((IThreadIdMapper)engine).GetPythonThreadId((uint)_serviceProvider.GetDTE().Debugger.CurrentThread.ID);
                if (activeThreadId != null)
                {
                    AttachProcess(engine.Process, engine);
                    ChangeActiveThread(activeThreadId.Value, false);
                }
            }
        }
Beispiel #2
0
        public void OnDebuggerAttached(EnvDTE.dbgEventReason Reason, ref EnvDTE.dbgExecutionAction ExecutionAction)
        {
            if (Reason == EnvDTE.dbgEventReason.dbgEventReasonBreakpoint)
            {
                try
                {
                    EnvDTE.Debugger debugger = Utils.GetDTE().Debugger;

                    if (debugger.CurrentMode == EnvDTE.dbgDebugMode.dbgBreakMode)
                    {
                        if (debugger.CurrentProgram != null && debugger.CurrentProgram.Process != null && debugger.CurrentProgram.Process.Name.EndsWith("csws.exe", StringComparison.OrdinalIgnoreCase))
                        {
                            int processId = debugger.CurrentProgram.Process.ProcessID;
                            if (processId != lastDebgProcessId)
                            {
                                lastDebgProcessId = processId;

                                bool isJustMyCodeEnabled = ((int)Registry.CurrentUser.GetValue(@"Software\Microsoft\VisualStudio\11.0\Debugger\JustMyCode", 0) == 1);

                                if (isJustMyCodeEnabled)
                                {
                                    ExecutionAction = EnvDTE.dbgExecutionAction.dbgExecutionActionStepInto;
                                }
                                else
                                {
                                    string scriptFile = ReadDebuggingMetadata(processId);
                                    if (scriptFile != null)
                                    {
                                        Utils.GetDTE().ItemOperations.OpenFile(scriptFile);
                                        ExecutionAction = EnvDTE.dbgExecutionAction.dbgExecutionActionStepInto;
                                    }
                                    else
                                    {
                                        MessageBox.Show("Debugger cannot step into the script code automatically.\nPlease either enable 'Just My Code' Debugger option or load the script file (and set the breakpoint) manually.", "CS-Script");
                                    }
                                }
                            }
                        }
                    }
                }
                catch { }
            }
        }
Beispiel #3
0
 public void DebuggerEvents_OnEnterBreakMode(EnvDTE.dbgEventReason Reason, ref EnvDTE.dbgExecutionAction ExecutionAction)
 {
     //System.Windows.Forms.MessageBox.Show(string.Format("Run Mode Enter!\r\n{0}\r\n{1}", Reason, ExecutionAction));
     debuggingModel.OnDebuggerAttached(Reason, ref ExecutionAction);
 }