/// <exception cref="InvalidOperationException">Too late to add abbreviations, or too many abbreviations.</exception> public void AddAbbreviation(string str) { if (Frozen) { throw new InvalidOperationException("Too late to add abbreviations"); } if (abbrevs.Count >= 96) { throw new InvalidOperationException("Too many abbreviations"); } var entry = new AbbrevEntry(str, (byte)abbrevs.Count); var idx = abbrevs.BinarySearch(entry, abbrevLengthComparer); abbrevs.Insert(idx < 0 ? ~idx : idx, entry); }
protected override Die CreateDie(DwarfBinaryReader reader, CompilationUnit comp_unit, long offset, AbbrevEntry abbrev) { switch (abbrev.Tag) { case DwarfTag.formal_parameter: return new DieFormalParameter (this, reader, comp_unit, abbrev); case DwarfTag.variable: return new DieVariable (this, reader, comp_unit, abbrev); case DwarfTag.lexical_block: return new DieLexicalBlock (this, reader, comp_unit, abbrev); default: return base.CreateDie (reader, comp_unit, offset, abbrev); } }
public DieSubprogram(DwarfBinaryReader reader, CompilationUnit comp_unit, long offset, AbbrevEntry abbrev) : base(reader, comp_unit, abbrev) { this.real_offset = offset; if ((start_pc != 0) && (end_pc != 0)) is_continuous = true; comp_unit.AddSubprogram (offset, this); }
protected override Die CreateDie(DwarfBinaryReader reader, CompilationUnit comp_unit, long offset, AbbrevEntry abbrev) { switch (abbrev.Tag) { case DwarfTag.inheritance: return new DieInheritance (reader, comp_unit, abbrev); default: return base.CreateDie (reader, comp_unit, offset, abbrev); } }
protected Die(DwarfBinaryReader reader, CompilationUnit comp_unit, AbbrevEntry abbrev) { this.comp_unit = comp_unit; this.dwarf = comp_unit.DwarfReader; this.abbrev = abbrev; Offset = reader.Position; ChildrenOffset = Offset + ReadAttributes (reader); reader.Position = ChildrenOffset; debug ("NEW DIE: {0} {1} {2} {3}", GetType (), abbrev, Offset, ChildrenOffset); }
public DieVariableBase(DwarfBinaryReader reader, CompilationUnit comp_unit, AbbrevEntry abbrev) : base(reader, comp_unit, abbrev) { }
public DieVariable(DieSubprogram parent, DwarfBinaryReader reader, CompilationUnit comp_unit, AbbrevEntry abbrev) : base(parent, reader, comp_unit, abbrev, null, true) { }
public DieType(DwarfBinaryReader reader, CompilationUnit comp_unit, long offset, AbbrevEntry abbrev) : base(reader, comp_unit, abbrev) { this.offset = offset; this.language = reader.Bfd.NativeLanguage; comp_unit.AddType (offset, this); if (specification != null) { if ((name == null) && (specification.name != null)) name = specification.Name; } if (name != null) { if (comp_unit.CurrentNamespace != null) name = comp_unit.CurrentNamespace + "::" + name; comp_unit.DwarfReader.AddType (this); } }
protected override Die CreateDie(DwarfBinaryReader reader, CompilationUnit comp_unit, long offset, AbbrevEntry abbrev) { switch (abbrev.Tag) { case DwarfTag.formal_parameter: return new DieFormalParameter (subprog, reader, comp_unit, abbrev); case DwarfTag.variable: return new DieVariable (subprog, reader, comp_unit, abbrev, this); case DwarfTag.lexical_block: return new DieLexicalBlock (subprog, reader, comp_unit, abbrev); default: debug ("LEXICAL BLOCK ({0}): unknown die: {1}", Offset, abbrev.Tag); return base.CreateDie (reader, comp_unit, offset, abbrev); } }
public DieLexicalBlock(DieSubprogram subprog, DwarfBinaryReader reader, CompilationUnit comp_unit, AbbrevEntry abbrev) : base(reader, comp_unit, abbrev) { this.subprog = subprog; }
public DieInheritance(DwarfBinaryReader reader, CompilationUnit comp_unit, AbbrevEntry abbrev) : base(reader, comp_unit, abbrev) { }
public DieFormalParameter(DieSubprogram parent, DwarfBinaryReader reader, CompilationUnit comp_unit, AbbrevEntry abbrev) : base(parent, reader, comp_unit, abbrev, null, false) { }
public DieEnumerator(DwarfBinaryReader reader, CompilationUnit comp_unit, AbbrevEntry abbrev) : base(reader, comp_unit, abbrev) { }
public DieCompileUnit(DwarfBinaryReader reader, CompilationUnit comp_unit, AbbrevEntry abbrev) : base(reader, comp_unit, abbrev) { if ((start_pc != null) && (end_pc != null)) is_continuous = true; string file_name; if (comp_dir != null) file_name = String.Concat ( comp_dir, Path.DirectorySeparatorChar, name); else file_name = name; file = dwarf.GetSourceFile (file_name); }
protected virtual Die CreateDie(DwarfBinaryReader reader, CompilationUnit comp_unit, long offset, AbbrevEntry abbrev) { switch (abbrev.Tag) { case DwarfTag.compile_unit: throw new InternalError (); case DwarfTag.subprogram: return new DieSubprogram (reader, comp_unit, offset, abbrev); case DwarfTag.base_type: return new DieBaseType (reader, comp_unit, offset, abbrev); case DwarfTag.const_type: return new DieConstType (reader, comp_unit, offset, abbrev); case DwarfTag.pointer_type: return new DiePointerType (reader, comp_unit, offset, abbrev); case DwarfTag.class_type: // for now just treat classes and structs the same. case DwarfTag.structure_type: return new DieStructureType (reader, comp_unit, offset, abbrev, false); case DwarfTag.union_type: return new DieStructureType (reader, comp_unit, offset, abbrev, true); case DwarfTag.array_type: return new DieArrayType (reader, comp_unit, offset, abbrev); case DwarfTag.subrange_type: return new DieSubrangeType (reader, comp_unit, abbrev); case DwarfTag.enumeration_type: return new DieEnumerationType (reader, comp_unit, offset, abbrev); case DwarfTag.enumerator: return new DieEnumerator (reader, comp_unit, abbrev); case DwarfTag.typedef: return new DieTypedef (reader, comp_unit, offset, abbrev); case DwarfTag.subroutine_type: return new DieSubroutineType (reader, comp_unit, offset, abbrev); case DwarfTag.member: return new DieMember (reader, comp_unit, abbrev); case DwarfTag.inlined_subroutine: debug ("INLINED SUBROUTINE!"); return new DieSubprogram (reader, comp_unit, offset, abbrev); case DwarfTag.dwarf3_namespace: return new DieNamespace (reader, comp_unit, offset, abbrev); default: return new Die (reader, comp_unit, abbrev); } }
public DieSubrangeType(DwarfBinaryReader reader, CompilationUnit comp_unit, AbbrevEntry abbrev) : base(reader, comp_unit, abbrev) { }
protected override Die CreateDie(DwarfBinaryReader reader, CompilationUnit comp_unit, long offset, AbbrevEntry abbrev) { switch (abbrev.Tag) { case DwarfTag.formal_parameter: return new DieFormalParameter (null, reader, comp_unit, abbrev); default: return base.CreateDie (reader, comp_unit, offset, abbrev); } }
public DieMember(DwarfBinaryReader reader, CompilationUnit comp_unit, AbbrevEntry abbrev) : base(reader, comp_unit, abbrev) { this.target_info = reader.TargetMemoryInfo; }
public DieTypedef(DwarfBinaryReader reader, CompilationUnit comp_unit, long offset, AbbrevEntry abbrev) : base(reader, comp_unit, offset, abbrev) { }
public DieMethodVariable(DieSubprogram subprog, DwarfBinaryReader reader, CompilationUnit comp_unit, AbbrevEntry abbrev, DieLexicalBlock lexical_block, bool is_local) : base(reader, comp_unit, abbrev) { this.subprog = subprog; this.lexical_block = lexical_block; if (subprog != null) { if (is_local) subprog.AddLocal (this); else subprog.AddParameter (this); } }
public DieVariable(DieSubprogram parent, DwarfBinaryReader reader, CompilationUnit comp_unit, AbbrevEntry abbrev, DieLexicalBlock lexical) : base(parent, reader, comp_unit, abbrev, lexical, true) { }
public DieNamespace(DwarfBinaryReader reader, CompilationUnit comp_unit, long offset, AbbrevEntry abbrev) : base(reader, comp_unit, abbrev) { this.offset = offset; comp_unit.AddNamespace (offset, this); if (extension != null) { if (extension.name != null) { if (name != null) name = extension.name + "::" + name; else name = extension.name; } } }
public DieStructureType(DwarfBinaryReader reader, CompilationUnit comp_unit, long offset, AbbrevEntry abbrev, bool is_union) : base(reader, comp_unit, offset, abbrev) { this.IsUnion = is_union; }
public CompilationUnit(DwarfReader dwarf, DwarfBinaryReader reader) { this.dwarf = dwarf; real_start_offset = reader.Position; unit_length = reader.ReadInitialLength (); start_offset = reader.Position; version = reader.ReadInt16 (); abbrev_offset = reader.ReadOffset (); address_size = reader.ReadByte (); if (version < 2) throw new DwarfException ( dwarf.bfd, "Wrong DWARF version: {0}", version); abbrevs = new Hashtable (); types = new Hashtable (); subprogs = new Hashtable (); namespaces = new Dictionary<long,DieNamespace> (); DwarfBinaryReader abbrev_reader = dwarf.DebugAbbrevReader; abbrev_reader.Position = abbrev_offset; while (abbrev_reader.PeekByte () != 0) { AbbrevEntry entry = new AbbrevEntry (dwarf, abbrev_reader); abbrevs.Add (entry.ID, entry); } comp_unit_die = Die.CreateDieCompileUnit (reader, this); reader.Position = start_offset + unit_length; }