예제 #1
0
        internal StackFrame(Thread thread, ICorDebugILFrame corILFrame, uint chainIndex, uint frameIndex)
        {
            this.process = thread.Process;
            this.thread = thread;
            this.appDomain = process.AppDomains[corILFrame.GetFunction().GetClass().GetModule().GetAssembly().GetAppDomain()];
            this.corILFrame = corILFrame;
            this.corILFramePauseSession = process.PauseSession;
            this.corFunction = corILFrame.GetFunction();
            this.chainIndex = chainIndex;
            this.frameIndex = frameIndex;

            MetaDataImport metaData = thread.Process.Modules[corFunction.GetClass().GetModule()].MetaData;
            int methodGenArgs = metaData.EnumGenericParams(corFunction.GetToken()).Length;
            // Class parameters are first, then the method ones
            List<ICorDebugType> corGenArgs = ((ICorDebugILFrame2)corILFrame).EnumerateTypeParameters().ToList();
            // Remove method parametrs at the end
            corGenArgs.RemoveRange(corGenArgs.Count - methodGenArgs, methodGenArgs);
            List<DebugType> genArgs = new List<DebugType>(corGenArgs.Count);
            foreach(ICorDebugType corGenArg in corGenArgs) {
                genArgs.Add(DebugType.CreateFromCorType(this.AppDomain, corGenArg));
            }

            DebugType debugType = DebugType.CreateFromCorClass(
                this.AppDomain,
                null,
                corFunction.GetClass(),
                genArgs.ToArray()
            );
            this.methodInfo = (DebugMethodInfo)debugType.GetMember(corFunction.GetToken());
        }
        public static IMethod Import(this ICompilation compilation, ICorDebugFunction corFunction)
        {
            Module module = compilation.GetAppDomain().Process.GetModule(corFunction.GetModule());

            if (module.IsDynamic || module.IsInMemory)
            {
                return(module.Assembly.GetTypeDefinition("", "UnknownDynamicType").Methods.First());
            }
            var  info             = GetInfo(module.Assembly);
            uint functionToken    = corFunction.GetToken();
            var  unresolvedMethod = info.GetMethodFromToken(functionToken);

            if (unresolvedMethod == null)
            {
                // The type containing this function wasn't loaded yet
                uint classToken = corFunction.GetClass().GetToken();
                var  definition = ToTypeDefinitionReference(module, classToken).Resolve(new SimpleTypeResolveContext(module.Assembly)).GetDefinition();
                if (definition == null)
                {
                    throw new InvalidOperationException("Could not find class for token " + classToken);
                }
                definition.Methods.ToList();                 // enforce loading the methods so that they get added to the dictionary
                unresolvedMethod = info.GetMethodFromToken(functionToken);
                if (unresolvedMethod == null)
                {
                    throw new InvalidOperationException("Could not find function with token " + functionToken);
                }
            }
            return(unresolvedMethod.Resolve(new SimpleTypeResolveContext(module.Assembly)));
        }
예제 #3
0
        public static SourcecodeSegment ResolveForIL(Module module, ICorDebugFunction corFunction, int line, int offset, int[] ranges)
        {
            if (ranges == null)
            {
                return(null);                // this would lead to a catched exception and the same result
            }
            try {
                SourcecodeSegment segment = new SourcecodeSegment();
                segment.module      = module;
                segment.typename    = null;
                segment.checkSum    = null;
                segment.startLine   = line;
                segment.startColumn = 0;
                segment.endLine     = line;
                segment.endColumn   = 0;
                segment.corFunction = corFunction;
                segment.ilStart     = offset;
                segment.ilEnd       = ranges[1];
                segment.stepRanges  = ranges;

                return(segment);
            } catch {
                return(null);
            }
        }
예제 #4
0
 public FunctionRemapCompleteDebugCallbackEventArgs(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction)
     : base(pAppDomain)
 {
     AppDomain = pAppDomain;
     Thread    = pThread;
     Function  = pFunction;
 }
예제 #5
0
        internal StackFrame(Thread thread, ICorDebugILFrame corILFrame, uint chainIndex, uint frameIndex)
        {
            this.process                = thread.Process;
            this.thread                 = thread;
            this.appDomain              = process.AppDomains[corILFrame.GetFunction().GetClass().GetModule().GetAssembly().GetAppDomain()];
            this.corILFrame             = corILFrame;
            this.corILFramePauseSession = process.PauseSession;
            this.corFunction            = corILFrame.GetFunction();
            this.chainIndex             = chainIndex;
            this.frameIndex             = frameIndex;

            MetaDataImport metaData      = thread.Process.Modules[corFunction.GetClass().GetModule()].MetaData;
            int            methodGenArgs = metaData.EnumGenericParams(corFunction.GetToken()).Length;
            // Class parameters are first, then the method ones
            List <ICorDebugType> corGenArgs = ((ICorDebugILFrame2)corILFrame).EnumerateTypeParameters().ToList();

            // Remove method parametrs at the end
            corGenArgs.RemoveRange(corGenArgs.Count - methodGenArgs, methodGenArgs);
            List <DebugType> genArgs = new List <DebugType>(corGenArgs.Count);

            foreach (ICorDebugType corGenArg in corGenArgs)
            {
                genArgs.Add(DebugType.CreateFromCorType(this.AppDomain, corGenArg));
            }

            DebugType debugType = DebugType.CreateFromCorClass(
                this.AppDomain,
                null,
                corFunction.GetClass(),
                genArgs.ToArray()
                );

            this.methodInfo = (DebugMethodInfo)debugType.GetMember(corFunction.GetToken());
        }
예제 #6
0
 public EditAndContinueRemapDebugCallbackEventArgs(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction, int fAccurate)
     : base(pAppDomain)
 {
     AppDomain = pAppDomain;
     Thread    = pThread;
     Function  = pFunction;
     Accurate  = fAccurate != 0;
 }
예제 #7
0
        int ICorDebugObjectValue.GetVirtualMethod(uint memberRef, out ICorDebugFunction ppFunction)
        {
            uint mdVirtual = Engine.GetVirtualMethod(nanoCLR_TypeSystem.ClassMemberIndexFromCLRToken(memberRef, m_class.Assembly), _rtv);

            ppFunction = nanoCLR_TypeSystem.CorDebugFunctionFromMethodIndex(mdVirtual, _appDomain);

            return(COM_HResults.S_OK);
        }
 public virtual void EditAndContinueRemap(
     ICorDebugAppDomain appDomain, 
     ICorDebugThread thread, 
     ICorDebugFunction function, 
     bool accurate)
 {
     this.DefaultHandler(appDomain);
 }
예제 #9
0
 public FunctionRemapOpportunityDebugCallbackEventArgs(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
     : base(pAppDomain)
 {
     AppDomain   = pAppDomain;
     Thread      = pThread;
     OldFunction = pOldFunction;
     NewFunction = pNewFunction;
     OldILOffset = oldILOffset;
 }
예제 #10
0
 public virtual void FunctionRemapOpportunity(
     ICorDebugAppDomain pAppDomain,
     ICorDebugThread pThread,
     ICorDebugFunction pOldFunction,
     ICorDebugFunction pNewFunction,
     uint oldILOffset)
 {
     pAppDomain.Continue(0);
 }
예제 #11
0
        internal RuntimeFunction GetFunction(ICorDebugFunction comFunction)
        {
            RuntimeFunction function;

            if (!_cachedFunctions.TryGetValue(comFunction, out function))
            {
                _cachedFunctions.Add(comFunction, function = new RuntimeFunction(this, comFunction));
            }
            return(function);
        }
예제 #12
0
 void ICorDebugManagedCallback2.FunctionRemapComplete(
     ICorDebugAppDomain appDomain,
     ICorDebugThread thread,
     ICorDebugFunction managedFunction)
 {
     if (DebugOutput)
     {
         Console.WriteLine("info: FunctionRemapComplete2");
     }
     appDomain.Continue(0);
 }
        public CorFunction(ICorDebugFunction funtion)
        {
            corFunction = funtion;
            ICorDebugModule imodule = null;
            corFunction.GetModule(out imodule);
            module = new CorModule(imodule);
            corFunction.GetToken(out token);
            //corFunction.GetLocalVarSigToken(
            //ICorDebugFunctionBreakpoint breakPoint = null;

            //corFunction.
        }
예제 #14
0
        /// <summary>
        /// Finds appropriete SequncePointMap instances and builds SequencePointRemapper, gets new IL offset and call RemapFunction.
        /// </summary>
        public void FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
        {
            ICorDebugILFrame2 frame = (ICorDebugILFrame2) pThread.GetActiveFrame();

            uint nToken = pOldFunction.GetToken();

            SequencePointRemapper remapper;
            if(!remappers.TryGetValue(nToken,out remapper)){
                throw new KeyNotFoundException("Methods sequence points not found.");
            }
            frame.__RemapFunction(remapper.TranslateILOffset(oldILOffset));
        }
예제 #15
0
 void ICorDebugManagedCallback.EditAndContinueRemap(
     ICorDebugAppDomain appDomain,
     ICorDebugThread thread,
     ICorDebugFunction managedFunction,
     int isAccurate)
 {
     if (DebugOutput)
     {
         Console.WriteLine("info: EditAndContinueRemap");
     }
     appDomain.Continue(0);
 }
예제 #16
0
        int ICorDebugObjectValue.GetVirtualMethod(uint memberRef, out ICorDebugFunction ppFunction)
        {
            var getVirtualMethod = Engine.GetVirtualMethodAsync(nanoCLR_TypeSystem.ClassMemberIndexFromCLRToken(memberRef, this.m_class.Assembly), this.m_rtv);

            getVirtualMethod.Wait();

            uint mdVirtual = getVirtualMethod.Result;

            ppFunction = nanoCLR_TypeSystem.CorDebugFunctionFromMethodIndex(mdVirtual, this.m_appDomain);

            return(COM_HResults.S_OK);
        }
예제 #17
0
 void ICorDebugManagedCallback2.FunctionRemapOpportunity(
     ICorDebugAppDomain appDomain,
     ICorDebugThread thread,
     ICorDebugFunction oldFunction,
     ICorDebugFunction newFunction,
     uint oldILoffset)
 {
     if (DebugOutput)
     {
         Console.WriteLine("info: FunctionRemapOpportunity2");
     }
     appDomain.Continue(0);
 }
예제 #18
0
 public void SetBreakpoint(Module module)
 {
     foreach (var symbolSource in module.Process.Debugger.SymbolSources)
     {
         foreach (var seq in symbolSource.GetSequencePoints(module, this.FileName, this.Line, this.Column))
         {
             ICorDebugFunction           corFunction   = module.CorModule.GetFunctionFromToken(seq.MethodDefToken);
             ICorDebugFunctionBreakpoint corBreakpoint = corFunction.GetILCode().CreateBreakpoint((uint)seq.ILOffset);
             corBreakpoint.Activate(enabled ? 1 : 0);
             corBreakpoints.Add(corBreakpoint);
         }
     }
 }
예제 #19
0
        public CorType GetVirtualMethodAndType(int memberToken, out CorFunction managedFunction)
        {
            ICorDebugType     dt    = null;
            ICorDebugFunction pfunc = null;

            (m_objVal as ICorDebugObjectValue2).GetVirtualMethodAndType((uint)memberToken, out pfunc, out dt);
            if (pfunc == null)
            {
                managedFunction = null;
            }
            else
            {
                managedFunction = new CorFunction(pfunc);
            }
            return(dt == null ? null : new CorType(dt));
        }
        public static IMethod Import(this ICompilation compilation, ICorDebugFunction corFunction, List <ICorDebugType> typeArgs)
        {
            IMethod definition = Import(compilation, corFunction);

            if (typeArgs == null || typeArgs.Count == 0)
            {
                return(definition);
            }
            int classTPC = definition.DeclaringTypeDefinition.TypeParameterCount;

            IType[] classTPs  = typeArgs.Take(classTPC).Select(t => compilation.Import(t)).ToArray();
            IType[] methodTPs = null;
            if (definition.TypeParameters.Count > 0)
            {
                methodTPs = typeArgs.Skip(classTPC).Select(t => compilation.Import(t)).ToArray();
            }
            return(new SpecializedMethod(definition, new TypeParameterSubstitution(classTPs, methodTPs)));
        }
예제 #21
0
        internal Function(Thread thread, FrameID frameID, ICorDebugILFrame corILFrame)
        {
            this.process    = thread.Process;
            this.thread     = thread;
            this.frameID    = frameID;
            this.CorILFrame = corILFrame;
            corFunction     = corILFrame.Function;
            module          = process.GetModule(corFunction.Module);

            methodProps = module.MetaData.GetMethodProps(corFunction.Token);

            // Force some callback when function steps out so that we can expire it
            stepOutStepper = new Stepper(this, "Function Tracker");
            stepOutStepper.StepOut();
            stepOutStepper.PauseWhenComplete = false;

            process.TraceMessage("Function " + this.ToString() + " created");
        }
예제 #22
0
        int ICorDebugEval.NewObject(ICorDebugFunction pConstructor, uint nArgs, ICorDebugValue[] ppArgs)
        {
            Debug.Assert(nArgs == ppArgs.Length);

            CorDebugFunction f = (CorDebugFunction)pConstructor;
            CorDebugClass    c = f.Class;

            this.Process.SetCurrentAppDomain(this.AppDomain);
            Engine.AllocateObject(GetScratchPadLocation(), c.TypeDef_Index);

            ICorDebugValue[] args = new ICorDebugValue[nArgs + 1];

            args[0] = GetResultValue();
            ppArgs.CopyTo(args, 1);
            ((ICorDebugEval)this).CallFunction(pConstructor, (uint)args.Length, args);

            return(Utility.COM_HResults.S_OK);
        }
예제 #23
0
        internal StackFrame(Thread thread, ICorDebugILFrame corILFrame, uint chainIndex, uint frameIndex)
        {
            this.process                = thread.Process;
            this.thread                 = thread;
            this.corILFrame             = corILFrame;
            this.corILFramePauseSession = process.PauseSession;
            this.corFunction            = corILFrame.Function;
            this.chainIndex             = chainIndex;
            this.frameIndex             = frameIndex;

            DebugType debugType = DebugType.Create(
                this.Process,
                corFunction.Class,
                corILFrame.CastTo <ICorDebugILFrame2>().EnumerateTypeParameters().ToList().ToArray()
                );

            this.methodInfo = debugType.GetMethod(corFunction.Token);
        }
예제 #24
0
        /// <summary>
        /// Get a method from a managed type, method name and argument count
        /// </summary>
        public static MethodInfo GetFromName(Process process, System.Type type, string name, int paramCount)
        {
            if (type.IsNested)
            {
                throw new DebuggerException("Not implemented for nested types");
            }
            if (type.IsGenericType)
            {
                throw new DebuggerException("Not implemented for generic types");
            }
            if (type.IsGenericParameter)
            {
                throw new DebuggerException("Type can not be generic parameter");
            }

            foreach (Module module in process.Modules)
            {
                TypeDefProps typeDefProps;
                try
                {
                    typeDefProps = module.MetaData.FindTypeDefByName(type.FullName, 0 /* enclosing class for nested */);
                }
                catch
                {
                    continue;
                }
                foreach (MethodProps methodProps in module.MetaData.EnumMethodsWithName(typeDefProps.Token, name))
                {
                    if (module.MetaData.GetParamCount(methodProps.Token) == paramCount)
                    {
                        ICorDebugFunction corFunction = module.CorModule.GetFunctionFromToken(methodProps.Token);
                        ICorDebugClass2   corClass    = corFunction.Class.As <ICorDebugClass2>();
                        ICorDebugType     corType     = corClass.GetParameterizedType(type.IsValueType ? (uint)CorElementType.VALUETYPE : (uint)CorElementType.CLASS,
                                                                                      0,
                                                                                      new ICorDebugType[] {});
                        return(new MethodInfo(DebugType.Create(process, corType), methodProps));
                    }
                }
            }
            throw new DebuggerException("Not found");
        }
예제 #25
0
        public void RunTo(string fileName, int line, int column)
        {
            foreach (var symbolSource in this.Debugger.SymbolSources)
            {
                foreach (Module module in this.Modules)
                {
                    // Note the we might get multiple matches
                    foreach (SequencePoint seq in symbolSource.GetSequencePoints(module, fileName, line, column))
                    {
                        ICorDebugFunction           corFunction   = module.CorModule.GetFunctionFromToken(seq.MethodDefToken);
                        ICorDebugFunctionBreakpoint corBreakpoint = corFunction.GetILCode().CreateBreakpoint((uint)seq.ILOffset);
                        corBreakpoint.Activate(1);
                        this.tempBreakpoints.Add(corBreakpoint);

                        if (this.IsPaused)
                        {
                            AsyncContinue();
                        }
                    }
                }
            }
        }
예제 #26
0
            public void EditAndContinueRemap(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction, int fAccurate)
            {
                try
                {
                    _EnterCallback();

                    _CallbackNotImplemented();

                    _CallbackEvent("EditAndContinueRemap");
                }
                catch (Exception e)
                {
                    _CallbackException(e);
                }
            }
예제 #27
0
            public void FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction)
            {
                try
                {
                    _EnterCallback();

                    _CallbackNotImplemented();

                    _CallbackEvent("FunctionRemapComplete");
                }
                catch (Exception e)
                {
                    _CallbackException(e);
                }
            }
 public virtual void FunctionRemapOpportunity(
     ICorDebugAppDomain appDomain, 
     ICorDebugThread thread, 
     ICorDebugFunction oldFunction, 
     ICorDebugFunction newFunction, 
     int oldIlOffset)
 {
     this.DefaultHandler(appDomain);
 }
예제 #29
0
        int ICorDebugEval.CallFunction(ICorDebugFunction pFunction, uint nArgs, ICorDebugValue[] ppArgs)
        {
            try
            {
                //CreateThread will cause a thread create event to occur.  This is a virtual thread, so
                //we need to suspend processing of tinyclr commands until we have created the thread ourselves
                //and the processing of a new virtual thread will be ignored.
                Process.SuspendCommands(true);

                //need to flush the breakpoints in case new breakpoints were waiting until process was resumed.
                Process.UpdateBreakpoints();

                Debug.Assert(nArgs == ppArgs.Length);
                Debug.Assert(Process.IsExecutionPaused);

                CorDebugFunction function = (CorDebugFunction)pFunction;

                uint md = function.MethodDef_Index;
                if (function.IsVirtual && function.IsInstance)
                {
                    Debug.Assert(nArgs > 0);
                    md = this.Engine.GetVirtualMethod(function.MethodDef_Index, ((CorDebugValue)ppArgs[0]).RuntimeValue);
                }

                this.Process.SetCurrentAppDomain(this.AppDomain);
                //Send the selected thread ID to the device so calls that use Thread.CurrentThread work as the user expects.
                uint pid = this.Engine.CreateThread(md, GetScratchPadLocation(), m_threadReal.ID);

                if (pid == uint.MaxValue)
                {
                    throw new ArgumentException("TinyCLR cannot call this function.  Possible reasons include: ByRef arguments not supported");
                }

                //If anything below fails, we need to clean up by killing the thread
                if (nArgs > 0)
                {
                    RuntimeValue[] args = this.Engine.GetStackFrameValueAll(pid, 0, function.NumArg, Engine.StackValueKind.Argument);

                    for (int iArg = 0; iArg < nArgs; iArg++)
                    {
                        CorDebugValue valSrc = (CorDebugValue)ppArgs[iArg];
                        CorDebugValue valDst = CorDebugValue.CreateValue(args[iArg], m_appDomain);

                        if (valDst.RuntimeValue.Assign(valSrc.RuntimeValue) == null)
                        {
                            throw new ArgumentException("TinyCLR cannot set argument " + iArg);
                        }
                    }
                }

                m_threadVirtual = new CorDebugThread(this.Process, pid, this);
                m_threadReal.AttachVirtualThread(m_threadVirtual);
                Debug.Assert(!m_fActive);
                m_fActive = true;

                //It is possible that a hard breakpoint is hit, the first line of the function
                //to evaluate.  If that is the case, than breakpoints need to be drained so the
                //breakpoint event is fired, to avoid a race condition, where cpde resumes
                //execution to start the function eval before it gets the breakpoint event
                //This is primarily due to the difference in behavior of the TinyCLR and the desktop.
                //In the desktop, the hard breakpoint will not get hit until execution is resumed.
                //The TinyCLR can hit the breakpoint during the Thread_Create call.

                Process.DrainBreakpoints();
            }
            finally
            {
                Process.SuspendCommands(false);
            }

            return(Utility.COM_HResults.S_OK);
        }
		public void FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
		{
			ManagedCallback managedCallback = GetProcessCallbackInterface("FunctionRemapOpportunity", pAppDomain);
			if (managedCallback != null) {
				managedCallback.FunctionRemapOpportunity(pAppDomain, pThread, pOldFunction, pNewFunction, oldILOffset);
			}
		}
 public static void CallFunction(this ICorDebugEval instance, ICorDebugFunction pFunction, uint nArgs, ICorDebugValue[] ppArgs)
 {
     instance.__CallFunction(pFunction, nArgs, ppArgs);
 }
예제 #32
0
 void ICorDebugManagedCallback.EditAndContinueRemap(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction, int fAccurate)
 {
     // TODO HandleEvent(ManagedCallbackType.On new CorEventArgs(new CorAppDomain(pAppDomain)));
 }
예제 #33
0
 int ICorDebugEval2.NewParameterizedObject(ICorDebugFunction pConstructor, uint nTypeArgs, ICorDebugType[] ppTypeArgs, uint nArgs, ICorDebugValue[] ppArgs)
 {
     return(((ICorDebugEval)this).NewObject(pConstructor, nArgs, ppArgs));
 }
		public void EditAndContinueRemap(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction, int fAccurate)
		{
			ManagedCallback managedCallback = GetProcessCallbackInterface("EditAndContinueRemap", pAppDomain);
			if (managedCallback != null) {
				managedCallback.EditAndContinueRemap(pAppDomain, pThread, pFunction, fAccurate);
			}
		}
 public static void CallParameterizedFunction(this ICorDebugEval2 instance, ICorDebugFunction pFunction, uint nTypeArgs, ICorDebugType[] ppTypeArgs, uint nArgs, ICorDebugValue[] ppArgs)
 {
     instance.__CallParameterizedFunction(pFunction, nTypeArgs, ppTypeArgs, nArgs, ppArgs);
 }
예제 #36
0
 void ICorDebugManagedCallback2.FunctionRemapOpportunity(ICorDebugAppDomain appDomain,
                                                                ICorDebugThread thread,
                                                                ICorDebugFunction oldFunction,
                                                                ICorDebugFunction newFunction,
                                                                uint oldILoffset)
 {
     HandleEvent(ManagedCallbackType.OnFunctionRemapOpportunity,
                               new CorFunctionRemapOpportunityEventArgs(appDomain == null ? null : new CorAppDomain(appDomain),
                                                                        thread == null ? null : new CorThread(thread),
                                                                        oldFunction == null ? null : new CorFunction(oldFunction),
                                                                        newFunction == null ? null : new CorFunction(newFunction),
                                                                        (int)oldILoffset,
                                                                        ManagedCallbackType.OnFunctionRemapOpportunity));
 }
        int ICorDebugFunctionBreakpoint.GetFunction(out ICorDebugFunction ppFunction)
        {
            ppFunction = m_function;

            return(COM_HResults.S_OK);
        }
예제 #38
0
		public EditAndContinueRemapDebugCallbackEventArgs(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction, int fAccurate)
			: base(pAppDomain) {
			this.AppDomain = pAppDomain;
			this.Thread = pThread;
			this.Function = pFunction;
			this.Accurate = fAccurate != 0;
		}
예제 #39
0
            public void FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
            {
                try
                {
                    _EnterCallback();

                    _CallbackNotImplemented();

                    _CallbackEvent("FunctionRemapOpportunity");
                }
                catch (Exception e)
                {
                    _CallbackException(e);
                }
            }
예제 #40
0
 void ICorDebugManagedCallback2.FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction)
 {
     // TODO HandleEvent(<new CorEventArgs(new CorAppDomain(pAppDomain)));
 }
        public void FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);

            if (managedCallback != null)
            {
                managedCallback.FunctionRemapOpportunity(pAppDomain, pThread, pOldFunction, pNewFunction, oldILOffset);
            }
        }
예제 #42
0
 int ICorDebugEval2.CallParameterizedFunction(ICorDebugFunction pFunction, uint nTypeArgs, ICorDebugType[] ppTypeArgs, uint nArgs, ICorDebugValue[] ppArgs)
 {
     return(((ICorDebugEval)this).CallFunction(pFunction, nArgs, ppArgs));
 }
예제 #43
0
파일: Thread.cs 프로젝트: Orvid/Cosmos
 internal CorFunction(ICorDebugFunction managedFunction)
     : base(managedFunction)
 {
     m_function = managedFunction;
 }
예제 #44
0
		public void EditAndContinueRemap(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction, int fAccurate)
		{
			EnterCallback("EditAndContinueRemap", pThread);

			ExitCallback();
		}
예제 #45
0
            void ICorDebugManagedCallback2.FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
            {
                var ev = new CorEventArgs(new CorAppDomain(pAppDomain, p_options));

                GetOwner(ev.Controller).DispatchEvent(ev);

                FinishEvent(ev);
            }
예제 #46
0
		public void FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
		{
			EnterCallback("FunctionRemapOpportunity", pThread);
			
			ExitCallback();
		}
 internal RuntimeFunction(RuntimeModule module, ICorDebugFunction comFunction)
 {
     _module = module;
     _comFunction = comFunction;
     
 }
		public void FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction)
		{
			ManagedCallback managedCallback = GetProcessCallbackInterface("FunctionRemapComplete", pAppDomain);
			if (managedCallback != null) {
				managedCallback.FunctionRemapComplete(pAppDomain, pThread, pFunction);
			}
		}
예제 #49
0
 public DebugFunction(ICorDebugFunction function)
 {
     _function = function;
 }
예제 #50
0
 public void EditAndContinueRemap(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction, int fAccurate)
 {
     pAppDomain.Continue(0);
 }
예제 #51
0
		public void FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction)
		{
			EnterCallback("FunctionRemapComplete", pThread);
			
			ExitCallback();
		}
예제 #52
0
 public void FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction)
 {
     pAppDomain.Continue(0);
 }
예제 #53
0
 internal CorFunction(ICorDebugFunction managedFunction)
     : base(managedFunction)
 {
     m_function = managedFunction;
 }
예제 #54
0
 public void FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
 {
     pAppDomain.Continue(0);
 }
예제 #55
0
		public FunctionRemapOpportunityDebugCallbackEventArgs(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
			: base(pAppDomain) {
			this.AppDomain = pAppDomain;
			this.Thread = pThread;
			this.OldFunction = pOldFunction;
			this.NewFunction = pNewFunction;
			this.OldILOffset = oldILOffset;
		}
 public virtual void FunctionRemapComplete(
     ICorDebugAppDomain appDomain, 
     ICorDebugThread thread, 
     ICorDebugFunction function)
 {
     this.DefaultHandler(appDomain);
 }
예제 #57
0
 void ICorDebugManagedCallback.EditAndContinueRemap(
                                  ICorDebugAppDomain appDomain,
                                  ICorDebugThread thread,
                                  ICorDebugFunction managedFunction,
                                  int isAccurate)
 {
     Debug.Assert(false); //OBSOLETE callback
 }
예제 #58
0
		public FunctionRemapCompleteDebugCallbackEventArgs(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction)
			: base(pAppDomain) {
			this.AppDomain = pAppDomain;
			this.Thread = pThread;
			this.Function = pFunction;
		}
예제 #59
0
 void ICorDebugManagedCallback2.FunctionRemapComplete(ICorDebugAppDomain appDomain,
                                                      ICorDebugThread thread,
                                                      ICorDebugFunction managedFunction)
 {
     HandleEvent(ManagedCallbackType.OnFunctionRemapComplete,
                        new CorFunctionRemapCompleteEventArgs(appDomain == null ? null : new CorAppDomain(appDomain),
                                               thread == null ? null : new CorThread(thread),
                                               managedFunction == null ? null : new CorFunction(managedFunction),
                                               ManagedCallbackType.OnFunctionRemapComplete));
 }
예제 #60
0
		// Returns true if found
		internal bool GetFunctionAndOffset(Module module, bool normailize, out ICorDebugFunction function, out int ilOffset)
		{
			function = null;
			ilOffset = 0;
			
			ISymUnmanagedReader symReader = module.SymReader;
			if (symReader == null) {
				return false; // No symbols
			}
			
			ISymUnmanagedDocument symDoc = null;
			symDoc = symReader.GetDocument(SourceFullFilename, Guid.Empty, Guid.Empty, Guid.Empty);
			if (symDoc == null) {
				return false; // Does not use source file
			}
			
			uint validLine;
			try {
				validLine = symDoc.FindClosestLine((uint)StartLine);
			} catch {
				return false; // Not on a vaild point
			}
			if (validLine != StartLine && normailize) {
				StartLine = (int)validLine;
				EndLine = (int)validLine;
				StartColumn = 0;
				EndColumn = 0;
			}
			
			ISymUnmanagedMethod symMethod;
			try {
				symMethod = symReader.GetMethodFromDocumentPosition(symDoc, validLine, 0);
			} catch {
				return false; //Not found
			}
			
			// Check that StartLine is within the method
			uint start = uint.MaxValue;
			uint end = uint.MinValue;
			foreach(SequencePoint sqPoint in symMethod.SequencePoints) {
				if (sqPoint.Line == 0xFEEFEE) continue;
				start = Math.Min(start, sqPoint.Line);
				end = Math.Max(end, sqPoint.EndLine);
			}
			if (StartLine < start || StartLine > end) return false;
			
			function = module.CorModule.GetFunctionFromToken(symMethod.Token);
			ilOffset = (int)symMethod.GetOffset(symDoc, validLine, 0);
			return true;
		}