示例#1
0
        internal void WriteData(MyBinaryWriter bw)
        {
            DataOffset = (int)bw.BaseStream.Position;
            bw.WriteLeb128(source.Index);

            int count_includes = include_files != null ? include_files.Count : 0;

            bw.WriteLeb128(count_includes);
            if (include_files != null)
            {
                foreach (SourceFileEntry entry in include_files)
                {
                    bw.WriteLeb128(entry.Index);
                }
            }

            bw.WriteLeb128(namespaces.Count);
            foreach (NamespaceEntry ns in namespaces)
            {
                ns.Write(file, bw);
            }
        }
示例#2
0
        internal void Write(MonoSymbolFile file, MyBinaryWriter bw, bool hasColumnsInfo, bool hasEndInfo)
        {
            int start = (int)bw.BaseStream.Position;

            bool last_is_hidden = false;
            int  last_line = 1, last_offset = 0, last_file = 1;

            for (int i = 0; i < LineNumbers.Length; i++)
            {
                int line_inc   = LineNumbers [i].Row - last_line;
                int offset_inc = LineNumbers [i].Offset - last_offset;

                if (LineNumbers [i].File != last_file)
                {
                    bw.Write(DW_LNS_set_file);
                    bw.WriteLeb128(LineNumbers [i].File);
                    last_file = LineNumbers [i].File;
                }

                if (LineNumbers [i].IsHidden != last_is_hidden)
                {
                    bw.Write((byte)0);
                    bw.Write((byte)1);
                    bw.Write(DW_LNE_MONO_negate_is_hidden);
                    last_is_hidden = LineNumbers [i].IsHidden;
                }

                if (offset_inc >= MaxAddressIncrement)
                {
                    if (offset_inc < 2 * MaxAddressIncrement)
                    {
                        bw.Write(DW_LNS_const_add_pc);
                        offset_inc -= MaxAddressIncrement;
                    }
                    else
                    {
                        bw.Write(DW_LNS_advance_pc);
                        bw.WriteLeb128(offset_inc);
                        offset_inc = 0;
                    }
                }

                if ((line_inc < LineBase) || (line_inc >= LineBase + LineRange))
                {
                    bw.Write(DW_LNS_advance_line);
                    bw.WriteLeb128(line_inc);
                    if (offset_inc != 0)
                    {
                        bw.Write(DW_LNS_advance_pc);
                        bw.WriteLeb128(offset_inc);
                    }
                    bw.Write(DW_LNS_copy);
                }
                else
                {
                    byte opcode;
                    opcode = (byte)(line_inc - LineBase + (LineRange * offset_inc) +
                                    OpcodeBase);
                    bw.Write(opcode);
                }

                last_line   = LineNumbers [i].Row;
                last_offset = LineNumbers [i].Offset;
            }

            bw.Write((byte)0);
            bw.Write((byte)1);
            bw.Write(DW_LNE_end_sequence);

            if (hasColumnsInfo)
            {
                for (int i = 0; i < LineNumbers.Length; i++)
                {
                    var ln = LineNumbers [i];
                    if (ln.Row >= 0)
                    {
                        bw.WriteLeb128(ln.Column);
                    }
                }
            }

            if (hasEndInfo)
            {
                for (int i = 0; i < LineNumbers.Length; i++)
                {
                    var ln = LineNumbers [i];
                    if (ln.EndRow == -1 || ln.EndColumn == -1 || ln.Row > ln.EndRow)
                    {
                        bw.WriteLeb128(0xffffff);
                    }
                    else
                    {
                        bw.WriteLeb128(ln.EndRow - ln.Row);
                        bw.WriteLeb128(ln.EndColumn);
                    }
                }
            }

            file.ExtendedLineNumberSize += (int)bw.BaseStream.Position - start;
        }
示例#3
0
 internal void Write(MyBinaryWriter bw)
 {
     bw.WriteLeb128(Scope);
     bw.WriteLeb128(Index);
 }
示例#4
0
 internal void Write(MyBinaryWriter bw)
 {
     bw.WriteLeb128(Scope);
     bw.Write(CapturedName);
 }
示例#5
0
 internal void Write(MonoSymbolFile file, MyBinaryWriter bw)
 {
     bw.WriteLeb128(Index);
     bw.Write(Name);
     bw.WriteLeb128(BlockIndex);
 }
示例#6
0
        internal void WriteData(MonoSymbolFile file, MyBinaryWriter bw)
        {
            if (index <= 0)
            {
                throw new InvalidOperationException();
            }

            LocalVariableTableOffset = (int)bw.BaseStream.Position;
            int num_locals = locals != null ? locals.Length : 0;

            bw.WriteLeb128(num_locals);
            for (int i = 0; i < num_locals; i++)
            {
                locals [i].Write(file, bw);
            }
            file.LocalCount += num_locals;

            CodeBlockTableOffset = (int)bw.BaseStream.Position;
            int num_code_blocks = code_blocks != null ? code_blocks.Length : 0;

            bw.WriteLeb128(num_code_blocks);
            for (int i = 0; i < num_code_blocks; i++)
            {
                code_blocks [i].Write(bw);
            }

            ScopeVariableTableOffset = (int)bw.BaseStream.Position;
            int num_scope_vars = scope_vars != null ? scope_vars.Length : 0;

            bw.WriteLeb128(num_scope_vars);
            for (int i = 0; i < num_scope_vars; i++)
            {
                scope_vars [i].Write(bw);
            }

            if (real_name != null)
            {
                RealNameOffset = (int)bw.BaseStream.Position;
                bw.Write(real_name);
            }

            foreach (var lne in lnt.LineNumbers)
            {
                if (lne.EndRow != -1 || lne.EndColumn != -1)
                {
                    flags |= Flags.EndInfoIncluded;
                }
            }

            LineNumberTableOffset = (int)bw.BaseStream.Position;
            lnt.Write(file, bw, (flags & Flags.ColumnsInfoIncluded) != 0, (flags & Flags.EndInfoIncluded) != 0);

            DataOffset = (int)bw.BaseStream.Position;

            bw.WriteLeb128(CompileUnitIndex);
            bw.WriteLeb128(LocalVariableTableOffset);
            bw.WriteLeb128(NamespaceID);

            bw.WriteLeb128(CodeBlockTableOffset);
            bw.WriteLeb128(ScopeVariableTableOffset);

            bw.WriteLeb128(RealNameOffset);
            bw.WriteLeb128((int)flags);
        }