List <DbgILSpan> GetUnusedILSpans(List <DbgILSpan> list) { uint codeSize = (uint)GetCodeSize(Method.Body); list = DbgILSpan.OrderAndCompactList(list); var res = new List <DbgILSpan>(); if (list.Count == 0) { if (codeSize > 0) { res.Add(new DbgILSpan(0, codeSize)); } return(res); } uint prevEnd = 0; for (int i = 0; i < list.Count; i++) { var span = list[i]; Debug.Assert(span.Start >= prevEnd); uint length = span.Start - prevEnd; if (length > 0) { res.Add(new DbgILSpan(prevEnd, length)); } prevEnd = span.End; } Debug.Assert(prevEnd <= codeSize); if (prevEnd < codeSize) { res.Add(new DbgILSpan(prevEnd, codeSize - prevEnd)); } return(res); }
/// <summary> /// Gets step ranges /// </summary> /// <param name="sourceILSpans">Source statement spans</param> /// <returns></returns> public DbgILSpan[] GetRanges(DbgILSpan[] sourceILSpans) { var list = new List <DbgILSpan>(sourceILSpans.Length + GetUnusedILSpans().Length + 1); list.AddRange(sourceILSpans); list.AddRange(GetUnusedILSpans()); return(DbgILSpan.OrderAndCompactList(list).ToArray()); }