Example #1
0
 private void CloseScope(int offset)
 {
     try
     {
         _symWriter.CloseScope((uint)offset);
     }
     catch (Exception ex)
     {
         throw new PdbWritingException(ex);
     }
 }
Example #2
0
 internal void Do(ISymUnmanagedWriter2 symUnmanagedWriter)
 {
     symUnmanagedWriter.OpenScope(startOffset);
     foreach (KeyValuePair <string, LocalVar> kv in locals)
     {
         symUnmanagedWriter.DefineLocalVariable2(kv.Key, (int)kv.Value.attributes, kv.Value.signature, (int)kv.Value.addrKind, kv.Value.addr1, kv.Value.addr2, kv.Value.addr3, kv.Value.startOffset, kv.Value.endOffset);
     }
     foreach (Scope scope in scopes)
     {
         scope.Do(symUnmanagedWriter);
     }
     symUnmanagedWriter.CloseScope(endOffset);
 }
Example #3
0
        private void WriteScope(Scope scope, Function function)
        {
            pdb.OpenScope(scope.Offset);

            WriteVariables(scope.Variables, function.VariablesToken, scope.Offset, scope.Length);
            WriteConstants(scope.Constants);
            WriteScopes(scope.Scopes, function);

            // TODO
            // scope.usedNamespaces

            pdb.CloseScope(scope.Offset + scope.Length);
        }
Example #4
0
 public void CloseScope(int endOffset)
 {
     m_writer.CloseScope(endOffset);
 }
Example #5
0
        /// <summary>
        /// Emits scope debugging symbols based on <c>ISymUnmanagedScope</c> insatnce, representing
        /// scope from new assembly.
        /// </summary>
        /// <param name="smScope">Scope from new version of changed assembly.</param>
        /// <param name="placeholder">Placeholder translation for local variables.</param>
        public void EmitScope(ISymUnmanagedScope smScope, Dictionary <int, int> placeholder)
        {
            if (State != WriterState.Building)
            {
                throw new TranslatingException("ISym* interfaces were not initialized.");
            }
            uint scStartOffset = smScope.__GetStartOffset();
            uint scEndOffset   = smScope.__GetEndOffset();

            mWriter.OpenScope(scStartOffset);

            uint localsCount = smScope.__GetLocalCount();

            if (localsCount > 0)
            {
                uint read;
                ISymUnmanagedVariable[] variables = new ISymUnmanagedVariable[localsCount];
                smScope.__GetLocals(localsCount, out read, variables);
                for (int i = 0; i < localsCount; i++)
                {
                    byte[]    signature = variables[i].GetSignature();
                    Signature sig       = new Signature(signature);
                    sig.Migrate(translator);
                    signature = sig.Compress();

                    string name     = variables[i].GetName();
                    uint   addr1    = 0;                             //variables[i].GetAddressField1();
                    uint   addr2    = 0;                             //variables[i].GetAddressField2();
                    uint   addr3    = 0;                             //variables[i].GetAddressField3();
                    uint   addrKind = variables[i].GetAddressKind(); //variables[i].GetAddressKind();
                    if ((variables[i].GetAttributes() & 1) != 1)
                    {
                        addr1    = variables[i].GetAddressField1();
                        addrKind = variables[i].GetAddressKind();
                        if (placeholder != null && placeholder.ContainsKey((int)addr1))
                        {
                            addr1 = (uint)placeholder[(int)addr1];
                        }
                    }
                    uint varStartOffset = scStartOffset;
                    uint varEndOffset   = scEndOffset;
                    uint attributes     = variables[i].GetAttributes();

                    IntPtr pName = Marshal.StringToCoTaskMemUni(name);
                    IntPtr pSig  = Marshal.AllocCoTaskMem(signature.Length);
                    Marshal.Copy(signature, 0, pSig, signature.Length);

                    try{
                        mWriter.DefineLocalVariable(pName, attributes, (uint)signature.Length, pSig, addrKind,
                                                    addr1, addr2, addr3, varStartOffset, varEndOffset);
                    } finally {
                        Marshal.FreeCoTaskMem(pSig);
                        Marshal.FreeCoTaskMem(pName);
                    }
                }
            }
            ISymUnmanagedScope[] subScopes = smScope.GetChildren();
            foreach (ISymUnmanagedScope subScope in subScopes)
            {
                EmitScope(subScope, placeholder);
            }
            mWriter.CloseScope(scEndOffset);
        }
Example #6
0
 public void CloseScope(int endOffset)
 {
     writer.CloseScope((uint)endOffset);
 }
 public override void CloseScope(int endOffset) => writer.CloseScope((uint)endOffset);
Example #8
0
 internal void Do(ISymUnmanagedWriter2 symUnmanagedWriter)
 {
     symUnmanagedWriter.OpenScope(startOffset);
     foreach (KeyValuePair<string, LocalVar> kv in locals)
     {
         symUnmanagedWriter.DefineLocalVariable2(kv.Key, (int)kv.Value.attributes, kv.Value.signature, (int)kv.Value.addrKind, kv.Value.addr1, kv.Value.addr2, kv.Value.addr3, kv.Value.startOffset, kv.Value.endOffset);
     }
     foreach (Scope scope in scopes)
     {
         scope.Do(symUnmanagedWriter);
     }
     symUnmanagedWriter.CloseScope(endOffset);
 }