public override Expression ResolveImport( IDynamicLinker resolver, IPlatform platform, AddressContext ctx) { return(resolver.ResolveImport(ModuleName, ImportName, platform)); }
public Scanner( Program program, IDynamicLinker dynamicLinker, IServiceProvider services) : base(program, services.RequireService <DecompilerEventListener>()) { this.segmentMap = program.SegmentMap; this.dynamicLinker = dynamicLinker; this.Services = services; this.eventListener = services.RequireService <DecompilerEventListener>(); this.cancelSvc = services.GetService <CancellationTokenSource>(); if (segmentMap == null) { throw new InvalidOperationException("Program must have an segment map."); } if (program.ImageMap == null) { program.ImageMap = segmentMap.CreateImageMap(); } this.imageMap = program.ImageMap; this.procQueue = new PriorityQueue <WorkItem>(); this.blocks = new BTreeDictionary <Address, BlockRange>(); this.blockStarts = new Dictionary <Block, Address>(); this.importReferences = program.ImportReferences; this.visitedProcs = new HashSet <Procedure>(); this.cinj = new CommentInjector(program.User.Annotations); this.sr = new ScanResults { KnownProcedures = program.User.Procedures.Keys.ToHashSet(), KnownAddresses = program.ImageSymbols.ToDictionary(de => de.Key, de => de.Value), ICFG = new DiGraph <RtlBlock>(), }; }
/// <summary> /// Create NUnit stub maker. /// </summary> /// <param name="providerAssembly">nunit.framework assembly</param> /// <param name="linker">reflection linkage provider</param> public NUnitStubMaker( Assembly providerAssembly, IDynamicLinker linker ) : base("NUnit.Framework.Assertion", providerAssembly, linker) { }
/// <summary> /// Create csUnit stub maker. /// </summary> /// <param name="providerAssembly">csUnit assembly</param> /// <param name="linker">reflection linkage provider</param> public csUnitStubMaker( Assembly providerAssembly, IDynamicLinker linker ) : base("csUnit.Assert", providerAssembly, linker) { }
protected override void RunTest(Program program, TextWriter fut) { IDynamicLinker dynamicLinker = null; var listener = sc.RequireService <DecompilerEventListener>(); DataFlowAnalysis dfa = new DataFlowAnalysis(program, dynamicLinker, sc); var ssts = dfa.UntangleProcedures(); foreach (Procedure proc in program.Procedures.Values) { var sst = ssts.Single(s => s.SsaState.Procedure == proc); SsaState ssa = sst.SsaState; ConditionCodeEliminator cce = new ConditionCodeEliminator(program, ssa, listener); cce.Transform(); DeadCode.Eliminate(ssa); ValuePropagator vp = new ValuePropagator(program.SegmentMap, ssa, program.CallGraph, dynamicLinker, listener); vp.Transform(); DeadCode.Eliminate(ssa); Coalescer co = new Coalescer(ssa); co.Transform(); ssa.Write(fut); proc.Write(false, fut); fut.WriteLine(); ssa.Validate(s => { ssa.Dump(true); Assert.Fail(s); }); } }
/// <summary> /// Create MbUnit stub maker. /// </summary> /// <param name="providerAssembly">MbUnit.Core assembly</param> /// <param name="linker">reflection linkage provider</param> public MbUnitStubMaker( Assembly providerAssembly, IDynamicLinker linker ) : base("MbUnit.Core.Framework.Assert", providerAssembly, linker) { }
/// <summary> /// Initialize a stub maker. /// </summary> /// <param name="providerClassName">name of assertion /// class</param> /// <param name="providerAssembly">Assembly that provides /// assertion class</param> /// <param name="linker">reflection linkage provider</param> public AbstractStubMaker( string providerClassName, Assembly providerAssembly, IDynamicLinker linker ) : this(linker.GetType(providerClassName, providerAssembly)) { }
public void Setup() { arch = new Mock <IProcessorArchitecture>(); dynamicLinker = new Mock <IDynamicLinker>().Object; listener = new FakeDecompilerEventListener(); m = new ProcedureBuilder(); program = new Program(); }
public SparseValuePropagation(SsaState ssa, Program program, IDynamicLinker resolver, DecompilerEventListener listener) { this.ssa = ssa; this.listener = listener; this.cmp = new ExpressionValueComparer(); this.ctx = new SparseEvaluationContext(ssa.Procedure.Architecture); this.eval = new Evaluation.ExpressionSimplifier(program.SegmentMap, ctx, listener); }
public SsaEvaluationContext( IProcessorArchitecture arch, SsaIdentifierCollection ssaIds, IDynamicLinker dynamicLinker) { this.arch = arch; this.ssaIds = ssaIds; this.dynamicLinker = dynamicLinker; }
public DataFlowAnalysis( Program program, IDynamicLinker dynamicLinker, DecompilerEventListener eventListener) { this.program = program; this.dynamicLinker = dynamicLinker; this.eventListener = eventListener; this.flow = new ProgramDataFlow(program); }
public override Expression ResolveImport(IDynamicLinker dynamicLinker, IPlatform platform, AddressContext ctx) { var imp = dynamicLinker.ResolveImport(ModuleName, Ordinal, platform); if (imp != null) { return(imp); } ctx.Warn("Unable to resolve imported reference {0}.", this); return(null); }
public override ExternalProcedure ResolveImportedProcedure(IDynamicLinker resolver, IPlatform platform, AddressContext ctx) { var ep = resolver.ResolveProcedure(ModuleName, Ordinal, platform); if (ep != null) { return(ep); } ctx.Warn("Unable to resolve imported reference {0}.", this); return(new ExternalProcedure(this.ToString(), new FunctionType())); }
public DataFlowAnalysis( Program program, IDynamicLinker dynamicLinker, IServiceProvider services) { this.program = program; this.dynamicLinker = dynamicLinker; this.services = services; this.eventListener = services.RequireService <DecompilerEventListener>(); this.flow = new ProgramDataFlow(program); this.phaseNumbering = new Dictionary <string, int>(); }
private Statement?stmCur; //$REFACTOR: try to make this a context paramter. public ValuePropagator( SegmentMap segmentMap, SsaState ssa, CallGraph callGraph, IDynamicLinker dynamicLinker, DecompilerEventListener eventListener) { this.ssa = ssa; this.callGraph = callGraph; this.arch = ssa.Procedure.Architecture; this.eventListener = eventListener; this.ssam = new SsaMutator(ssa); this.evalCtx = new SsaEvaluationContext(arch, ssa.Identifiers, dynamicLinker); this.eval = new ExpressionSimplifier(segmentMap, evalCtx, eventListener); }
public UnusedOutValuesRemover( Program program, IEnumerable <SsaState> ssaStates, ProgramDataFlow dataFlow, IDynamicLinker dynamicLinker, DecompilerEventListener eventListener) { this.dataFlow = dataFlow; this.program = program; this.ssaStates = ssaStates; this.dynamicLinker = dynamicLinker; this.eventListener = eventListener; this.wl = new WorkList <SsaState>(); this.procToSsa = ssaStates .ToDictionary(s => s.Procedure); }
public override ExternalProcedure ResolveImportedProcedure( IDynamicLinker resolver, IPlatform platform, AddressContext ctx) { var ep = resolver.ResolveProcedure(ModuleName, ImportName, platform); if (ep != null) { if (!ep.Signature.ParametersValid) { ctx.Warn("Unable to guess parameters of {0}.", this); } return(ep); } ctx.Warn("Unable to resolve imported reference {0}.", this); return(new ExternalProcedure(this.ToString(), new FunctionType())); }
/// <summary> /// Create an implementation factory. /// </summary> /// <param name="env"><see cref="IDictionary"/> of environment /// variable name value entries</param> /// <param name="linker">provider of reflection services</param> public ImplementationFactory(IDictionary env, IDynamicLinker linker) { _env = env; _linker = linker; }
public TestScanner(Program program, TypeLibrary metadata, IDynamicLinker dynamicLinker, IServiceProvider services) : base(program, metadata, dynamicLinker, services) { }
public TestScanner(Program program, IDynamicLinker dynamicLinker, IServiceProvider services) : base(program, dynamicLinker, services) { }
public abstract ExternalProcedure ResolveImportedProcedure(IDynamicLinker dynamicLinker, IPlatform platform, AddressContext ctx);
public abstract Expression ResolveImport(IDynamicLinker dynamicLinker, IPlatform platform, AddressContext ctx);