コード例 #1
0
        private void GetThreadName(ThreadWrapper threadWrapper, ValueWrapper threadObject, NuGenFrameRefresher threadActiveFrameRefresher)
        {
            List <ModuleWrapper> modules = threadWrapper.FindModulesByName(GetThreadNameMethod.BaseTypeDefinition.ModuleScope.Assembly.FileName);

            if (modules.Count == 1)
            {
                ModuleWrapper       module = modules[0];
                FunctionWrapper     getThreadNameFunction = module.GetFunction(GetThreadNameMethod.Token);
                List <ValueWrapper> arguments             = new List <ValueWrapper>(1);
                arguments.Add(threadObject);

                NuGenEvaluationHandler    methodCaller     = new NuGenEvaluationHandler(threadActiveFrameRefresher);
                NuGenBaseEvaluationResult evaluationResult = methodCaller.CallFunction(getThreadNameFunction, arguments);

                if (evaluationResult.IsSuccessful)
                {
                    if (evaluationResult.Result != null && (CorElementType)evaluationResult.Result.ElementType == CorElementType.ELEMENT_TYPE_STRING)
                    {
                        ValueWrapper dereferencedResult = evaluationResult.Result.DereferenceValue();

                        if (dereferencedResult != null)
                        {
                            EvaluatedThreadName = NuGenHelperFunctions.ShowEscapeCharacters(dereferencedResult.GetStringValue(), true);
                        }
                    }
                }
            }
        }
コード例 #2
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();
            }
        }
コード例 #3
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();
			}
		}
コード例 #4
0
		private void GetThreadName(ThreadWrapper threadWrapper, ValueWrapper threadObject, NuGenFrameRefresher threadActiveFrameRefresher)
		{
			List<ModuleWrapper> modules = threadWrapper.FindModulesByName(GetThreadNameMethod.BaseTypeDefinition.ModuleScope.Assembly.FileName);

			if (modules.Count == 1)
			{
				ModuleWrapper module = modules[0];
				FunctionWrapper getThreadNameFunction = module.GetFunction(GetThreadNameMethod.Token);
				List<ValueWrapper> arguments = new List<ValueWrapper>(1);
				arguments.Add(threadObject);

				NuGenEvaluationHandler methodCaller = new NuGenEvaluationHandler(threadActiveFrameRefresher);
				NuGenBaseEvaluationResult evaluationResult = methodCaller.CallFunction(getThreadNameFunction, arguments);

				if (evaluationResult.IsSuccessful)
				{
					if (evaluationResult.Result != null && (CorElementType)evaluationResult.Result.ElementType == CorElementType.ELEMENT_TYPE_STRING)
					{
						ValueWrapper dereferencedResult = evaluationResult.Result.DereferenceValue();

						if (dereferencedResult != null)
						{
							EvaluatedThreadName = NuGenHelperFunctions.ShowEscapeCharacters(dereferencedResult.GetStringValue(), true);
						}
					}
				}
			}
		}