예제 #1
0
        int InsertLines(int offset, int start, int end, out int newStart, out int newEnd)
        {
            StringBuilder       sb    = new StringBuilder();
            StackFrame          ff    = DebuggingService.CurrentFrame;
            List <AssemblyLine> lines = new List <AssemblyLine> (ff.Disassemble(start, end - start + 1));

            int i = lines.FindIndex(al => !al.IsOutOfRange);

            if (i == -1)
            {
                newStart = int.MinValue;
                newEnd   = int.MinValue;
                return(0);
            }

            newStart = i == 0 ? start : int.MinValue;
            lines.RemoveRange(0, i);

            int j = lines.FindLastIndex(al => !al.IsOutOfRange);

            newEnd = j == lines.Count - 1 ? end : int.MinValue;
            lines.RemoveRange(j + 1, lines.Count - j - 1);

            int lineCount  = 0;
            int editorLine = editor.GetTextEditorData().OffsetToLineNumber(offset);

            foreach (AssemblyLine li in lines)
            {
                if (li.IsOutOfRange)
                {
                    continue;
                }
                InsertAssemblerLine(sb, editorLine++, li);
                lineCount++;
            }
            editor.Insert(offset, sb.ToString());
            editor.Document.CommitUpdateAll();
            if (offset == 0)
            {
                this.cachedLines.InsertRange(0, lines);
            }
            else
            {
                this.cachedLines.AddRange(lines);
            }
            return(lineCount);
        }
예제 #2
0
        void InsertLines(int offset, int start, int end)
        {
            StringBuilder sb = new StringBuilder();
            StackFrame    ff = DebuggingService.CurrentFrame;

            AssemblyLine[] lines = ff.Disassemble(start, end - start + 1);
            foreach (AssemblyLine li in lines)
            {
                sb.AppendFormat("0x{0:x}   {1}\n", li.Address, li.Code);
            }
            editor.Insert(offset, sb.ToString());
            editor.Document.CommitUpdateAll();
            if (offset == 0)
            {
                this.lines.InsertRange(0, lines);
            }
            else
            {
                this.lines.AddRange(lines);
            }
        }