Beispiel #1
0
        public Tuple <uint, uint>[] GetProcessThreads(uint processId)
        {
            return(ExecuteOnDkmInitializedThread(() =>
            {
                DkmProcess process = GetProcess(processId);
                DkmThread[] threads = process.GetThreads();
                Tuple <uint, uint>[] result = new Tuple <uint, uint> [threads.Length];

                lock (this.threads)
                {
                    for (int i = 0; i < result.Length; i++)
                    {
                        result[i] = Tuple.Create((uint)this.threads.Count, (uint)threads[i].SystemPart.Id);
                        this.threads.Add(new ThreadStruct()
                        {
                            Thread = threads[i],
                            Frames = new SimpleCache <DkmStackFrame[]>(() =>
                            {
                                throw new NotImplementedException("You should first enumerate process threads!");
                            }),
                        });
                    }
                }

                return result;
            }));
        }
Beispiel #2
0
            public override GetCurrentFrameInfoResponse Handle(DkmProcess process)
            {
                var thread   = process.GetThreads().Single(t => t.UniqueId == ThreadId);
                var response = new GetCurrentFrameInfoResponse();

                thread.GetCurrentFrameInfo(out response.RetAddr, out response.FrameBase, out response.VFrame);
                return(response);
            }
Beispiel #3
0
            public override void Handle(DkmProcess process)
            {
                var ee = process.GetDataItem <ExpressionEvaluator>();

                if (ee != null)
                {
                    var thread = process.GetThreads().Single(t => t.UniqueId == ThreadId);
                    ee.OnAsyncBreakComplete(thread);
                }
            }
Beispiel #4
0
            public override void Handle(DkmProcess process)
            {
                var thread  = process.GetThreads().Single(t => t.UniqueId == ThreadId);
                var excInfo = DkmCustomExceptionInformation.Create(
                    process.GetPythonRuntimeInstance(), Guids.PythonExceptionCategoryGuid, thread, null, Name, 0,
                    DkmExceptionProcessingStage.Thrown | DkmExceptionProcessingStage.UserVisible | DkmExceptionProcessingStage.UserCodeSearch,
                    null, new ReadOnlyCollection <byte>(AdditionalInformation));

                excInfo.OnDebugMonitorException();
            }
Beispiel #5
0
            public override void Handle(DkmProcess process)
            {
                var traceHelper = process.GetDataItem <TraceManagerLocalHelper>();

                if (traceHelper == null)
                {
                    Debug.Fail("LocalComponent received a BeginStepInNotification, but there is no TraceManagerLocalHelper to handle it.");
                    throw new InvalidOperationException();
                }

                var thread = process.GetThreads().Single(t => t.UniqueId == ThreadId);

                traceHelper.OnBeginStepIn(thread);
            }
Beispiel #6
0
            public override void Handle(DkmProcess process)
            {
                var thread             = process.GetThreads().Single(t => t.UniqueId == ThreadId);
                var runtimeBreakpoints = process.GetDataItem <RuntimeDllBreakpoints>();

                if (runtimeBreakpoints.Handlers.TryGetValue(BreakpointId, out RuntimeDllBreakpointHandler handler))
                {
                    handler(thread, FrameBase, VFrame, ReturnAddress);
                }
                else
                {
                    Debug.Fail("LocalComponent received a HandleBreakpointRequest for a breakpoint that it does not know about.");
                }
            }
Beispiel #7
0
            public override void Handle(DkmProcess process)
            {
                var thread = process.GetThreads().Single(t => t.UniqueId == ThreadId);

                thread.EndFuncEvalExecution(DkmFuncEvalFlags.None);
            }