コード例 #1
0
        public void Add(Breakpoint bp)
        {
            var ilbp = bp as ILCodeBreakpoint;

            if (ilbp != null)
            {
                textLineObjectManager.Add(ilbp);
                return;
            }

            var debp = bp as DebugEventBreakpoint;

            if (debp != null)
            {
                otherBreakpoints.Add(debp);
                BreakPointAddedRemoved(debp, true);
                return;
            }
        }
コード例 #2
0
        /// <summary>
        /// Should be called each time the IL offset has been updated
        /// </summary>
        bool UpdateStackFrameLines(ITextEditorUIContext uiContext, bool moveCaret = false)
        {
            if (uiContext == null)
            {
                return(false);
            }
            Remove(uiContext);
            bool movedCaret             = false;
            var  cm                     = uiContext.TryGetCodeMappings();
            bool updateReturnStatements = cm != null && theDebugger.ProcessState == DebuggerProcessState.Paused;

            if (updateReturnStatements)
            {
                int  frameNo = -1;
                bool tooManyFrames;
                foreach (var frame in GetFrames(MAX_STACKFRAME_LINES, out tooManyFrames))
                {
                    frameNo++;
                    if (!frame.IsILFrame)
                    {
                        continue;
                    }
                    var ip = frame.ILFrameIP;
                    if (!ip.IsExact && !ip.IsApproximate && !ip.IsProlog && !ip.IsEpilog)
                    {
                        continue;
                    }
                    uint token = frame.Token;
                    if (token == 0)
                    {
                        continue;
                    }
                    var serAsm = frame.SerializedDnModule;
                    if (serAsm == null)
                    {
                        continue;
                    }

                    StackFrameLineType type;
                    if (frameNo == 0)
                    {
                        type = StackFrameLineType.CurrentStatement;
                    }
                    else
                    {
                        type = currentState.FrameNumber == frameNo ? StackFrameLineType.SelectedReturnStatement : StackFrameLineType.ReturnStatement;
                    }
                    var          key    = new SerializedDnToken(serAsm.Value, token);
                    uint         offset = frame.GetILOffset(moduleLoader.Value);
                    MethodDef    methodDef;
                    TextPosition location, endLocation;
                    var          mm = cm.TryGetMapping(key);
                    if (mm != null && mm.GetInstructionByTokenAndOffset(offset, out methodDef, out location, out endLocation))
                    {
                        var rs = new StackFrameLine(type, uiContext, key, offset);
                        stackFrameLines.Add(rs);
                        textLineObjectManager.Add(rs);

                        if (moveCaret && frameNo == currentState.FrameNumber)
                        {
                            uiContext.ScrollAndMoveCaretTo(location.Line, location.Column);
                            movedCaret = true;
                        }
                    }
                }
            }
            return(movedCaret);
        }