internal SourceStepper(RuntimeThread thread, ICorDebugStepper comStepper)
 {
     _thread = thread;
     _comStepper = comStepper;
     _comStepper.SetRangeIL(1);
     _comStepper.SetUnmappedStopMask(CorDebugUnmappedStop.STOP_NONE);
 }
        internal RuntimeFrame(RuntimeThread thread, ICorDebugFrame comFrame)
        {
            _thread = thread; 
            _comFrame = comFrame;

            if (!IsExternal)
            {
                ICorDebugFunction comFunction;
                comFrame.GetFunction(out comFunction);
                ICorDebugModule comModule;
                comFunction.GetModule(out comModule);

                var module = Session.FindModule(x => x.ComModule == comModule);
                _function = module.GetFunction(comFunction);
            }
        }
 internal RuntimeChain (RuntimeThread thread, ICorDebugChain comChain)
 {
     _comChain = comChain;
     Thread = thread;
 }
 public StepperEventArgs(RuntimeAppDomain domain, RuntimeThread thread, SourceStepper stepper)
     : base(domain, false)
 {
     Domain = domain;
     Thread = thread;
     Stepper = stepper;
 }
Ejemplo n.º 5
0
 public DebuggeeExceptionEventArgs(RuntimeAppDomain domain, RuntimeThread thread, uint offset, CorDebugExceptionCallbackType exceptionType)
     : base(domain, thread, PauseReason.Exception)
 {
     Offset        = offset;
     ExceptionType = exceptionType;
 }
Ejemplo n.º 6
0
 public BreakpointEventArgs(RuntimeAppDomain domain, RuntimeThread thread, Breakpoint breakpoint)
     : base(domain, thread, PauseReason.Break)
 {
     Breakpoint = breakpoint;
 }
Ejemplo n.º 7
0
 internal RuntimeChain(RuntimeThread thread, ICorDebugChain comChain)
 {
     _comChain = comChain;
     Thread    = thread;
 }
Ejemplo n.º 8
0
 public static RuntimeValue InvokeMethod(RuntimeThread thread, SymbolToken functionToken, params RuntimeValue[] arguments)
 {
     return(InvokeMethod(thread, functionToken.GetToken(), arguments));
 }
 internal RuntimeFrame(RuntimeFunction function, RuntimeThread thread, ICorDebugFrame comFrame)
 {
     _thread = thread;
     _function = function;
     _comFrame = comFrame;
 }
 public void CreateThread(ICorDebugAppDomain pAppDomain, ICorDebugThread thread)
 {
     var domain = GetProcessWrapper(pAppDomain).GetAppDomain(pAppDomain);
     var debuggerThread = new RuntimeThread(domain, thread);
     Log("Created thread in domain '{0}'. Id={1}, Handle={2}.", domain.Name, debuggerThread.Id, debuggerThread.Handle);
     var eventArgs = new GenericDebuggerEventArgs<RuntimeThread>(debuggerThread, domain);
     domain.DispatchThreadCreatedEvent(eventArgs);
     FinalizeEvent(eventArgs);
 }
Ejemplo n.º 11
0
 internal RuntimeFrame(RuntimeFunction function, RuntimeThread thread, ICorDebugFrame comFrame)
 {
     _thread   = thread;
     _function = function;
     _comFrame = comFrame;
 }
        public RuntimeValue CallMemberFunction(RuntimeThread thread, SymbolToken token, params RuntimeValue[] arguments)
        {
            ICorDebugFunction comFunction;
            ComObjectValue.GetVirtualMethod((uint)token.GetToken(), out comFunction);

            var evaluation = thread.CreateEvaluation();
            evaluation.Call(comFunction, arguments.GetComValues().ToArray());

            if (evaluation.WaitForResult(1000))
                return evaluation.Result;

            throw new TimeoutException("Evaluation timed out.");
        }
        public RuntimeValue GetFieldValue(RuntimeThread thread, SymbolToken token)
        {
            // TODO: static members

            if (!IsObject)
                throw new InvalidOperationException("Value must be an object in order to get values of fields.");

            RuntimeValue value;
            if (!_fieldValues.TryGetValue(token, out value))
            {
                ICorDebugValue comValue;
                ComObjectValue.GetFieldValue(Type.Class.ComClass, (uint)token.GetToken(), out comValue);
                _fieldValues.Add(token, value = new RuntimeValue(Session, comValue));
            }
            return value;
        }
        public string ValueAsString(RuntimeThread thread)
        {
            if (IsNull)
                return "null";

            if (IsReference)
                return Dereference().ValueAsString(thread);
            if (IsString)
                return GetStringValue();
            if (IsArray)
                return string.Format("{0}[{1}]", GetArrayElementType(), string.Join(",", GetArrayDimensions()));
            if (IsObject)
            {
                if (DebuggerBase.Instance.Settings.GetValue<bool>("Visualizers.EnableFunctionEvaluation"))
                {
                    var type = Type;
                    while (type != null)
                    {
                        var module = Session.AssemblyResolver.ResolveModule(type.Class.Module.Name);
                        if (module != null)
                        {
                            var resolvedType = module.ResolveMember(type.Class.Token.GetToken()) as ITypeDefinition;
                            if (resolvedType != null)
                            {
                                var toStringMethod = resolvedType.FindMethod("ToString");
                                if (toStringMethod != null)
                                {
                                    var value = RuntimeEvaluation.InvokeMethod(thread, type.Class.Module.GetFunction((uint)toStringMethod.MetaDataToken));
                                    if (value != null)
                                        return value.ValueAsString(thread);
                                }
                            }
                        }
                        type = type.BaseType;
                    }
                }
                return "{" + Type.ToString() + "}";
            }

            var primitive = GetPrimitiveValue();
            if (primitive == null)
                return "null";
            return primitive.ToString();
        }