示例#1
0
        /// <summary>
        /// Creates a new object code file object.
        /// </summary>
        /// <param name="StartAddress">The load address of the object file.</param>
        /// <param name="Filename">The name of the object file.</param>
        /// <param name="Architecture">The targeted architecture of the object file.</param>
        /// <param name="Sections">The sections of the object file.</param>
        /// <param name="SymbolTable">The symbol table of the object file.</param>
        /// <param name="Code">The source code of the object file.</param>
        public ObjectCodeFile(long StartAddress, String Filename, String Architecture,
            Section[] Sections, SymbolTable SymbolTable, CodeUnit[] Code)
        {
            this.loadAddress  = StartAddress;
            this.Filepath     = Filename;
            this.Architecture = Architecture;
            this.Sections     = Sections;
            this.SymbolTable  = SymbolTable;
            this.Code         = Code;

            this.RequestedLoadAddress = StartAddress;

            // Sum loaded sections' sizes
            if (this.Sections != null)
            this.Size = this.Sections.Sum(
                sec => sec.Flags.HasFlag(SectionFlags.Load) ? (long)sec.Size : 0);

            // Get unique source file paths
            var tmpFiles = new HashSet<string>();

            foreach (CodeUnit unit in this.Code) {
                tmpFiles.Add(unit.SourceFilepath.Trim());
            }
            this.SourceFiles = tmpFiles.ToArray();
        }
示例#2
0
 /// <summary>
 /// Creates a new object code file object.
 /// </summary>
 /// <param name="StartAddress">The starting address of the object file.</param>
 /// <param name="Filename">The name of the object file.</param>
 /// <param name="Architecture">The targeted architecture of the object file.</param>
 /// <param name="Sections">The sections of the object file.</param>
 /// <param name="SymbolTable">The symbol table of the object file.</param>
 /// <param name="Code">The source code of the object file.</param>
 public ObjectCodeFile(uint StartAddress, String Filename, String Architecture,
     Section[] Sections, SymbolTable SymbolTable, CodeUnit[] Code)
 {
     this.StartAddress = StartAddress;
     this.Filename     = Filename;
     this.Architecture = Architecture;
     this.Sections     = Sections;
     this.SymbolTable  = SymbolTable;
     this.Code         = Code;
 }