コード例 #1
0
 public static RubyMethodDebugInfo GetOrCreate(string/*!*/ methodName) {
     lock (_Infos) {
         RubyMethodDebugInfo info;
         if (!_Infos.TryGetValue(methodName, out info)) {
             info = new RubyMethodDebugInfo();
             _Infos.Add(methodName, info);
         }
         return info;
     }
 }
コード例 #2
0
 public static RubyMethodDebugInfo GetOrCreate(string /*!*/ methodName)
 {
     lock (_Infos) {
         RubyMethodDebugInfo info;
         if (!_Infos.TryGetValue(methodName, out info))
         {
             info = new RubyMethodDebugInfo();
             _Infos.Add(methodName, info);
         }
         return(info);
     }
 }
コード例 #3
0
 public override void MarkSequencePoint(LambdaExpression method, int ilOffset, DebugInfoExpression node)
 {
     RubyMethodDebugInfo.GetOrCreate(method.Name).AddMapping(ilOffset, node.StartLine);
 }
コード例 #4
0
 public static bool TryGet(MethodBase /*!*/ method, out RubyMethodDebugInfo info)
 {
     lock (_Infos) {
         return(_Infos.TryGetValue(method.Name, out info));
     }
 }
コード例 #5
0
        private bool TryGetStackFrameInfo(StackFrame /*!*/ frame, out string /*!*/ methodName, out string /*!*/ fileName, out int line)
        {
            MethodBase method = frame.GetMethod();

            methodName = method.Name;

            fileName = (_hasFileAccessPermission) ? GetFileName(frame) : null;
            var sourceLine = line = PlatformAdaptationLayer.IsCompactFramework ? 0 : frame.GetFileLineNumber();

            if (TryParseRubyMethodName(ref methodName, ref fileName, ref line))
            {
                if (sourceLine == 0)
                {
                    RubyMethodDebugInfo debugInfo;
                    if (RubyMethodDebugInfo.TryGet(method, out debugInfo))
                    {
                        var ilOffset = frame.GetILOffset();
                        if (ilOffset >= 0)
                        {
                            var mappedLine = debugInfo.Map(ilOffset);
                            if (mappedLine != 0)
                            {
                                line = mappedLine;
                            }
                        }
                    }
                }

                return(true);
            }
            else if (method.IsDefined(typeof(RubyStackTraceHiddenAttribute), false))
            {
                return(false);
            }
            else
            {
                object[] attrs = method.GetCustomAttributes(typeof(RubyMethodAttribute), false);
                if (attrs.Length > 0)
                {
                    // Ruby library method:
                    // TODO: aliases
                    methodName = ((RubyMethodAttribute)attrs[0]).Name;

                    if (!_exceptionDetail)
                    {
                        fileName = null;
                        line     = NextFrameLine;
                    }

                    return(true);
                }
                else if (_exceptionDetail || IsVisibleClrFrame(method))
                {
                    // Visible CLR method:
                    if (String.IsNullOrEmpty(fileName))
                    {
                        if (method.DeclaringType != null)
                        {
                            fileName = (_hasFileAccessPermission) ? GetAssemblyName(method.DeclaringType.Assembly) : null;
                            line     = 0;
                        }
                    }
                    return(true);
                }
                else
                {
                    // Invisible CLR method:
                    return(false);
                }
            }
        }
コード例 #6
0
 public static bool TryGet(MethodBase/*!*/ method, out RubyMethodDebugInfo info) {
     lock (_Infos) {
         return _Infos.TryGetValue(method.Name, out info);
     }
 }