示例#1
0
        private void VerifyBreakpointAddedRemoved(int ID, DTE2 dte)
        {
            if (dte.Debugger == null)
            {
                return;
            }

            if (dte.Debugger.Breakpoints == null)
            {
                return;
            }

            if (ID == 769)//The event code for breakpoint add
            {
                SessionService.VerifyBreakpointAddedOne(dte.Debugger.Breakpoints.Cast <Breakpoint>().Select(x =>
                                                                                                            new BreakpointModel
                {
                    Name          = x.Name,
                    FunctionName  = x.FunctionName,
                    FileLine      = x.FileLine,
                    StartLineText = x.FileColumn,
                    DocumentModel = DocumentModelBuilder.Build(x.File, x.FileLine, x.FileColumn)
                }
                                                                                                            ).ToList());
            }
            else//The other event code that can represent a removed breakpoint. There is no especific event code for breakpoint remotion.
            {
                SessionService.VerifyBreakpointRemovedOne(dte.Debugger.Breakpoints.Cast <Breakpoint>().Select(x =>
                                                                                                              new BreakpointModel
                {
                    Name          = x.Name,
                    FunctionName  = x.FunctionName,
                    FileLine      = x.FileLine,
                    StartLineText = x.FileColumn,
                    DocumentModel = DocumentModelBuilder.Build(x.File, x.FileLine, x.FileColumn)
                }
                                                                                                              ).ToList());
            }
        }
示例#2
0
        private void VerifyBreakpointAlreadyAdded(DTE2 dte)
        {
            if (dte.Debugger == null)
            {
                return;
            }

            if (dte.Debugger.Breakpoints == null)
            {
                return;
            }

            SessionService.RegisterAlreadyAddedBreakpoints(dte.Debugger.Breakpoints.Cast <Breakpoint>().Select(x =>
                                                                                                               new BreakpointModel
            {
                Name          = x.Name,
                FunctionName  = x.FunctionName,
                FileLine      = x.FileLine,
                StartLineText = x.FileColumn,
                DocumentModel = DocumentModelBuilder.Build(x.File, x.FileLine, x.FileColumn)
            }
                                                                                                               ).ToList());
        }
示例#3
0
        private void DebugEvents_OnEnterBreakMode(dbgEventReason reason, ref dbgExecutionAction action)
        {
            DTE2 dte = (DTE2)GetService(typeof(DTE));

            if (reason == dbgEventReason.dbgEventReasonBreakpoint)//Breakpoint is hitted
            {
                SessionService.RegisterHitted(
                    new StepModel
                {
                    CurrentStackFrameFunctionName = dte.Debugger.CurrentStackFrame.FunctionName,
                    BreakpointLastHitName         = dte.Debugger.BreakpointLastHit.Name,
                    CurrentDocument = DocumentModelBuilder.Build(dte.ActiveDocument)
                }
                    );

                SessionService.RegisterStartPathNode(new PathNodeModel
                {
                    StackTrace = dte.Debugger.CurrentThread.StackFrames.Cast <EnvDTE.StackFrame>().Reverse().Select(x => x.FunctionName).ToList()
                });
            }

            if (reason == dbgEventReason.dbgEventReasonStep)//Any debug step (into, over, out)
            {
                SessionService.RegisterStep(new StepModel
                {
                    CurrentCommandStep            = currentCommandStep,
                    CurrentStackFrameFunctionName = dte.Debugger.CurrentStackFrame.FunctionName,
                    CurrentDocument = DocumentModelBuilder.Build(dte.ActiveDocument)
                });

                SessionService.RegisterPathNode(new PathNodeModel
                {
                    CurrentCommandStep = currentCommandStep,
                    StackTrace         = dte.Debugger.CurrentThread.StackFrames.Cast <EnvDTE.StackFrame>().Reverse().Select(x => x.FunctionName).ToList()
                });
            }
        }