private void AddFunctionSourceLines(Function function, SequencePointCollection points, MetadataReader pdbReader)
        {
            var slines = new List <SourceLine>();

            function.SourceLines = slines;
            foreach (var p in points)
            {
                try
                {
                    var sname        = pdbReader.GetString(pdbReader.GetDocument(p.Document).Name);
                    var plSourceLine = new SourceLine
                    {
                        InternalId      = SourceLine.UndefinedSourceLineId,
                        SourceFileIntId = GetSourceFileId(sname),
                        FunctionIntId   = function.InternalId,
                        StartLine       = (ulong)p.StartLine,
                        StartColumn     = (ulong)p.StartColumn,
                        EndLine         = (ulong)p.EndLine,
                        EndColumn       = (ulong)p.EndColumn,
                        Offset          = (uint)p.Offset,
                        Name            = sname
                    };
                    slines.Add(plSourceLine);
                }
                catch (Exception)
                {
                    // Debug.WriteLine(ex.Message);
                }
            }
        }
Beispiel #2
0
        private void SourceLineReadCallback(Parser.Model.SourceLine arg)
        {
            SourceLine sourceLine = GetSourceLine(arg.Id);

            if (sourceLine == null)
            {
                AddSourceLine(new SourceLine
                {
                    InternalId      = arg.Id,
                    FunctionIntId   = arg.FunctionIntId,
                    SourceFileIntId = arg.SourceFileIntId,
                    StartLine       = arg.StartLine,
                    StartColumn     = arg.StartColumn,
                    EndLine         = arg.EndLine,
                    EndColumn       = arg.EndColumn,
                    FunctionName    = Functions[arg.FunctionIntId].Name
                });
            }
            else
            {
                sourceLine.FunctionIntId   = arg.FunctionIntId;
                sourceLine.SourceFileIntId = arg.SourceFileIntId;
                sourceLine.StartLine       = arg.StartLine;
                sourceLine.StartColumn     = arg.StartColumn;
                sourceLine.EndLine         = arg.EndLine;
                sourceLine.EndColumn       = arg.EndColumn;
            }
        }
 private void WriteSourceLineAdded(SourceLine sourceLine)
 {
     Output.WriteLine("lin src 0x{0:X8} 0x{1:X8} 0x{2:X8} {3} {4} {5} {6}",
                      sourceLine.InternalId,
                      sourceLine.SourceFileIntId,
                      sourceLine.FunctionIntId,
                      sourceLine.StartLine,
                      sourceLine.StartColumn,
                      sourceLine.EndLine,
                      sourceLine.EndColumn);
 }
        internal ulong FindSourceLineForOffset(List <SourceLine> plSourceLines, uint offset)
        {
            SourceLine best = null;

            foreach (var sl in plSourceLines)
            {
                if (sl.Offset <= offset)
                {
                    best = sl;
                }
            }

            return((best == null) ? 0 : CheckId(best));
        }
        private ulong CheckId(SourceLine line)
        {
            if (line.StartLine == SequencePoint.HiddenLine)
            {
                return(0);
            }

            if (line.InternalId == SourceLine.UndefinedSourceLineId)
            {
                line.InternalId = _nextSourceLineId++;
                WriteSourceLineAdded(line);
            }

            return(line.InternalId);
        }
Beispiel #6
0
 private void AddSourceLine(SourceLine sourceLine)
 {
     AddToDictionary(SourceLines, sourceLine);
 }