当前位置: 首页>>代码示例>>C#>>正文


C# IDebugThread2.GetName方法代码示例

本文整理汇总了C#中IDebugThread2.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# IDebugThread2.GetName方法的具体用法?C# IDebugThread2.GetName怎么用?C# IDebugThread2.GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDebugThread2的用法示例。


在下文中一共展示了IDebugThread2.GetName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Event

        public int Event(IDebugEngine2 pEngine, 
            IDebugProcess2 pProcess, 
            IDebugProgram2 pProgram, 
            IDebugThread2 pThread, 
            IDebugEvent2 pEvent, 
            ref Guid riidEvent, 
            uint dwAttrib)
        {
            try
            {
                string threadName = null;
                if (pThread != null && pEvent != null)
                {
                    uint attributes;

                    pEvent.GetAttributes(out attributes);
                    if ( (uint)enum_EVENTATTRIBUTES.EVENT_SYNC_STOP == attributes)
                    {
                        //HandleException.PrintFrames(pThread);
                    }

                    pThread.GetName(out threadName);
                    //ExtractFrameContent(pThread);
                    //IEnumDebugFrameInfo2 ppEnum = null;
                }
                Trace.WriteLine(string.Format("Event {0} Thread {1}",  riidEvent, threadName ));

                if (typeof(IDebugInterceptExceptionCompleteEvent2).GUID == riidEvent)
                {
                    var interactionEvent = pEvent as IDebugInterceptExceptionCompleteEvent2;
                    ulong cookie;
                    interactionEvent.GetInterceptCookie(out cookie);

                    // another way to get code path:
                    //pProgram.EnumCodePaths(
                    var exceptionInfo = HandleException.PrintFrames(pThread);
                    if (exceptionInfo != null)
                    {
                        if (exceptionInfo.ExceptionKind == null)
                        {
                            exceptionInfo.ExceptionKind = LastExceptionType;
                        }
                        if (exceptionInfo.ExceptionMessage == null)
                        {
                            exceptionInfo.ExceptionMessage = LastExceptionMessage;
                        }
                        SaveToDb(exceptionInfo);
                    }
                }
                //HandleException.ProcessEvent(riidEvent, pThread);

                if (typeof(IDebugProgramCreateEvent2).GUID == riidEvent)
                {
                    // Add handle

                }

                //if (typeof(IDebugBreakEvent2).GUID == riidEvent)
                if(typeof(IDebugBreakpointEvent2).GUID == riidEvent)
                {
                    // Might be interesting to get the statement line number here and emit.
                    //var ev = pEvent as IDebugBreakEvent2;
                    var ev = pEvent as IDebugBreakpointEvent2;
                    var info = HandleException.ProcessEvent(riidEvent, pThread);
                    if (info != null)
                    {
                        SaveToDb(info);
                    }
                }

                if (riidEvent == typeof(IDebugEntryPointEvent2).GUID)
                {
                    // This is when execution is just about to the start.

                    // I can't get the reference to the engine, pEngine is always null, and
                    // there doesn't seem to be an interface to fetch it (there is a query interface in docs, but not in dll!)

                    //string engineStr; Guid engineGuid;
                    //pProgram.GetEngineInfo(out engineStr, out engineGuid);
                    //var superEngine = pEngine as IDebugEngine3;
                    //if (superEngine != null)
                    //{
                    //    superEngine.SetAllExceptions(enum_EXCEPTION_STATE.EXCEPTION_STOP_FIRST_CHANCE);
                    //}
                }
                else if (riidEvent == typeof(IDebugMessageEvent2).GUID)
                {
                    var ev = pEvent as IDebugMessageEvent2;
                    var str = ""; uint type; string helpFile; uint helpId;
                    var suc = ev.GetMessage(new enum_MESSAGETYPE[] { enum_MESSAGETYPE.MT_REASON_EXCEPTION }, out str, out type, out helpFile, out helpId);
                    //uint messageType;
                    //var suc = ev.GetMessage( out messageType, out str, out type, out helpFile, out helpId);
                    if (suc == VSConstants.S_OK)
                    {
                        if (str.StartsWith("A first chance exception of type"))
                        {
                            if (pThread != null)
                            {
                                //ExtractFrameContent(pThread);
                                //HandleException.PrintFrames(pThread);
//.........这里部分代码省略.........
开发者ID:chrisparnin,项目名称:ganji,代码行数:101,代码来源:ExceptionListener.cs


注:本文中的IDebugThread2.GetName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。