private void EmitDebugInfo(EndianAwareBinaryWriter wr) { // note: Compilation Unit Header != Debugging Information Entry // Compilation Unit Header var compilationUnitSizePosition = wr.Position; wr.Write((uint)7); // length wr.Write((ushort)0x02); // version wr.Write((uint)0); // abbr tag offset. wr.WriteByte(4); //addr size of platform var context = new DwarfWriteContext { Writer = wr, AbbrevList = AbbrevList }; var textSection = Compiler.Linker.Sections[(int)SectionKind.Text]; // Debugging Information Entry var cu = new DwarfCompilationUnit { Producer = "Mosa Compiler", ProgramCounterLow = (uint)textSection.VirtualAddress, ProgramCounterHigh = (uint)textSection.VirtualAddress + textSection.Size }; cu.Emit(context); uint compilationUnitSize = (uint)(wr.Position - compilationUnitSizePosition - sizeof(uint)); wr.Position = compilationUnitSizePosition; wr.Write(compilationUnitSize); wr.Position = wr.BaseStream.Length; }
public override void Emit(DwarfWriteContext ctx) { var abbr = ctx.CreateAbbrev(DwarfTag.DW_TAG_compile_unit, new List <DwarfAbbrevAttribute>() { new DwarfAbbrevAttribute { Attribute = DwarfAttribute.DW_AT_producer, Form = DwarfForm.DW_FORM_string }, new DwarfAbbrevAttribute { Attribute = DwarfAttribute.DW_AT_low_pc, Form = DwarfForm.DW_FORM_addr }, new DwarfAbbrevAttribute { Attribute = DwarfAttribute.DW_AT_high_pc, Form = DwarfForm.DW_FORM_addr }, new DwarfAbbrevAttribute { Attribute = DwarfAttribute.DW_AT_stmt_list, Form = DwarfForm.DW_FORM_data4 }, }); ctx.Writer.WriteULEB128(0x01); //number of tag. ctx.Writer.WriteNullTerminatedString(Producer); ctx.Writer.Write(ProgramCounterLow); // TODO: Dynamic ctx.Writer.Write(ProgramCounterHigh); // TODO: Dynamic ctx.Writer.Write((uint)0); }
public virtual void Emit(DwarfWriteContext ctx) { }