示例#1
0
        /// <summary>
        /// Grab a single instruction.
        /// </summary>
        /// <param name="segment"></param>
        /// <param name="a"></param>
        /// <returns></returns>
        private MachineInstruction Dasm(ImageSegment segment, int a)
        {
            var addr = segment.Address + a;

            if (!segment.IsInRange(addr) || !segment.MemoryArea.IsValidAddress(addr))
            {
                return(null);
            }
            var dasm = program.CreateDisassembler(addr);

            return(dasm.FirstOrDefault());
        }
示例#2
0
        private bool ShowItem(MixedCodeDataModel.DataItemNode item)
        {
            if (!showProcedures && item.Proc != null)
            {
                return(false);
            }

            if (segment != null && !segment.IsInRange(item.StartAddress))
            {
                return(false);
            }

            return(true);
        }
        private void PopulateChildren()
        {
            var program = GetProgram();

            if (program == null)
            {
                return;
            }
            var eps           = program.EntryPoints.Keys.ToHashSet();
            var globals       = GetGlobalVariables(program.ImageMap, segment);
            var desDictionary =
                globals.Concat(
                    (from proc in program.Procedures.Where(p => segment.IsInRange(p.Key))
                     join up in program.User.Procedures on proc.Key.ToLinear() equals up.Key.ToLinear() into ups
                     from up in ups.DefaultIfEmpty()
                     select new ProcedureDesigner(program, proc.Value, up.Value, proc.Key, eps.Contains(proc.Key))).
                    Union(
                        from up in program.User.Procedures.Where(p => segment.IsInRange(p.Key))
                        join proc in program.Procedures on up.Key.ToLinear() equals proc.Key.ToLinear() into ups
                        from proc in ups.DefaultIfEmpty()
                        select new ProcedureDesigner(program, proc.Value, up.Value, up.Key, eps.Contains(up.Key))));

            Host.AddComponents(Component, desDictionary);
        }
示例#4
0
 private TreeNodeDesigner[] GetGlobalVariables(ImageMap imageMap, ImageSegment segment)
 {
     if (imageMap.Items.Values
         .Where(i => !(i is ImageMapBlock) &&
                !(i.DataType is UnknownType))
         .Any(i => segment.IsInRange(i.Address)))
     {
         return(new TreeNodeDesigner[]
         {
             new GlobalVariablesNodeDesigner(segment)
         });
     }
     else
     {
         return(new TreeNodeDesigner[0]);
     }
 }