Exemplo n.º 1
0
        //internal void WriteData(MyBinaryWriter bw)
        //{
        //    this.DataOffset = (int)bw.BaseStream.Position;
        //    bw.Write(this.file_name);
        //    if (this.guid == null)
        //    {
        //        this.guid = Guid.NewGuid().ToByteArray();
        //        try
        //        {
        //            using (FileStream fs = new FileStream(this.file_name, FileMode.Open, FileAccess.Read))
        //            {
        //                MD5 md5 = MD5.Create();
        //                this.hash = md5.ComputeHash(fs);
        //            }
        //        }
        //        catch
        //        {
        //            this.hash = new byte[16];
        //        }
        //    }
        //    bw.Write(this.guid);
        //    bw.Write(this.hash);
        //    bw.Write(this.auto_generated ? 1 : 0);
        //}
        //internal void Write(BinaryWriter bw)
        //{
        //    bw.Write(this.Index);
        //    bw.Write(this.DataOffset);
        //}
        internal SourceFileEntry(MonoSymbolFile file, MyBinaryReader reader)
        {
            this.file       = file;
            this.Index      = reader.ReadInt32();
            this.DataOffset = reader.ReadInt32();
            int old_pos = (int)reader.BaseStream.Position;

            reader.BaseStream.Position = (long)this.DataOffset;
            this.file_name             = reader.ReadString();
            this.guid                  = reader.ReadBytes(16);
            this.hash                  = reader.ReadBytes(16);
            this.auto_generated        = (reader.ReadByte() == 1);
            reader.BaseStream.Position = (long)old_pos;
        }
Exemplo n.º 2
0
        internal SourceFileEntry(MonoSymbolFile file, MyBinaryReader reader)
        {
            this.file = file;

            Index      = reader.ReadInt32();
            DataOffset = reader.ReadInt32();

            int old_pos = (int)reader.BaseStream.Position;

            reader.BaseStream.Position = DataOffset;

            file_name      = reader.ReadString();
            guid           = reader.ReadBytes(16);
            hash           = reader.ReadBytes(16);
            auto_generated = reader.ReadByte() == 1;

            reader.BaseStream.Position = old_pos;
        }
Exemplo n.º 3
0
        MonoSymbolFile(string filename)
        {
            this.FileName = filename;

            FileStream stream;

            try {
                stream = new FileStream(filename, FileMode.Open, FileAccess.Read);
                reader = new MyBinaryReader(stream);
            } catch (IOException ex) {
                throw new MonoSymbolFileException(
                          "Cannot read symbol file `{0}': {1}", filename, ex.Message);
            }

            try {
                long magic         = reader.ReadInt64();
                int  major_version = reader.ReadInt32();
                int  minor_version = reader.ReadInt32();

                if (magic != OffsetTable.Magic)
                {
                    throw new MonoSymbolFileException(
                              "Symbol file `{0}' is not a valid " +
                              "Mono symbol file", filename);
                }
                if (major_version != OffsetTable.MajorVersion)
                {
                    throw new MonoSymbolFileException(
                              "Symbol file `{0}' has version {1}, " +
                              "but expected {2}", filename, major_version,
                              OffsetTable.MajorVersion);
                }
                if (minor_version != OffsetTable.MinorVersion)
                {
                    throw new MonoSymbolFileException(
                              "Symbol file `{0}' has version {1}.{2}, " +
                              "but expected {3}.{4}", filename, major_version,
                              minor_version, OffsetTable.MajorVersion,
                              OffsetTable.MinorVersion);
                }

                MajorVersion = major_version;
                MinorVersion = minor_version;
                guid         = new Guid(reader.ReadBytes(16));

                ot = new OffsetTable(reader, major_version, minor_version);
            } catch {
                throw new MonoSymbolFileException(
                          "Cannot read symbol file `{0}'", filename);
            }

            source_file_hash  = new Hashtable();
            compile_unit_hash = new Hashtable();
        }
Exemplo n.º 4
0
 //internal void WriteData(MyBinaryWriter bw)
 //{
 //    this.DataOffset = (int)bw.BaseStream.Position;
 //    bw.Write(this.file_name);
 //    if (this.guid == null)
 //    {
 //        this.guid = Guid.NewGuid().ToByteArray();
 //        try
 //        {
 //            using (FileStream fs = new FileStream(this.file_name, FileMode.Open, FileAccess.Read))
 //            {
 //                MD5 md5 = MD5.Create();
 //                this.hash = md5.ComputeHash(fs);
 //            }
 //        }
 //        catch
 //        {
 //            this.hash = new byte[16];
 //        }
 //    }
 //    bw.Write(this.guid);
 //    bw.Write(this.hash);
 //    bw.Write(this.auto_generated ? 1 : 0);
 //}
 //internal void Write(BinaryWriter bw)
 //{
 //    bw.Write(this.Index);
 //    bw.Write(this.DataOffset);
 //}
 internal SourceFileEntry(MonoSymbolFile file, MyBinaryReader reader)
 {
     this.file = file;
     this.Index = reader.ReadInt32();
     this.DataOffset = reader.ReadInt32();
     int old_pos = (int)reader.BaseStream.Position;
     reader.BaseStream.Position = (long)this.DataOffset;
     this.file_name = reader.ReadString();
     //??this.guid = reader.ReadBytes(16);
     this.hash = reader.ReadBytes(16);
     this.auto_generated = (reader.ReadByte() == 1);
     reader.BaseStream.Position = (long)old_pos;
 }
        MonoSymbolFile(Stream stream)
        {
            reader = new MyBinaryReader(stream);

            try
            {
                long magic         = reader.ReadInt64();
                int  major_version = reader.ReadInt32();
                int  minor_version = reader.ReadInt32();

                if (magic != OffsetTable.Magic)
                {
                    throw new MonoSymbolFileException("Symbol file is not a valid");
                }
                if (major_version != OffsetTable.MajorVersion)
                {
                    throw new MonoSymbolFileException(
                              "Symbol file has version {0} but expected {1}", major_version, OffsetTable.MajorVersion);
                }
                if (minor_version != OffsetTable.MinorVersion)
                {
                    throw new MonoSymbolFileException("Symbol file has version {0}.{1} but expected {2}.{3}",
                                                      major_version, minor_version,
                                                      OffsetTable.MajorVersion, OffsetTable.MinorVersion);
                }

                MajorVersion = major_version;
                MinorVersion = minor_version;
                guid         = new Guid(reader.ReadBytes(16));

                ot = new OffsetTable(reader, major_version, minor_version);
            }
            catch (Exception e)
            {
                throw new MonoSymbolFileException("Cannot read symbol file", e);
            }

            source_file_hash  = new Dictionary <int, SourceFileEntry> ();
            compile_unit_hash = new Dictionary <int, CompileUnitEntry> ();
        }
Exemplo n.º 6
0
		MonoSymbolFile (string filename)
		{
			this.FileName = filename;
			FileStream stream = new FileStream (filename, FileMode.Open, FileAccess.Read);
			reader = new MyBinaryReader (stream);

			try {
				long magic = reader.ReadInt64 ();
				int major_version = reader.ReadInt32 ();
				int minor_version = reader.ReadInt32 ();

				if (magic != OffsetTable.Magic)
					throw new MonoSymbolFileException (
						"Symbol file `{0}' is not a valid " +
						"Mono symbol file", filename);
				if (major_version != OffsetTable.MajorVersion)
					throw new MonoSymbolFileException (
						"Symbol file `{0}' has version {1}, " +
						"but expected {2}", filename, major_version,
						OffsetTable.MajorVersion);
				if (minor_version != OffsetTable.MinorVersion)
					throw new MonoSymbolFileException (
						"Symbol file `{0}' has version {1}.{2}, " +
						"but expected {3}.{4}", filename, major_version,
						minor_version, OffsetTable.MajorVersion,
						OffsetTable.MinorVersion);

				MajorVersion = major_version;
				MinorVersion = minor_version;
				guid = new Guid (reader.ReadBytes (16));

				ot = new OffsetTable (reader, major_version, minor_version);
			} catch {
				throw new MonoSymbolFileException (
					"Cannot read symbol file `{0}'", filename);
			}

			source_file_hash = new Dictionary<int, SourceFileEntry> ();
			compile_unit_hash = new Dictionary<int, CompileUnitEntry> ();
		}
		internal SourceFileEntry (MonoSymbolFile file, MyBinaryReader reader)
		{
			this.file = file;

			Index = reader.ReadInt32 ();
			DataOffset = reader.ReadInt32 ();

			int old_pos = (int) reader.BaseStream.Position;
			reader.BaseStream.Position = DataOffset;

			file_name = reader.ReadString ();
			guid = reader.ReadBytes (16);
			hash = reader.ReadBytes (16);
			auto_generated = reader.ReadByte () == 1;

			reader.BaseStream.Position = old_pos;
		}
Exemplo n.º 8
0
        MonoSymbolFile(Stream stream)
        {
            reader = new MyBinaryReader (stream);

            try {
                long magic = reader.ReadInt64 ();
                int major_version = reader.ReadInt32 ();
                int minor_version = reader.ReadInt32 ();

                if (magic != OffsetTable.Magic)
                    throw new MonoSymbolFileException ("Symbol file is not a valid");
                if (major_version != OffsetTable.MajorVersion)
                    throw new MonoSymbolFileException (
                        "Symbol file has version {0} but expected {1}", major_version, OffsetTable.MajorVersion);
                if (minor_version != OffsetTable.MinorVersion)
                    throw new MonoSymbolFileException ("Symbol file has version {0}.{1} but expected {2}.{3}",
                        major_version, minor_version,
                        OffsetTable.MajorVersion, OffsetTable.MinorVersion);

                MajorVersion = major_version;
                MinorVersion = minor_version;
                guid = new Guid (reader.ReadBytes (16));

                ot = new OffsetTable (reader, major_version, minor_version);
            } catch (Exception e) {
                throw new MonoSymbolFileException ("Cannot read symbol file", e);
            }

            source_file_hash = new Dictionary<int, SourceFileEntry> ();
            compile_unit_hash = new Dictionary<int, CompileUnitEntry> ();
        }