internal static LineNumberTable Read(MonoSymbolFile file, MyBinaryReader br, bool readColumnsInfo, bool readEndInfo) { LineNumberTable lnt = new LineNumberTable(file); lnt.DoRead(file, br, readColumnsInfo, readEndInfo); return(lnt); }
//internal void Write(MyBinaryWriter bw) //{ // if (this.index <= 0 || this.DataOffset == 0) // { // throw new InvalidOperationException(); // } // bw.Write(this.Token); // bw.Write(this.DataOffset); // bw.Write(this.LineNumberTableOffset); //} //internal void WriteData(MonoSymbolFile file, MyBinaryWriter bw) //{ // if (this.index <= 0) // { // throw new InvalidOperationException(); // } // this.LocalVariableTableOffset = (int)bw.BaseStream.Position; // int num_locals = (this.locals != null) ? this.locals.Length : 0; // bw.WriteLeb128(num_locals); // for (int i = 0; i < num_locals; i++) // { // this.locals[i].Write(file, bw); // } // file.LocalCount += num_locals; // this.CodeBlockTableOffset = (int)bw.BaseStream.Position; // int num_code_blocks = (this.code_blocks != null) ? this.code_blocks.Length : 0; // bw.WriteLeb128(num_code_blocks); // for (int i = 0; i < num_code_blocks; i++) // { // this.code_blocks[i].Write(bw); // } // this.ScopeVariableTableOffset = (int)bw.BaseStream.Position; // int num_scope_vars = (this.scope_vars != null) ? this.scope_vars.Length : 0; // bw.WriteLeb128(num_scope_vars); // for (int i = 0; i < num_scope_vars; i++) // { // this.scope_vars[i].Write(bw); // } // if (this.real_name != null) // { // this.RealNameOffset = (int)bw.BaseStream.Position; // bw.Write(this.real_name); // } // this.LineNumberTableOffset = (int)bw.BaseStream.Position; // this.lnt.Write(file, bw); // this.DataOffset = (int)bw.BaseStream.Position; // bw.WriteLeb128(this.CompileUnitIndex); // bw.WriteLeb128(this.LocalVariableTableOffset); // bw.WriteLeb128(this.NamespaceID); // bw.WriteLeb128(this.CodeBlockTableOffset); // bw.WriteLeb128(this.ScopeVariableTableOffset); // bw.WriteLeb128(this.RealNameOffset); // bw.WriteLeb128((int)this.flags); //} public LineNumberTable GetLineNumberTable() { LineNumberTable result; lock (this.SymbolFile) { if (this.lnt != null) { result = this.lnt; } else { if (this.LineNumberTableOffset == 0) { result = null; } else { MyBinaryReader reader = this.SymbolFile.BinaryReader; long old_pos = reader.BaseStream.Position; reader.BaseStream.Position = (long)this.LineNumberTableOffset; this.lnt = LineNumberTable.Read(this.SymbolFile, reader); reader.BaseStream.Position = old_pos; result = this.lnt; } } } return(result); }
internal static LineNumberTable Read(MonoSymbolFile file, MyBinaryReader br) { LineNumberTable lnt = new LineNumberTable(file); lnt.DoRead(file, br); return(lnt); }
internal MethodEntry(MonoSymbolFile file, CompileUnitEntry comp_unit, int token, ScopeVariable[] scope_vars, LocalVariableEntry[] locals, LineNumberEntry[] lines, CodeBlockEntry[] code_blocks, string real_name, MethodEntry.Flags flags, int namespace_id) { this.SymbolFile = file; this.real_name = real_name; this.locals = locals; this.code_blocks = code_blocks; this.scope_vars = scope_vars; this.flags = flags; this.index = -1; this.Token = token; this.CompileUnitIndex = comp_unit.Index; this.CompileUnit = comp_unit; this.NamespaceID = namespace_id; this.CheckLineNumberTable(lines); this.lnt = new LineNumberTable(file, lines); file.NumLineNumbers += lines.Length; int num_locals = (locals != null) ? locals.Length : 0; if (num_locals <= 32) { for (int i = 0; i < num_locals; i++) { string nm = locals[i].Name; for (int j = i + 1; j < num_locals; j++) { if (locals[j].Name == nm) { flags |= MethodEntry.Flags.LocalNamesAmbiguous; goto IL_108; } } } IL_108 :; } else { Dictionary <string, LocalVariableEntry> local_names = new Dictionary <string, LocalVariableEntry>(); for (int k = 0; k < locals.Length; k++) { LocalVariableEntry local = locals[k]; if (local_names.ContainsKey(local.Name)) { flags |= MethodEntry.Flags.LocalNamesAmbiguous; break; } local_names.Add(local.Name, local); } } }
internal MethodEntry(MonoSymbolFile file, CompileUnitEntry comp_unit, int token, ScopeVariable[] scope_vars, LocalVariableEntry[] locals, LineNumberEntry[] lines, CodeBlockEntry[] code_blocks, string real_name, MethodEntry.Flags flags, int namespace_id) { this.SymbolFile = file; this.real_name = real_name; this.locals = locals; this.code_blocks = code_blocks; this.scope_vars = scope_vars; this.flags = flags; this.index = -1; this.Token = token; this.CompileUnitIndex = comp_unit.Index; this.CompileUnit = comp_unit; this.NamespaceID = namespace_id; this.CheckLineNumberTable(lines); this.lnt = new LineNumberTable(file, lines); file.NumLineNumbers += lines.Length; int num_locals = (locals != null) ? locals.Length : 0; if (num_locals <= 32) { for (int i = 0; i < num_locals; i++) { string nm = locals[i].Name; for (int j = i + 1; j < num_locals; j++) { if (locals[j].Name == nm) { flags |= MethodEntry.Flags.LocalNamesAmbiguous; goto IL_108; } } } IL_108:; } else { Dictionary<string, LocalVariableEntry> local_names = new Dictionary<string, LocalVariableEntry>(); for (int k = 0; k < locals.Length; k++) { LocalVariableEntry local = locals[k]; if (local_names.ContainsKey(local.Name)) { flags |= MethodEntry.Flags.LocalNamesAmbiguous; break; } local_names.Add(local.Name, local); } } }
public LineNumberTable GetLineNumberTable() { lock (SymbolFile) { if (lnt != null) { return(lnt); } if (LineNumberTableOffset == 0) { return(null); } MyBinaryReader reader = SymbolFile.BinaryReader; long old_pos = reader.BaseStream.Position; reader.BaseStream.Position = LineNumberTableOffset; lnt = LineNumberTable.Read(SymbolFile, reader, (flags & Flags.ColumnsInfoIncluded) != 0, (flags & Flags.EndInfoIncluded) != 0); reader.BaseStream.Position = old_pos; return(lnt); } }
public LineNumberTable GetLineNumberTable() { lock (SymbolFile) { if (lnt != null) { return(lnt); } if (LineNumberTableOffset == 0) { return(null); } MyBinaryReader reader = SymbolFile.BinaryReader; long old_pos = reader.BaseStream.Position; reader.BaseStream.Position = LineNumberTableOffset; lnt = LineNumberTable.Read(SymbolFile, reader); reader.BaseStream.Position = old_pos; return(lnt); } }
internal MethodEntry(MonoSymbolFile file, CompileUnitEntry comp_unit, int token, ScopeVariable[] scope_vars, LocalVariableEntry[] locals, LineNumberEntry[] lines, CodeBlockEntry[] code_blocks, string real_name, Flags flags, int namespace_id) { this.SymbolFile = file; this.real_name = real_name; this.locals = locals; this.code_blocks = code_blocks; this.scope_vars = scope_vars; this.flags = flags; index = -1; Token = token; CompileUnitIndex = comp_unit.Index; CompileUnit = comp_unit; NamespaceID = namespace_id; CheckLineNumberTable(lines); lnt = new LineNumberTable(file, lines); file.NumLineNumbers += lines.Length; int num_locals = locals != null ? locals.Length : 0; if (num_locals <= 32) { // Most of the time, the O(n^2) factor is actually // less than the cost of allocating the hash table, // 32 is a rough number obtained through some testing. for (int i = 0; i < num_locals; i++) { string nm = locals [i].Name; for (int j = i + 1; j < num_locals; j++) { if (locals [j].Name == nm) { flags |= Flags.LocalNamesAmbiguous; goto locals_check_done; } } } locals_check_done: ; } else { var local_names = new Dictionary <string, LocalVariableEntry> (); foreach (LocalVariableEntry local in locals) { if (local_names.ContainsKey(local.Name)) { flags |= Flags.LocalNamesAmbiguous; break; } local_names.Add(local.Name, local); } } }
internal static LineNumberTable Read (MonoSymbolFile file, MyBinaryReader br) { LineNumberTable lnt = new LineNumberTable (file); lnt.DoRead (file, br); return lnt; }
public LineNumberTable GetLineNumberTable () { lock (SymbolFile) { if (lnt != null) return lnt; if (LineNumberTableOffset == 0) return null; MyBinaryReader reader = SymbolFile.BinaryReader; long old_pos = reader.BaseStream.Position; reader.BaseStream.Position = LineNumberTableOffset; lnt = LineNumberTable.Read (SymbolFile, reader); reader.BaseStream.Position = old_pos; return lnt; } }
internal MethodEntry (MonoSymbolFile file, CompileUnitEntry comp_unit, int token, ScopeVariable[] scope_vars, LocalVariableEntry[] locals, LineNumberEntry[] lines, CodeBlockEntry[] code_blocks, string real_name, Flags flags, int namespace_id) { this.SymbolFile = file; this.real_name = real_name; this.locals = locals; this.code_blocks = code_blocks; this.scope_vars = scope_vars; this.flags = flags; index = -1; Token = token; CompileUnitIndex = comp_unit.Index; CompileUnit = comp_unit; NamespaceID = namespace_id; CheckLineNumberTable (lines); lnt = new LineNumberTable (file, lines); file.NumLineNumbers += lines.Length; int num_locals = locals != null ? locals.Length : 0; if (num_locals <= 32) { // Most of the time, the O(n^2) factor is actually // less than the cost of allocating the hash table, // 32 is a rough number obtained through some testing. for (int i = 0; i < num_locals; i ++) { string nm = locals [i].Name; for (int j = i + 1; j < num_locals; j ++) { if (locals [j].Name == nm) { flags |= Flags.LocalNamesAmbiguous; goto locals_check_done; } } } locals_check_done : ; } else { Hashtable local_names = new Hashtable (); foreach (LocalVariableEntry local in locals) { if (local_names.Contains (local.Name)) { flags |= Flags.LocalNamesAmbiguous; break; } local_names.Add (local.Name, local); } } }
//internal void Write(MyBinaryWriter bw) //{ // if (this.index <= 0 || this.DataOffset == 0) // { // throw new InvalidOperationException(); // } // bw.Write(this.Token); // bw.Write(this.DataOffset); // bw.Write(this.LineNumberTableOffset); //} //internal void WriteData(MonoSymbolFile file, MyBinaryWriter bw) //{ // if (this.index <= 0) // { // throw new InvalidOperationException(); // } // this.LocalVariableTableOffset = (int)bw.BaseStream.Position; // int num_locals = (this.locals != null) ? this.locals.Length : 0; // bw.WriteLeb128(num_locals); // for (int i = 0; i < num_locals; i++) // { // this.locals[i].Write(file, bw); // } // file.LocalCount += num_locals; // this.CodeBlockTableOffset = (int)bw.BaseStream.Position; // int num_code_blocks = (this.code_blocks != null) ? this.code_blocks.Length : 0; // bw.WriteLeb128(num_code_blocks); // for (int i = 0; i < num_code_blocks; i++) // { // this.code_blocks[i].Write(bw); // } // this.ScopeVariableTableOffset = (int)bw.BaseStream.Position; // int num_scope_vars = (this.scope_vars != null) ? this.scope_vars.Length : 0; // bw.WriteLeb128(num_scope_vars); // for (int i = 0; i < num_scope_vars; i++) // { // this.scope_vars[i].Write(bw); // } // if (this.real_name != null) // { // this.RealNameOffset = (int)bw.BaseStream.Position; // bw.Write(this.real_name); // } // this.LineNumberTableOffset = (int)bw.BaseStream.Position; // this.lnt.Write(file, bw); // this.DataOffset = (int)bw.BaseStream.Position; // bw.WriteLeb128(this.CompileUnitIndex); // bw.WriteLeb128(this.LocalVariableTableOffset); // bw.WriteLeb128(this.NamespaceID); // bw.WriteLeb128(this.CodeBlockTableOffset); // bw.WriteLeb128(this.ScopeVariableTableOffset); // bw.WriteLeb128(this.RealNameOffset); // bw.WriteLeb128((int)this.flags); //} public LineNumberTable GetLineNumberTable() { LineNumberTable result; lock (this.SymbolFile) { if (this.lnt != null) { result = this.lnt; } else { if (this.LineNumberTableOffset == 0) { result = null; } else { MyBinaryReader reader = this.SymbolFile.BinaryReader; long old_pos = reader.BaseStream.Position; reader.BaseStream.Position = (long)this.LineNumberTableOffset; this.lnt = LineNumberTable.Read(this.SymbolFile, reader); reader.BaseStream.Position = old_pos; result = this.lnt; } } } return result; }