예제 #1
0
        public MetaDataImport (CorDebugAssembly assembly)
        {
            m_assembly = assembly;
            m_engine = m_assembly.Process.Engine;
            m_guidModule = Guid.NewGuid ();
            m_alEnums = new ArrayList();

            byte[] fakeSig = new byte[] { (byte)CorCallingConvention.IMAGE_CEE_CS_CALLCONV_DEFAULT, 0x0 /*count of params*/, (byte)CorElementType.ELEMENT_TYPE_VOID};
            m_cbFakeSig = fakeSig.Length;
            m_fakeSig = Marshal.AllocCoTaskMem (m_cbFakeSig);
            Marshal.Copy (fakeSig, 0, m_fakeSig, m_cbFakeSig);
        }
예제 #2
0
        public PropertyValueReference(EvaluationContext ctx, PropertyDefinition prop, CorValRef thisobj, CorDebugType declaringType, CorValRef[] index)
            : base(ctx)
        {
            this.prop          = prop;
            this.declaringType = declaringType;
            this.module        = declaringType.Class.Assembly;
            this.index         = index;
            if (!prop.GetMethod.IsStatic)
            {
                this.thisobj = thisobj;
            }

            flags = GetFlags(prop);

            loader = delegate {
                return(((CorValRef)Value).Val);
            };
        }
예제 #3
0
 protected abstract int OnUnloadAssembly(CorDebugAppDomain pAppDomain, CorDebugAssembly pAssembly);
 protected override unsafe int OnUnloadAssembly(CorDebugAppDomain pAppDomain, CorDebugAssembly pAssembly)
 {
     UnloadAssembly?.Invoke(this, pAppDomain, pAssembly);
     return(Continue());
 }
예제 #5
0
 int ICorDebugManagedCallback.UnloadAssembly(CorDebugAppDomain pAppDomain, CorDebugAssembly pAssembly)
 {
     assemblies.Remove(pAssembly);
     return(0);
 }
예제 #6
0
        int ICorDebugManagedCallback.LoadAssembly(CorDebugAppDomain pAppDomain, CorDebugAssembly pAssembly)
        {
            assemblies.Add(pAssembly);

            //CorMetadataImport mi = new CorMetadataImport(pAssembly);

            //Seems like this is always set on MicroFramework
            //pAssembly. JITCompilerFlags = CorDebugJITCompilerFlags.CORDEBUG_JIT_DISABLE_OPTIMIZATION;
            List <string> docPaths = new List <string> ();

            if (pAssembly.DebugData != null)
            {
                var md     = pAssembly.MetaData;
                var reader = pAssembly.DebugData;
                if (!pAssembly.IsFrameworkAssembly)
                {
                    foreach (var module in md.Assembly.Modules)
                    {
                        foreach (var t in module.Types)
                        {
                            foreach (var m in t.Methods)
                            {
                                var methodSymbols = new MethodSymbols(m.MetadataToken);
                                //Ugly hack
                                if (reader is Mono.Cecil.Mdb.MdbReader)
                                {
                                    foreach (var variable in m.Body.Variables)
                                    {
                                        methodSymbols.Variables.Add(variable);
                                    }
                                }
                                reader.Read(methodSymbols);
                                if (methodSymbols.Instructions.Count == 0)
                                {
                                    continue;
                                }
                                DocInfo document;
                                if (!documents.TryGetValue(methodSymbols.Instructions [0].SequencePoint.Document.Url, out document))
                                {
                                    document          = new DocInfo(methodSymbols.Instructions [0].SequencePoint.Document.Url);
                                    document.Assembly = pAssembly;
                                    documents.Add(document.Url, document);
                                }
                                document.AddMethod(m, methodSymbols);
                                if (!docPaths.Contains(document.Url))
                                {
                                    docPaths.Add(document.Url);
                                }
                            }
                        }
                    }
                }
                pAssembly.SetJmcStatus(true);
            }
            else
            {
                // Flag modules without debug info as not JMC. In this way
                // the debugger won't try to step into them
                pAssembly.SetJmcStatus(false);
            }
            foreach (var docPath in docPaths)
            {
                BindSourceFileBreakpoints(docPath);
            }
            pAppDomain.Process.Continue();
            return(0);
        }
예제 #7
0
 int ICorDebugManagedCallback.UnloadModule(CorDebugAppDomain pAppDomain, CorDebugAssembly pModule)
 {
     return(0);
 }
예제 #8
0
 int ICorDebugManagedCallback.LoadModule(CorDebugAppDomain pAppDomain, CorDebugAssembly pModule)
 {
     pAppDomain.Process.Continue();
     return(0);
 }