Exemplo n.º 1
0
        List <DebugLocalVariableInfo> GetLocalVariablesInScope(ISymUnmanagedScope symScope)
        {
            List <DebugLocalVariableInfo> vars = new List <DebugLocalVariableInfo>();

            foreach (ISymUnmanagedVariable symVar in symScope.GetLocals())
            {
                ISymUnmanagedVariable symVarCopy = symVar;
                var       locVarSig  = new DebugSignatureReader().ReadTypeSignature(symVar.GetSignature());
                DebugType locVarType = DebugType.CreateFromSignature(this.DebugModule, locVarSig, declaringType);
                // Compiler generated?
                // NB: Display class does not have the compiler-generated flag
                if ((symVar.GetAttributes() & 1) == 1 || symVar.GetName().StartsWith("CS$"))
                {
                    // Get display class from local variable
                    if (locVarType.IsDisplayClass)
                    {
                        AddCapturedLocalVariables(
                            vars,
                            (int)symScope.GetStartOffset(),
                            (int)symScope.GetEndOffset(),
                            delegate(StackFrame context) {
                            return(GetLocalVariableValue(context, symVarCopy));
                        },
                            locVarType
                            );
                    }
                }
                else
                {
                    DebugLocalVariableInfo locVar = new DebugLocalVariableInfo(
                        symVar.GetName(),
                        (int)symVar.GetAddressField1(),
                        // symVar also has Get*Offset methods, but the are not implemented
                        (int)symScope.GetStartOffset(),
                        (int)symScope.GetEndOffset(),
                        locVarType,
                        delegate(StackFrame context) {
                        return(GetLocalVariableValue(context, symVarCopy));
                    }
                        );
                    vars.Add(locVar);
                }
            }
            foreach (ISymUnmanagedScope childScope in symScope.GetChildren())
            {
                vars.AddRange(GetLocalVariablesInScope(childScope));
            }
            return(vars);
        }
Exemplo n.º 2
0
 List<DebugLocalVariableInfo> GetLocalVariablesInScope(ISymUnmanagedScope symScope)
 {
     List<DebugLocalVariableInfo> vars = new List<DebugLocalVariableInfo>();
     foreach (ISymUnmanagedVariable symVar in symScope.GetLocals()) {
         ISymUnmanagedVariable symVarCopy = symVar;
         var locVarSig = new DebugSignatureReader().ReadTypeSignature(symVar.GetSignature());
         DebugType locVarType = DebugType.CreateFromSignature(this.DebugModule, locVarSig, declaringType);
         // Compiler generated?
         // NB: Display class does not have the compiler-generated flag
         if ((symVar.GetAttributes() & 1) == 1 || symVar.GetName().StartsWith("CS$")) {
             // Get display class from local variable
             if (locVarType.IsDisplayClass) {
                 AddCapturedLocalVariables(
                     vars,
                     (int)symScope.GetStartOffset(),
                     (int)symScope.GetEndOffset(),
                     delegate(StackFrame context) {
                         return GetLocalVariableValue(context, symVarCopy);
                     },
                     locVarType
                 );
             }
         } else {
             DebugLocalVariableInfo locVar = new DebugLocalVariableInfo(
                 symVar.GetName(),
                 (int)symVar.GetAddressField1(),
                 // symVar also has Get*Offset methods, but the are not implemented
                 (int)symScope.GetStartOffset(),
                 (int)symScope.GetEndOffset(),
                 locVarType,
                 delegate(StackFrame context) {
                     return GetLocalVariableValue(context, symVarCopy);
                 }
             );
             vars.Add(locVar);
         }
     }
     foreach(ISymUnmanagedScope childScope in symScope.GetChildren()) {
         vars.AddRange(GetLocalVariablesInScope(childScope));
     }
     return vars;
 }