public void WriteClass([NotNull] string name, LineRef start, LineRef end) { WriteDebugByte(DEBF.CLASS_DBR); WriteDebugString(name); WriteDebugLineRef(start); WriteDebugLineRef(end); }
public void EndRoutine(LineRef end, int address) { // close <routine> xml.WriteEndElement(); inRoutine = false; }
void WriteDebugLineRef(LineRef lineRef) { stream.WriteByte(lineRef.File); stream.WriteByte((byte)(lineRef.Line >> 8)); stream.WriteByte((byte)lineRef.Line); stream.WriteByte(lineRef.Col); }
public void WriteObject(ushort number, [NotNull] string name, LineRef start, LineRef end) { WriteDebugByte(DEBF.OBJECT_DBR); WriteDebugWord(number); WriteDebugString(name); WriteDebugLineRef(start); WriteDebugLineRef(end); }
public void WriteLine(LineRef loc, int address) { xml.WriteStartElement("sequence-point"); xml.WriteElementString("address", address.ToString()); WriteSourceCodeLocation(loc, loc); xml.WriteEndElement(); }
/// <exception cref="InvalidOperationException">The writer is not currently in a routine.</exception> public void WriteLine(LineRef loc, int address) { if (!InRoutine) { throw new InvalidOperationException("WriteLine must be called inside a routine"); } WriteDebugLineRef(loc); WriteDebugWord((ushort)(address - routineStart)); routinePoints++; }
public void WriteObject(ushort number, string name, LineRef start, LineRef end) { xml.WriteStartElement("object"); xml.WriteElementString("identifier", name); xml.WriteElementString("value", number.ToString()); WriteSourceCodeLocation(start, end); xml.WriteEndElement(); }
public void WriteClass(string name, LineRef start, LineRef end) { xml.WriteStartElement("object"); xml.WriteElementString("identifier", name); // TODO: <value> WriteSourceCodeLocation(start, end); xml.WriteEndElement(); }
public void EndRoutine(LineRef end, int address) { // finish LINEREF_DBR block var curPosition = stream.Position; stream.Position -= 2 + routinePoints * 6; WriteDebugWord((ushort)routinePoints); stream.Position = curPosition; routinePoints = -1; routineStart = -1; // write ROUTINE_END_DBR block WriteDebugByte(DEBF.ROUTINE_END_DBR); WriteDebugWord(nextRoutineNumber++); WriteDebugLineRef(end); WriteDebugAddress(address); rollbackPosition = -1; }
void WriteSourceCodeLocation(LineRef start, LineRef end) { xml.WriteStartElement("source-code-location"); xml.WriteElementString("file-index", start.File.ToString()); xml.WriteElementString("line", start.Line.ToString()); xml.WriteElementString("character", start.Col.ToString()); // TODO: <file-position> if (end != start) { // TODO: handle end.File != start.File xml.WriteElementString("end-line", end.Line.ToString()); xml.WriteElementString("end-character", end.Col.ToString()); // TODO: <end-file-position> } xml.WriteEndElement(); }
public void StartRoutine(LineRef start, int address, [NotNull] string name, [NotNull] IEnumerable <string> locals) { WriteDebugByte(DEBF.ROUTINE_DBR); WriteDebugWord(nextRoutineNumber); WriteDebugLineRef(start); WriteDebugAddress(address); WriteDebugString(name); foreach (var local in locals) { WriteDebugString(local); } WriteDebugByte(0); // start LINEREF_DBR block WriteDebugByte(DEBF.LINEREF_DBR); WriteDebugWord(nextRoutineNumber); WriteDebugWord(0); // # sequence points, filled in later rollbackPosition = stream.Position; routinePoints = 0; routineStart = address; }
public void StartRoutine(LineRef start, int address, string name, [NotNull] IEnumerable <string> locals) { xml.WriteStartElement("routine"); xml.WriteElementString("identifier", name); xml.WriteElementString("address", address.ToString()); // TODO: <value> for packed address? int index = 1; foreach (var local in locals) { xml.WriteStartElement("local-variable"); xml.WriteElementString("identifier", local); xml.WriteElementString("index", index.ToString()); xml.WriteEndElement(); index++; } // leave element open... inRoutine = true; }