Пример #1
0
		private void debugEventHandler_ActiveFrameChanged(NuGenFrameRefresher newActiveFrameRefresher, FrameWrapper newActiveFrame)
		{
			ActiveFrameRefresher = newActiveFrameRefresher;
			ActiveFrame = newActiveFrame;
			IsFrameValid = true;

			if (UpdateWhenActiveFrameChanges())
			{
				if (Visible)
				{
					ClearPanel();
					InitializePanel();
				}
				else
				{
					IsPanelCleared = false;
					IsDebugPanelInitialized = false;
				}
			}
		}
Пример #2
0
		private void debugEventHandler_UpdateDebugInformation(NuGenFrameRefresher activeFrameRefresher, FrameWrapper activeFrame)
		{
			ActiveFrameRefresher = activeFrameRefresher;
			ActiveFrame = activeFrame;
			IsFrameValid = true;
			IsPanelCleared = false;

			if (Visible)
			{
				InitializePanel();
			}
			else
			{
				IsDebugPanelInitialized = false;
			}
		}
Пример #3
0
        private void debugEventHandler_UpdateDebugInformation(NuGenFrameRefresher activeFrameRefresher, FrameWrapper activeFrame)
        {
            ActiveFrameRefresher = activeFrameRefresher;
            ActiveFrame          = activeFrame;
            IsFrameValid         = true;
            IsPanelCleared       = false;

            if (Visible)
            {
                InitializePanel();
            }
            else
            {
                IsDebugPanelInitialized = false;
            }
        }
Пример #4
0
 public void RaiseUpdateDebugInformation(NuGenFrameRefresher activeFrameRefresher, FrameWrapper activeFrame, DebuggerState newState)
 {
     if (invokee.InvokeRequired)
     {
         invokee.BeginInvoke(UpdateDebugInformation, new object[] { activeFrameRefresher, activeFrame });
         invokee.BeginInvoke(ShowDebuggerStateMethod, new object[] { newState });
     }
     else
     {
         UpdateDebugInformation(activeFrameRefresher, activeFrame);
         ShowDebuggerStateMethod(newState);
     }
 }
Пример #5
0
        public void DisplayCallStack(List <FrameWrapper> callStack)
        {
            if (callStack != null)
            {
                callStackView.BeginUpdate();
                callStackView.Items.Clear();

                for (int index = 0; index < callStack.Count; index++)
                {
                    FrameWrapper    frame           = callStack[index];
                    ListViewItem    item            = new ListViewItem();
                    bool            isCodeAvailable = false;
                    FunctionWrapper function        = null;

                    try
                    {
                        function        = frame.GetFunction();
                        isCodeAvailable = true;
                    }
                    catch (COMException comException)
                    {
                        //0x80131309 == CORDBG_E_CODE_NOT_AVAILABLE
                        if ((uint)comException.ErrorCode == 0x80131309)
                        {
                            isCodeAvailable = false;
                        }
                        else
                        {
                            throw;
                        }
                    }

                    if (isCodeAvailable)
                    {
                        ModuleWrapper module        = function.GetModule();
                        uint          functionToken = function.GetToken();

                        NuGenTokenBase        tokenObject      = NuGenHelperFunctions.FindObjectByToken(functionToken, module);
                        NuGenMethodDefinition methodDefinition = tokenObject as NuGenMethodDefinition;

                        if (methodDefinition != null)
                        {
                            bool activeFrame = (index == 0);
                            NuGenFrameInformation frameInformation = new NuGenFrameInformation(NuGenDebugEventHandler.Instance.EventObjects.Thread, methodDefinition, activeFrame, frame);
                            item.Tag  = frameInformation;
                            item.Text = string.Format("{0}::{1}", methodDefinition.BaseTypeDefinition.FullName, methodDefinition.DisplayName);

                            if (!frameInformation.IsExactLocation)
                            {
                                item.Text += " - not exact offset";
                            }
                        }
                        else
                        {
                            string moduleName = module.GetName();

                            if (module.IsInMemory())
                            {
                                item.Tag = new NuGenMissingModule(module);
                            }
                            else
                            {
                                item.Tag = new NuGenMissingModule(moduleName);
                            }

                            item.Text = "Unknown method (perhaps a reference is not loaded). Module name: " + moduleName;
                        }
                    }

                    if (!frame.IsILFrame())
                    {
                        if (isCodeAvailable)
                        {
                            item.Text = "Native frame, IP offset is not available (" + item.Text + ")";
                        }
                        else
                        {
                            item.Text = "Native frame, IP offset is not available (code is unavailable).";
                        }
                    }

                    item.ToolTipText = item.Text;
                    callStackView.Items.Add(item);
                }

                callStackView.EndUpdate();
            }
        }
Пример #6
0
        private void debugEventHandler_ActiveFrameChanged(NuGenFrameRefresher newActiveFrameRefresher, FrameWrapper newActiveFrame)
        {
            ActiveFrameRefresher = newActiveFrameRefresher;
            ActiveFrame          = newActiveFrame;
            IsFrameValid         = true;

            if (UpdateWhenActiveFrameChanges())
            {
                if (Visible)
                {
                    ClearPanel();
                    InitializePanel();
                }
                else
                {
                    IsPanelCleared          = false;
                    IsDebugPanelInitialized = false;
                }
            }
        }
Пример #7
0
		public void ShowObjectInObjectViewer(FrameWrapper frame, BaseValueRefresher valueRefresher, string initialExpression)
		{
			if (objectViewer == null)
			{
				objectViewer = new ObjectViewer();
			}

			objectViewer.Initialize();
			objectViewer.ShowValue(valueRefresher, frame, initialExpression);
		}
Пример #8
0
		public void FrameChangedUpdate(FrameRefresher frameRefresher, FrameWrapper frame, bool calledByWatchPanel)
		{
			DebugEventHandler.Instance.EventObjects.Frame = frame;
			DebugEventHandler.Instance.ChangeFrame(frameRefresher, DebugEventHandler.Instance.EventObjects.Frame);
		}
Пример #9
0
        private void ShowThreads()
        {
            threadsGrid.BeginGridUpdate();
            threadsGrid.ClearItems();
            List <ThreadWrapper> threads = NuGenDebugEventHandler.Instance.EventObjects.Controller.EnumerateThreads();

            foreach (ThreadWrapper thread in threads)
            {
                EvaluatedThreadName = "<no name>";
                ValueWrapper threadObject       = null;
                ValueWrapper dereferencedObject = null;

                if (!HasSearchedForNameMethod)
                {
                    threadObject = thread.GetObject();

                    if (threadObject != null && !threadObject.IsNull())
                    {
                        dereferencedObject = threadObject.DereferenceValue();

                        if (dereferencedObject != null)
                        {
                            ClassWrapper  threadClass     = dereferencedObject.GetClassInformation();
                            uint          threadTypeToken = threadClass.GetToken();
                            ModuleWrapper module          = threadClass.GetModule();

                            FindGetThreadNameMethod(threadTypeToken, module);
                        }
                    }
                }

                if (HasSearchedForNameMethod)
                {
                    if (GetThreadNameMethod == null)
                    {
                        EvaluatedThreadName = "<definition of the Thread class is not loaded>";
                    }
                    else
                    {
                        if (threadObject == null)
                        {
                            threadObject = thread.GetObject();

                            if (threadObject != null && !threadObject.IsNull())
                            {
                                dereferencedObject = threadObject.DereferenceValue();
                            }
                        }

                        if (dereferencedObject != null)
                        {
                            FrameWrapper threadActiveFrame = thread.GetActiveFrame();

                            if (threadActiveFrame != null)
                            {
                                NuGenFrameRefresher threadActiveFrameRefresher = new NuGenFrameRefresher(thread, threadActiveFrame.ChainIndex, threadActiveFrame.FrameIndex, threadActiveFrame.IsActiveFrame);

                                GetThreadName(thread, threadObject, threadActiveFrameRefresher);
                            }
                        }
                    }
                }

                GridEXRow row = threadsGrid.AddItem();

                uint       threadID = thread.GetID();
                GridEXCell idCell   = row.Cells[0];
                NuGenHelperFunctions.TaggedObjects.Add((int)idCell.Value, threadID);
                idCell.Value       = NuGenHelperFunctions.FormatNumber(threadID);
                row.Cells[1].Value = EvaluatedThreadName;

                AppDomainWrapper appDomain = thread.GetAppDomain();

                if (appDomain != null)
                {
                    row.Cells[2].Value = appDomain.GetName();
                }

                NuGenHelperFunctions.TaggedObjects.Add((String)row.Cells[1].Value + (String)row.Cells[2].Value, thread);
            }

            threadsGrid.EndGridUpdate();
        }
Пример #10
0
		public void RaiseUpdateDebugInformation(FrameRefresher activeFrameRefresher, FrameWrapper activeFrame, DebuggerState newState)
		{
			Activate();
			if (UpdateDebugInformation != null)
			{
				UpdateDebugInformation(activeFrameRefresher, activeFrame);
			}

			ShowDebuggerState(DebugEventHandler.Instance.State);
		}
Пример #11
0
 public void FrameChangedUpdate(NuGenFrameRefresher frameRefresher, FrameWrapper frame, bool calledByWatchPanel)
 {
     NuGenDebugEventHandler.Instance.EventObjects.Frame = frame;
     NuGenDebugEventHandler.Instance.ChangeFrame(frameRefresher, NuGenDebugEventHandler.Instance.EventObjects.Frame);
 }
Пример #12
0
		public void ShowValue(NuGenBaseValueRefresher valueRefresher, FrameWrapper frame, string initialExpression)
		{
			if (frame == null)
			{
				MessageBox.Show("There is no active frame and thus expressions cannot be evaluated.\n\nFrames can be changed by using the Call Stack Panel", "No active frame", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			}
			else
			{
				if (!IsHandleCreated)
				{
					CreateHandle();
				}

				objectTree.Sorted = false;

				UpdateDisplayedValue = false;
				objectTree.SelectedNode = RootNode;
				UpdateDisplayedValue = true;

				NuGenIValueFormatter rootValueFormatter = new NuGenRootValueFormatter("Viewed object");
				rootValueFormatter.ValueRefresher = valueRefresher;
				rootValueFormatter.FieldNode = RootNode;
				RootNode.Tag = rootValueFormatter;
				RootNode.Text = rootValueFormatter.Name;

				FrameRefresher = new NuGenFrameRefresher(NuGenDebugEventHandler.Instance.EventObjects.Thread, frame.ChainIndex, frame.FrameIndex, frame.IsActiveFrame);

				ProcessWrapper processWrapper = NuGenDebugEventHandler.Instance.EventObjects.Thread.GetProcess();
				NuGenEvaluationHandler evaluationHandler = new NuGenEvaluationHandler(FrameRefresher);
				EvalWrapper evalWrapper = NuGenDebugEventHandler.Instance.EventObjects.Thread.CreateEval();
				EvaluationContext = new NuGenEvaluationContext(processWrapper, evaluationHandler, evalWrapper, NuGenDebugEventHandler.Instance.EventObjects.Thread);
				ValueDisplayer = new NuGenValueDisplayer(evaluationContext);
				ValueDisplayer.ArrayElementEvaluated += new ArrayElementEvaluatedDelegate(ValueDisplayer_ArrayElementEvaluated);
				ValueDisplayer.ErrorOccurred += new ErrorOccurredDelegate(ValueDisplayer_ErrorOccurred);
				ValueDisplayer.EvaluatedNull += new EvaluatedNullDelegate(ValueDisplayer_EvaluatedNull);
				ValueDisplayer.FieldEvaluated += new FieldEvaluatedDelegate(ValueDisplayer_FieldEvaluated);
				ValueDisplayer.PropertyEvaluated += new PropertyEvaluatedDelegate(ValueDisplayer_PropertyEvaluated);
				ValueDisplayer.StateChanging += new StateChangingDelegate(ValueDisplayer_StateChanging);
				ValueDisplayer.StringValueEvaluated += new StringValueEvaluatedDelegate(ValueDisplayer_StringValueEvaluated);
				ValueDisplayer.ToStringEvaluated += new ToStringEvaluatedDelegate(ValueDisplayer_ToStringEvaluated);
				ValueDisplayer.TypeInspected += new TypeInspectedDelegate(ValueDisplayer_TypeInspected);

				if (valueRefresher != null)
				{
					DisplayValue(valueRefresher, RootNode);
				}

				fieldList.Sort();
				objectTree.Sorted = true;
				DisplayExpressionText(initialExpression);
				expressionComboBox.Update();
				ActiveControl = expressionComboBox;
				ShowDialog();
			}
		}
Пример #13
0
		public void RaiseUpdateDebugInformation(NuGenFrameRefresher activeFrameRefresher, FrameWrapper activeFrame, DebuggerState newState)
		{
            if (invokee.InvokeRequired)
            {
                invokee.BeginInvoke(UpdateDebugInformation, new object[] { activeFrameRefresher, activeFrame });
                invokee.BeginInvoke(ShowDebuggerStateMethod, new object[] { newState });
            }
            else
            {                
                UpdateDebugInformation(activeFrameRefresher, activeFrame);
                ShowDebuggerStateMethod(newState);
            }
		}
Пример #14
0
		public void FrameChangedUpdate(NuGenFrameRefresher frameRefresher, FrameWrapper frame, bool calledByWatchPanel)
		{
            if(invokee.InvokeRequired)
				invokee.Invoke(FrameChangedUpdateMethod, new object[]{frameRefresher, frame, calledByWatchPanel});
			else
				FrameChangedUpdateMethod(frameRefresher, frame, calledByWatchPanel);
		}
Пример #15
0
		public void ShowObjectInObjectViewer(FrameWrapper frame, NuGenBaseValueRefresher valueRefresher, string initialExpression)
		{
            if(invokee.InvokeRequired)
				invokee.Invoke(ShowObjectInObjectViewerMethod, new object[]{frame, valueRefresher, initialExpression});
			else
				ShowObjectInObjectViewerMethod(frame, valueRefresher, initialExpression);
		}