Exemple #1
0
        /// <summary>
        /// Processes the statements of a basic block by using the architecture-specific
        /// Rewriter to obtain a stream of low-level RTL instructions. RTL assignments are
        /// simply added to the instruction list of the basic block. Jumps, returns, and
        /// calls to procedures that terminate the thread of executationresult in the
        /// termination of processing.
        /// </summary>
        public override void Process()
        {
            state.ErrorListener = (message) => { scanner.Warn(ric.Address, message); };
            blockCur            = scanner.FindContainingBlock(addrStart);
            if (BlockHasBeenScanned(blockCur))
            {
                return;
            }

            frame          = blockCur.Procedure.Frame;
            this.stackReg  = frame.EnsureRegister(arch.StackRegister);
            this.vaScanner = new VarargsFormatScanner(program, frame, state, scanner.Services);
            rtlStream      = scanner.GetTrace(addrStart, state, frame)
                             .GetEnumerator();

            while (rtlStream.MoveNext())
            {
                this.ric = rtlStream.Current;
                if (blockCur != scanner.FindContainingBlock(ric.Address))
                {
                    break;  // Fell off the end of this block.
                }
                if (!ProcessRtlCluster(ric))
                {
                    break;
                }
                var blNext = FallenThroughNextBlock(ric.Address + ric.Length);
                if (blNext != null)
                {
                    EnsureEdge(blockCur.Procedure, blockCur, blNext);
                    return;
                }
            }
        }
 private void Given_VaScanner(IProcessorArchitecture arch)
 {
     var platform = new DefaultPlatform(null, arch);
     var segmentMap = CreateSegmentMap(0, 128);
     this.program = new Program(segmentMap, arch, platform);
     this.vafs = CreateVaScanner(program);
 }