コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="inputFormat">format of audio supplied to `Send`</param>
        /// <param name="inputFrameSize">Size of frames which will should be provided from `GetFrameBuffer`</param>
        /// <param name="intermediateFrameSize">Size of frames which should be passed into `PreprocessAudioFrame`</param>
        /// <param name="intermediateSampleRate">Sample rate which should be passed into `PreprocessAudioFrame`</param>
        /// <param name="outputFrameSize">Size of frames which will be provided sent to `SendSamplesToSubscribers`</param>
        /// <param name="outputSampleRate"></param>
        protected BasePreprocessingPipeline(WaveFormat inputFormat, int inputFrameSize, int intermediateFrameSize, int intermediateSampleRate, int outputFrameSize, int outputSampleRate)
        {
            if (inputFrameSize < 0)
            {
                throw new ArgumentOutOfRangeException("inputFrameSize", "Input frame size cannot be less than zero");
            }

            _inputFrameSize  = inputFrameSize;
            _outputFrameSize = outputFrameSize;
            _outputFormat    = new WaveFormat(1, outputSampleRate);

            //Create input system (source of empty buffers, queue of waiting input data)
            _inputBufferSource = new ConcurrentPool <float[]>(24, () => new float[inputFrameSize]);
            _inputQueue        = new TransferBuffer <float[]>(12);
            _emptyInputFrame   = new float[inputFrameSize];

            //Create resampler to resample input to intermediate rate
            _resamplerInput    = new BufferedSampleProvider(inputFormat, InputFrameSize * 4);
            _resampler         = new Resampler(_resamplerInput, 48000);
            _resampledOutput   = new SampleToFrameProvider(_resampler, (uint)OutputFrameSize);
            _intermediateFrame = new float[intermediateFrameSize];

            _threadEvent = new AutoResetEvent(false);
            _thread      = new DThread(ThreadEntry);
        }
コード例 #2
0
        public void SetThreadMStateWaitObject(ParserParagraph aParagraph, ParserLine aLine, ParserFieldName aParameterName, uint aWaitObjectAddress)
        {
            System.Diagnostics.Debug.Assert(aParagraph.Tag is DThread);
            DThread thread = (DThread)aParagraph.Tag;

            thread.WaitObj = aWaitObjectAddress;
        }
コード例 #3
0
        public void CreateMonitorThread(ParserEngine aEngine, string aName, DThread aThread, ParserElementBase.ElementCompleteHandler aLastFieldHandler)
        {
            // Create DObject paragraph
            ParserParagraph para0 = base.CreateMonitorObjectParagraph(aName, aThread);

            aEngine.Add(para0);

            // Create MState paragraphs
            ParserParagraph para1 = new ParserParagraph(aName + "_MSTATE");

            para1.Tag = aThread;
            aEngine.Add(para1);
            CreateThreadMState(para1, DThread.TThreadState.ECreated, "CREATED", false);
            CreateThreadMState(para1, DThread.TThreadState.EDead, "DEAD", false);
            CreateThreadMState(para1, DThread.TThreadState.EReady, "READY", false);
            CreateThreadMState(para1, DThread.TThreadState.EWaitSemaphore, "WAITSEM", true);
            CreateThreadMState(para1, DThread.TThreadState.EWaitSemaphoreSuspended, "WAITSEMS", true);
            CreateThreadMState(para1, DThread.TThreadState.EWaitMutex, "WAITMUTEX", true);
            CreateThreadMState(para1, DThread.TThreadState.EWaitMutexSuspended, "WAITMUTXS", true);
            CreateThreadMState(para1, DThread.TThreadState.EHoldMutexPending, "HOLDMUTXP", true);
            CreateThreadMState(para1, DThread.TThreadState.EWaitCondVar, "WAITCONDVAR", true);
            CreateThreadMState(para1, DThread.TThreadState.EWaitCondVarSuspended, "WAITCONDVRS", true);
            CreateThreadMState(para1, DThread.TThreadState.EUnknown, "??", true);

            // Create common thread paragraph
            ParserParagraph para2 = CreateThreadCommon(aName, aThread);

            aEngine.Add(para2);

            // Create NThread paragraphs
            iHelper.CreateMonitorNThread(aEngine, aName + "_NTHREAD", aThread.NThread, aLastFieldHandler);

            // TODO: add support for older memory models?
        }
コード例 #4
0
        private void PrepareEntryParser()
        {
            // Junk the old paragraphs
            ParserEngine.Reset();

            // Get a handle to our destination container
            DObjectCon container = CrashDebugger.ContainerByType(DObject.TObjectType.EThread);

            // Save last thread if it looks valid
            if (iCurrentObject != null && iCurrentObject.KernelAddress != 0)
            {
                bool alreadyExists = container.Contains(iCurrentObject);
                if (!alreadyExists)
                {
                    container.Add(iCurrentObject);
                }
                //
                iCurrentObject = null;
            }

            // Create a new object which will contain the next set of parser data
            iCurrentObject = new DThread(CrashDebugger);

            // Use the helper to prepare next paragraphs
            iHelper.CreateMonitorThread(ParserEngine, "ENTRY [" + container.TypeDescription + "]", iCurrentObject, new SymbianParserLib.BaseStructures.ParserElementBase.ElementCompleteHandler(PC_Register_ElementComplete));
        }
コード例 #5
0
        public void CreateStackParagraphs(ParserEngine aEngine, DThread aThread)
        {
            ParserParagraph p1 = PrepareUserStack(aThread.StackInfoUser);
            ParserParagraph p2 = PrepareSupervisorStack(aThread.StackInfoSupervisor);

            //
            aEngine.Add(p1, p2);
        }
コード例 #6
0
        void ThreadMState_ElementComplete(ParserElementBase aElement)
        {
            ParserLine      line      = (ParserLine)aElement;
            ParserParagraph paragraph = line.Paragraph;

            System.Diagnostics.Debug.Assert(paragraph.Tag is DThread);
            DThread thread = (DThread)paragraph.Tag;

            DThread.TThreadState state = (DThread.TThreadState)line.Tag;
            thread.MState = state;
        }
コード例 #7
0
        public void Clear()
        {
            iTheCurrentProcess = new DProcess(this);
            iTheCurrentThread  = new DThread(this);
            iCodeSegs.Clear();
            iInfoCpu.Clear();
            iInfoFault.Clear();
            iInfoScheduler.Clear();
            iInfoDebugMask.Clear();

            iUserContextTableManager = new UserContextTableManager();
            iAsyncOperationManager.Clear();

            MakeEmptyContainers();
        }
コード例 #8
0
 public CrashDebuggerInfo(DbgEngine aDebugEngine)
 {
     iDebugEngine     = aDebugEngine;
     iDebugEngineView = aDebugEngine.CreateView("CrashDebugger");
     //
     iTheCurrentProcess = new DProcess(this);
     iTheCurrentThread  = new DThread(this);
     iCodeSegs          = new CodeSegCollection(this);
     iInfoCpu           = new CpuInfo(this);
     iInfoFault         = new FaultInfo(this);
     iInfoScheduler     = new SchedulerInfo(this);
     iInfoDebugMask     = new DebugMaskInfo(this);
     //
     MakeEmptyContainers();
 }
コード例 #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="inputFormat">format of audio supplied to `Send`</param>
        /// <param name="intermediateFrameSize">Size of frames which should be passed into `PreprocessAudioFrame`</param>
        /// <param name="intermediateSampleRate">Sample rate which should be passed into `PreprocessAudioFrame`</param>
        /// <param name="outputFrameSize">Size of frames which will be provided sent to `SendSamplesToSubscribers`</param>
        /// <param name="outputSampleRate"></param>
        protected BasePreprocessingPipeline([NotNull] WaveFormat inputFormat, int intermediateFrameSize, int intermediateSampleRate, int outputFrameSize, int outputSampleRate)
        {
            if (inputFormat == null)
            {
                throw new ArgumentNullException("inputFormat");
            }
            if (intermediateFrameSize < 0)
            {
                throw new ArgumentOutOfRangeException("intermediateFrameSize", "Intermediate frame size cannot be less than zero");
            }
            if (intermediateSampleRate < 0)
            {
                throw new ArgumentOutOfRangeException("intermediateSampleRate", "Intermediate sample rate cannot be less than zero");
            }
            if (outputFrameSize < 0)
            {
                throw new ArgumentOutOfRangeException("outputFrameSize", "Output frame size cannot be less than zero");
            }
            if (outputSampleRate < 0)
            {
                throw new ArgumentOutOfRangeException("outputSampleRate", "Output sample rate cannot be less than zero");
            }

            _outputFrameSize = outputFrameSize;
            _outputFormat    = new WaveFormat(outputSampleRate, 1);

            //Create resampler to resample input to intermediate rate
            _resamplerInput    = new BufferedSampleProvider(inputFormat, intermediateFrameSize * 16);
            _resampler         = new Resampler(_resamplerInput, 48000);
            _resampledOutput   = new SampleToFrameProvider(_resampler, (uint)OutputFrameSize);
            _intermediateFrame = new float[intermediateFrameSize];

            //Create a thread to drive the audio processing
            _threadEvent = new AutoResetEvent(false);
            _thread      = new DThread(ThreadEntry);

            // We don't want to overestimate the latency. It's hard to come up with a reasonable number for this because if the input frames are >= the...
            // ...intermediate frames there will actually be no buffering delay in the preprocessor (it'll pick up a complete frame and process it right away).
            _estimatedPreprocessorLatencyMs = 0;
        }
コード例 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="inputFormat">format of audio supplied to `Send`</param>
        /// <param name="inputFrameSize">Size of frames which will should be provided from `GetFrameBuffer`</param>
        /// <param name="intermediateFrameSize">Size of frames which should be passed into `PreprocessAudioFrame`</param>
        /// <param name="intermediateSampleRate">Sample rate which should be passed into `PreprocessAudioFrame`</param>
        /// <param name="outputFrameSize">Size of frames which will be provided sent to `SendSamplesToSubscribers`</param>
        /// <param name="outputSampleRate"></param>
        protected BasePreprocessingPipeline([NotNull] WaveFormat inputFormat, int inputFrameSize, int intermediateFrameSize, int intermediateSampleRate, int outputFrameSize, int outputSampleRate)
        {
            if (inputFormat == null)
            {
                throw new ArgumentNullException("inputFormat");
            }
            if (inputFrameSize < 0)
            {
                throw new ArgumentOutOfRangeException("inputFrameSize", "Input frame size cannot be less than zero");
            }
            if (intermediateFrameSize < 0)
            {
                throw new ArgumentOutOfRangeException("intermediateFrameSize", "Intermediate frame size cannot be less than zero");
            }
            if (intermediateSampleRate < 0)
            {
                throw new ArgumentOutOfRangeException("intermediateSampleRate", "Intermediate sample rate cannot be less than zero");
            }
            if (outputFrameSize < 0)
            {
                throw new ArgumentOutOfRangeException("outputFrameSize", "Output frame size cannot be less than zero");
            }
            if (outputSampleRate < 0)
            {
                throw new ArgumentOutOfRangeException("outputSampleRate", "Output sample rate cannot be less than zero");
            }

            _inputFrameSize  = inputFrameSize;
            _outputFrameSize = outputFrameSize;
            _outputFormat    = new WaveFormat(1, outputSampleRate);

            //Create resampler to resample input to intermediate rate
            _resamplerInput    = new BufferedSampleProvider(inputFormat, InputFrameSize * 16);
            _resampler         = new Resampler(_resamplerInput, 48000);
            _resampledOutput   = new SampleToFrameProvider(_resampler, (uint)OutputFrameSize);
            _intermediateFrame = new float[intermediateFrameSize];

            _threadEvent = new AutoResetEvent(false);
            _thread      = new DThread(ThreadEntry);
        }
コード例 #11
0
        private ParserParagraph CreateThreadCommon(string aName, DThread aThread)
        {
            ParserParagraph para = new ParserParagraph(aName);
            //
            ParserLine l1 = ParserLine.NewSymFormat("Default priority %d WaitLink Priority %d\r\n");

            l1.SetTargetProperties(aThread.Priorities, "Default", "WaitLink");
            //
            ParserLine l2 = ParserLine.NewSymFormat("ExitInfo %d,%d,%lS\r\n");

            l2.SetTargetProperties(aThread.ExitInfo, "Type", "Reason", "Category");
            //
            ParserLine l3 = ParserLine.NewSymFormat("Flags %08x, Handles %08x\r\n");

            l3.SetTargetProperties(aThread, "Flags", "Handles");
            //
            ParserLine l4 = ParserLine.NewSymFormat("Supervisor stack base %08x size %x\r\n");

            l4.SetTargetProperties(aThread.StackInfoSupervisor, "BaseAddress", "Size");
            //
            ParserLine l5 = ParserLine.NewSymFormat("User stack base %08x size %x\r\n");

            l5.SetTargetProperties(aThread.StackInfoUser, "BaseAddress", "Size");
            //
            ParserLine l6 = ParserLine.NewSymFormat("Id=%d, Alctr=%08x, Created alctr=%08x, Frame=%08x\r\n");

            l6.SetTargetProperties(new object[] { aThread, aThread.AllocatorInfo, aThread.AllocatorInfo, aThread }, "Id", "Allocator", "CreatedAllocator", "Frame");
            //
            ParserLine l7 = ParserLine.NewSymFormat("Trap handler=%08x, ActiveScheduler=%08x, Exception handler=%08x\r\n");

            l7.SetTargetProperties(aThread.Handlers, "TrapHandler", "ActiveScheduler", "ExceptionHandler");
            //
            ParserLine l8 = ParserLine.NewSymFormat("TempObj=%08x TempAlloc=%08x IpcCount=%08x\r\n");

            l8.SetTargetProperties(new object[] { aThread.Temporaries, aThread.Temporaries, aThread }, "TempObj", "TempAlloc", "IpcCount");
            //
            para.Add(l1, l2, l3, l4, l5, l6, l7, l8);
            return(para);
        }
コード例 #12
0
 public void CreateMonitorThread(ParserEngine aEngine, string aName, DThread aThread)
 {
     CreateMonitorThread(aEngine, aName, aThread, null);
 }
コード例 #13
0
 internal bool IsCurrentThread(DThread aThread)
 {
     return(aThread.KernelAddress == TheCurrentThread.KernelAddress && TheCurrentThread.KernelAddress != 0);
 }
コード例 #14
0
ファイル: NThread.cs プロジェクト: fedor4ever/CrashAnalyser
 public NThread(CrashDebuggerInfo aCrashDebugger, DThread aParentThread)
     : base(aCrashDebugger)
 {
     iParentThread = aParentThread;
     iRegisters    = new RegisterCollection(aCrashDebugger, RegisterCollection.TType.ETypeGeneral, aParentThread.OwningProcess);
 }