Ejemplo n.º 1
0
        private static LogicalSegment ConvertSegmentDefinition(
            SegmentDefinition def, Dictionary <object, object> objectMap,
            ObjectModule module)
        {
            // Convert the record.
            LogicalSegment segment = new LogicalSegment(def, objectMap, module);

            return(segment);
        }
 public SegmentItem(LogicalSegment segment, ObjectModule module)
 {
     this.segment = segment;
     this.symbols = new List<SymbolItem>(
         from symbol in module.DefinedNames
         where symbol.BaseSegment == segment
         orderby symbol.Offset, symbol.Name
         select new SymbolItem(symbol));
 }
 private void DisassembleSegment(LogicalSegment segment, int offset)
 {
     // Raise request navigate event.
     if (this.RequestNavigate != null)
     {
         AssemblyUri uri = new AssemblyUri(library, segment, offset);
         var e = new RequestNavigateEventArgs(uri, null);
         this.RequestNavigate(this, e);
     }
 }
Ejemplo n.º 4
0
 private static LogicalSegment ConvertSegmentDefinition(
     SegmentDefinition def, Dictionary<object, object> objectMap,
     ObjectModule module)
 {
     // Convert the record.
     LogicalSegment segment = new LogicalSegment(def, objectMap, module);
     return segment;
 }
Ejemplo n.º 5
0
 public LibrarySegment(LogicalSegment segment)
 {
     this.segment = segment;
     this.attrs = new ByteAttribute[segment.Data.Length];
 }
Ejemplo n.º 6
0
 public LibrarySegment(LogicalSegment segment)
 {
     this.segment = segment;
     this.attrs   = new ByteAttribute[segment.Data.Length];
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Returns null if LibraryEnd record is encountered before
        /// MODEND or MODEND32 record is encountered.
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        private static ObjectModule LoadObject(FileFormats.Omf.Records.RecordContext context)
        {
            ObjectModule module = new ObjectModule();

            Dictionary <object, object> objectMap =
                new Dictionary <object, object>();

            // Convert meta-data.
            module.Name       = context.ObjectName;
            module.SourceName = context.SourceName;

            // Convert segments.
            foreach (SegmentDefinition def in context.Segments)
            {
                LogicalSegment segment = ConvertSegmentDefinition(def, objectMap, module);
                objectMap[def] = segment;
                module.Segments.Add(segment);
            }

            // Convert segment groups.
            foreach (GroupDefinition def in context.Groups)
            {
                SegmentGroup group = ConvertGroupDefinition(def, objectMap);
                module.Groups.Add(group);
                objectMap[def] = group;
            }

            // Convert external names.
            foreach (ExternalNameDefinition def in context.ExternalNames)
            {
                ExternalSymbol symbol = new ExternalSymbol
                {
                    Name      = def.Name,
                    TypeIndex = def.TypeIndex,
                };
                module.ExternalNames.Add(symbol);
                objectMap[def] = symbol;
            }

            // Convert aliases.
            foreach (AliasDefinition def in context.Aliases)
            {
                module.Aliases.Add(new SymbolAlias
                {
                    AliasName      = def.AliasName,
                    SubstituteName = def.SubstituteName
                });
            }

            // Convert public names.
            foreach (PublicNameDefinition def in context.PublicNames)
            {
                module.DefinedNames.Add(ConvertPublicNameDefinition(def, objectMap));
            }

            // Convert fixups.
            foreach (SegmentDefinition def in context.Segments)
            {
                LogicalSegment segment = (LogicalSegment)objectMap[def];
                foreach (FixupDefinition f in def.Fixups)
                {
                    segment.Fixups.Add(ConvertFixupDefinition(f, objectMap));
                }
            }

            return(module);
        }