Пример #1
0
 private string FetchCodeLine(int i)
 {
     if (System.IO.File.Exists(this.GetFile()))
     {
         return(SourceLocationInfo.FetchCodeLine(this.GetFile(), this.GetLine()));
     }
     return(SourceLocationInfo.FetchCodeLine(Path.Combine(this.GetDirectory(), Path.GetFileName(this.GetFile())), this.GetLine()));
 }
Пример #2
0
        public SourceLocationInfo(QKeyValue attributes)
        {
            this.Line = QKeyValue.FindIntAttribute(attributes, "line", -1);
            if (this.Line == -1)
            {
                throw new Exception();
            }

            this.Column = QKeyValue.FindIntAttribute(attributes, "column", -1);
            if (this.Column == -1)
            {
                throw new Exception();
            }

            this.File       = WhoopCommandLineOptions.Get().OriginalFile;
            this.Directory  = Path.GetDirectoryName(WhoopCommandLineOptions.Get().OriginalFile);
            this.StackTrace = SourceLocationInfo.TrimLeadingSpaces(this.FetchCodeLine(0), 2);
        }
Пример #3
0
        private bool AnalyseConflict(string state1, string state2, AssumeCmd assume1, AssumeCmd assume2)
        {
            string ep1 = this.GetEntryPointName(assume1.Attributes);
            string ep2 = this.GetEntryPointName(assume2.Attributes);

            if (!this.Pair.EntryPoint1.Name.Equals(ep1))
            {
                return(false);
            }
            if (!this.Pair.EntryPoint2.Name.Equals(ep2))
            {
                return(false);
            }

            string access1 = this.GetAccessType(assume1.Attributes);
            string access2 = this.GetAccessType(assume2.Attributes);

            if (access1.Equals("read") && access2.Equals("read"))
            {
                return(false);
            }

            var sourceInfoForAccess1 = new SourceLocationInfo(assume1.Attributes);
            var sourceInfoForAccess2 = new SourceLocationInfo(assume2.Attributes);

            ErrorReporter.ErrorWriteLine("\n" + sourceInfoForAccess1.GetFile() + ":",
                                         "potential " + access1 + "-" + access2 + " race:\n", ErrorMsgType.Error);

            Console.Error.Write(access1 + " by entry point " + ep1 + ", ");
            Console.Error.WriteLine(sourceInfoForAccess1.ToString());
            sourceInfoForAccess1.PrintStackTrace();

            Console.Error.WriteLine(access2 + " by entry point " + ep2 + ", " + sourceInfoForAccess2.ToString());
            sourceInfoForAccess2.PrintStackTrace();

            return(true);
        }