コード例 #1
0
        public int OnCustomDebugEvent(ref Guid ProcessId, VsComponentMessage message)
        {
            try {
                VsPackageMessage code = (VsPackageMessage)message.MessageCode;
                switch (code)
                {
                case VsPackageMessage.AttachToChild:
                    int     parentId = (int)message.Parameter1;
                    int     childId  = (int)message.Parameter2;
                    Process proc     = Process.GetProcessById(childId);
                    if (proc != null)
                    {
                        DebugAttach.AttachToProcess(new Process[] { proc }, ChildDebuggingMode.AlwaysAttach);
                    }
                    break;

                case VsPackageMessage.IsChildDebuggingEnabled:
                    Guid processGuid    = (Guid)message.Parameter1;
                    Guid connectionGuid = (Guid)message.Parameter2;
                    DkmTransportConnection connection = DkmTransportConnection.FindConnection(connectionGuid);
                    if (connection != null)
                    {
                        if (IsChildDebuggingEnabledByDefault)
                        {
                            DkmCustomMessage response = DkmCustomMessage.Create(
                                connection,
                                null,
                                PackageServices.VsDebuggerMessageGuid,
                                (int)VsDebuggerMessage.EnableChildProcessDebugging,
                                processGuid,
                                null
                                );
                            response.SendLower();
                        }
                        else
                        {
                            Logger.Log(
                                "Not enabling child process debugging for process {0}.  " +
                                "Child debugging is disabled by default.",
                                processGuid);
                        }
                    }
                    break;
                }
            } catch (Exception exception) {
                Logger.LogException(
                    exception,
                    "An error occured while handling a VsPackage message.  HR=0x{0:X}",
                    exception.HResult);
            }
            return(0);
        }
コード例 #2
0
 public int OnCustomDebugEvent(ref Guid ProcessId, VsComponentMessage message) {
     switch ((VsPackageMessage)message.MessageCode) {
         case VsPackageMessage.WarnAboutPythonSymbols:
             WarnAboutPythonSymbols((string)message.Parameter1);
             return VSConstants.S_OK;
         case VsPackageMessage.WarnAboutPGO:
             WarnAboutPGO((string)message.Parameter1);
             return VSConstants.S_OK;
         case VsPackageMessage.SetDebugOptions:
             SetDebugOptions((IDebugEngine2)message.Parameter1);
             return VSConstants.S_OK;
         default:
             return VSConstants.S_OK;
     }
 }
コード例 #3
0
        public int OnCustomDebugEvent(ref Guid ProcessId, VsComponentMessage message)
        {
            switch ((VsPackageMessage)message.MessageCode)
            {
            case VsPackageMessage.WarnAboutPythonSymbols:
                WarnAboutPythonSymbols((string)message.Parameter1);
                return(0);

            case VsPackageMessage.WarnAboutPGO:
                WarnAboutPGO((string)message.Parameter1);
                return(0);

            default:
                return(0);
            }
        }
コード例 #4
0
 public int OnCustomDebugEvent(ref Guid ProcessId, VsComponentMessage message)
 {
     try {
     VsPackageMessage code = (VsPackageMessage)message.MessageCode;
     switch (code) {
       case VsPackageMessage.AttachToChild:
     int parentId = (int)message.Parameter1;
     int childId = (int)message.Parameter2;
     Process proc = Process.GetProcessById(childId);
     if (proc != null)
       DebugAttach.AttachToProcess(new Process[] { proc }, ChildDebuggingMode.AlwaysAttach);
     break;
       case VsPackageMessage.IsChildDebuggingEnabled:
     Guid processGuid = (Guid)message.Parameter1;
     Guid connectionGuid = (Guid)message.Parameter2;
     DkmTransportConnection connection = DkmTransportConnection.FindConnection(connectionGuid);
     if (connection != null) {
       if (IsChildDebuggingEnabledByDefault) {
         DkmCustomMessage response = DkmCustomMessage.Create(
             connection,
             null,
             PackageServices.VsDebuggerMessageGuid,
             (int)VsDebuggerMessage.EnableChildProcessDebugging,
             processGuid,
             null
         );
         response.SendLower();
       } else {
         Logger.Log(
             "Not enabling child process debugging for process {0}.  " +
             "Child debugging is disabled by default.",
             processGuid);
       }
     }
     break;
     }
       } catch (Exception exception) {
     Logger.LogException(
     exception,
     "An error occured while handling a VsPackage message.  HR=0x{0:X}",
     exception.HResult);
       }
       return 0;
 }
コード例 #5
0
        public int OnCustomDebugEvent(ref Guid ProcessId, VsComponentMessage message)
        {
            switch ((VsPackageMessage)message.MessageCode)
            {
            case VsPackageMessage.WarnAboutPythonSymbols:
                WarnAboutPythonSymbols((string)message.Parameter1);
                return(VSConstants.S_OK);

            // TODO: Evaluate if this is still necessary
            //case VsPackageMessage.WarnAboutPGO:
            //    WarnAboutPGO((string)message.Parameter1);
            //    return VSConstants.S_OK;
            case VsPackageMessage.SetDebugOptions:
                SetDebugOptions((IDebugEngine2)message.Parameter1);
                return(VSConstants.S_OK);

            default:
                return(VSConstants.S_OK);
            }
        }
コード例 #6
0
        public int OnCustomDebugEvent(ref Guid ProcessId, VsComponentMessage message)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (message.MessageCode == MessageToVsService.reloadBreakpoints)
            {
                try
                {
                    string path = System.Text.Encoding.UTF8.GetString(message.Parameter1 as byte[]);

                    System.Collections.Generic.List <BreakpointData> reload = new System.Collections.Generic.List <BreakpointData>();

                    foreach (var breakpoint in debugger.Breakpoints)
                    {
                        if (breakpoint is EnvDTE90a.Breakpoint3 breakpoint3)
                        {
                            if (!breakpoint3.Enabled)
                            {
                                continue;
                            }

                            string breakpointPath = breakpoint3.File;

                            if (breakpointPath == path)
                            {
                                reload.Add(new BreakpointData
                                {
                                    source = breakpoint3,

                                    Enabled = breakpoint3.Enabled,

                                    FunctionName   = breakpoint3.FunctionName,
                                    File           = breakpoint3.File,
                                    FileLine       = breakpoint3.FileLine,
                                    FileColumn     = breakpoint3.FileColumn,
                                    Condition      = breakpoint3.Condition,
                                    ConditionType  = breakpoint3.ConditionType,
                                    HitCountTarget = breakpoint3.HitCountTarget,
                                    HitCountType   = breakpoint3.HitCountType,
                                });
                            }
                        }
                    }

                    foreach (var breakpoint in reload)
                    {
                        breakpoint.source.Delete();
                    }

                    foreach (var breakpoint in reload)
                    {
                        debugger.Breakpoints.Add(breakpoint.FunctionName, breakpoint.File, breakpoint.FileLine, breakpoint.FileColumn, breakpoint.Condition, breakpoint.ConditionType, "Lua", "", 1, "", breakpoint.HitCountTarget, breakpoint.HitCountType);

                        if (!breakpoint.Enabled)
                        {
                            debugger.Breakpoints.Item(debugger.Breakpoints.Count - 1).Enabled = false;
                        }
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Failed to reload breakpoints with " + e.Message);
                }
            }
            else if (message.MessageCode == MessageToVsService.scriptLoad)
            {
                try
                {
                    var scriptLoadMessage = new ScriptLoadMessage();

                    scriptLoadMessage.ReadFrom(message.Parameter1 as byte[]);

                    bool found = false;

                    foreach (var x in package.scriptListWindowState.scripts)
                    {
                        if (x.name == scriptLoadMessage.name)
                        {
                            x.path    = scriptLoadMessage.path;
                            x.status  = scriptLoadMessage.status;
                            x.content = scriptLoadMessage.content;
                            found     = true;
                        }
                    }

                    if (!found)
                    {
                        package.scriptListWindowState.scripts.Add(new ScriptEntry
                        {
                            name    = scriptLoadMessage.name,
                            path    = scriptLoadMessage.path,
                            status  = scriptLoadMessage.status,
                            content = scriptLoadMessage.content
                        });
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Failed to add script to the list" + e.Message);
                }
            }

            return(0);
        }
コード例 #7
0
ファイル: AD7Events.cs プロジェクト: rajkumar42/MIEngine
        int IDebugCustomEvent110.GetCustomEventInfo(out Guid guidVSService, VsComponentMessage[] message)
        {
            guidVSService = _guidVSService;
            message[0].SourceId = _sourceId;
            message[0].MessageCode = (uint)_messageCode;
            message[0].Parameter1 = _parameter1;
            message[0].Parameter2 = _parameter2;

            return Constants.S_OK;
        }
コード例 #8
0
ファイル: AD7Events.cs プロジェクト: zhangjinxing/PTVS
 public AD7CustomEvent(VsComponentMessage message)
 {
     _message = message;
 }
コード例 #9
0
ファイル: AD7Events.cs プロジェクト: RussBaz/PTVS
 int IDebugCustomEvent110.GetCustomEventInfo(out Guid guidVSService, VsComponentMessage[] message) {
     guidVSService = Guids.CustomDebuggerEventHandlerGuid;
     message[0] = _message;
     return VSConstants.S_OK;
 }
コード例 #10
0
ファイル: AD7Events.cs プロジェクト: RussBaz/PTVS
 public AD7CustomEvent(VsComponentMessage message) {
     _message = message;
 }
コード例 #11
0
 public int OnCustomDebugEvent(ref Guid ProcessId, VsComponentMessage message)
 {
     OnCustomDebugEventFn?.Invoke(ProcessId, message);
     return(VSConstants.S_OK);
 }
コード例 #12
0
        public int OnCustomDebugEvent(ref Guid ProcessId, VsComponentMessage message)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (message.MessageCode == 1)
            {
                try
                {
                    string path = System.Text.Encoding.UTF8.GetString(message.Parameter1 as byte[]);

                    System.Collections.Generic.List <BreakpointData> reload = new System.Collections.Generic.List <BreakpointData>();

                    foreach (var breakpoint in debugger.Breakpoints)
                    {
                        if (breakpoint is EnvDTE90a.Breakpoint3 breakpoint3)
                        {
                            if (!breakpoint3.Enabled)
                            {
                                continue;
                            }

                            string breakpointPath = breakpoint3.File;

                            if (breakpointPath == path)
                            {
                                reload.Add(new BreakpointData
                                {
                                    source = breakpoint3,

                                    Enabled = breakpoint3.Enabled,

                                    FunctionName   = breakpoint3.FunctionName,
                                    File           = breakpoint3.File,
                                    FileLine       = breakpoint3.FileLine,
                                    FileColumn     = breakpoint3.FileColumn,
                                    Condition      = breakpoint3.Condition,
                                    ConditionType  = breakpoint3.ConditionType,
                                    HitCountTarget = breakpoint3.HitCountTarget,
                                    HitCountType   = breakpoint3.HitCountType,
                                });
                            }
                        }
                    }

                    foreach (var breakpoint in reload)
                    {
                        breakpoint.source.Delete();
                    }

                    foreach (var breakpoint in reload)
                    {
                        debugger.Breakpoints.Add(breakpoint.FunctionName, breakpoint.File, breakpoint.FileLine, breakpoint.FileColumn, breakpoint.Condition, breakpoint.ConditionType, "Lua", "", 1, "", breakpoint.HitCountTarget, breakpoint.HitCountType);

                        if (!breakpoint.Enabled)
                        {
                            debugger.Breakpoints.Item(debugger.Breakpoints.Count - 1).Enabled = false;
                        }
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Failed to reload breakpoints with " + e.Message);
                }
            }

            return(0);
        }