Esempio n. 1
0
        public override IArmInstruction ConvertToInstruction(uint aAddress, TArmInstructionSet aInstructionSet, uint aRawValue)
        {
            CodePlugin plugin = this.Plugin;

            IArmInstruction[] ret = plugin.ProvisioningManager.InstructionLibrary.ConvertToInstructions(aInstructionSet, new uint[1] {
                aRawValue
            }, aAddress);
            System.Diagnostics.Debug.Assert(ret != null && ret.Length == 1);
            return(ret[0]);
        }
Esempio n. 2
0
 internal CodeView(string aToken, CodePlugin aPlugin)
     : base(aToken, aPlugin)
 {
     iRelocator = new CodeRelocator(aPlugin);
     iQueryAPI  = new CodeQueryAPI(iRelocator);
 }
Esempio n. 3
0
        public override void Prime(TSynchronicity aSynchronicity)
        {
            CodePlugin plugin = this.Plugin;

            // Wipe any state ready for new priming attempt
            base.OnPrepareToPrime();
            if (base.ResetEngineBeforePriming)
            {
                plugin.Clear();
            }

            // Report the "priming started event" prior to adding the sources
            base.ReportEvent(TPrimeEvent.EEventPrimingStarted, null);

            // Any sources already registered with the source manager at the start of a new
            // priming request are assumed to already be complete.
            RecordAlreadyCompletedSources();

            // Initially, whilst adding the sources to the source manager, we'll
            // operate synchronously. This prevents us from triggering the read
            // operation in the SourceAdded callback below.
            iSynchronicity = TSynchronicity.ESynchronous;

            // Listen to source manager events in case any new sources are
            // created whilst reading those we already know about.
            CodeSourceManager sourceManager = this.SourceManager;

            sourceManager.SourceAdded   += new CodeSourceManager.SourceEventHandler(SourceManager_SourceAdded);
            sourceManager.SourceRemoved += new CodeSourceManager.SourceEventHandler(SourceManager_SourceRemoved);

            // Tell the source manager which sources we are reading. This also will
            // call our event handler (added above) so that we can observe source events.
            CodeSourceCollection sources = iSources;

            iSources = new CodeSourceCollection();
            sourceManager.AddRange(sources);

            // If we're operating asynchronously, then the loop below will potentially
            // complete quite quickly. This means that any (new/additional) sources which
            // are created (asynchronously) whilst reading is underway will not themselves
            // be read.
            //
            // Therefore, we store the synchronisation mode as a data member, and when
            // 'SourceAdded' is called, if operating asynchronously, we'll also initiate
            // a read operation for the source (as soon as it is added).
            //
            // If we're operating synchronously, then this isn't important. Because we're
            // behaving synchronously, the loop below will only process one source at a
            // time (before waiting) and therefore even if that source adds new/additional
            // sources to the source manager, we'll catch them as soon as we move the
            // next iteration around the loop.
            iSynchronicity = aSynchronicity;

            // TODO: possibly re-write this so that it uses two separate code paths
            // for synchronous and asynchronous priming? By trying to use one path
            // this code looks rather complex and isn't terribly robust.
            try
            {
                // Now we can start the sources running.
                int count = iSourcesYetToBePrimed.Count;
                while (count > 0)
                {
                    // Get the head source and remove it from the pending list
                    CodeSource source = iSourcesYetToBePrimed[0];
                    iSourcesYetToBePrimed.Remove(source);

                    // If the source wants to read it's data immediately, then activated
                    // it right now...
                    if (source.TimeToRead == CodeSource.TTimeToRead.EReadWhenPriming)
                    {
                        source.Read(aSynchronicity);
                    }
                    else
                    {
                        // This source will read it's data on it's own terms so skip
                        // it to ensure that we can track when all the other sources
                        // (that do actually read their files now..) are ready.
                        Skip(source);
                    }

                    count = iSourcesYetToBePrimed.Count;
                }
            }
            catch (Exception e)
            {
                // If priming failed, report completion before rethrowing...
                OnPrimeComplete();
                throw e;
            }
        }
Esempio n. 4
0
 public CodePrimer(CodePlugin aPlugin)
     : base(aPlugin)
 {
 }