Example #1
0
        /// <summary>
        /// Build a callstack pattern for a crash to ease bucketing of crashes into Buggs.
        /// </summary>
        /// <param name="CrashInstance">A crash that was recently added to the database.</param>
        public void BuildPattern(Crash CrashInstance)
        {
            List <string> Pattern = new List <string>();

            // Get an array of callstack items
            CallStackContainer CallStack = new CallStackContainer(CrashInstance);

            CallStack.bDisplayFunctionNames = true;

            if (CrashInstance.Pattern == null)
            {
                // Set the module based on the modules in the callstack
                CrashInstance.Module = CallStack.GetModuleName();
                try
                {
                    foreach (CallStackEntry Entry in CallStack.CallStackEntries)
                    {
                        FunctionCall CurrentFunctionCall = new FunctionCall();

                        if (FunctionCalls.Where(f => f.Call == Entry.FunctionName).Count() > 0)
                        {
                            CurrentFunctionCall = FunctionCalls.Where(f => f.Call == Entry.FunctionName).First();
                        }
                        else
                        {
                            CurrentFunctionCall      = new FunctionCall();
                            CurrentFunctionCall.Call = Entry.FunctionName;
                            FunctionCalls.InsertOnSubmit(CurrentFunctionCall);
                        }

                        int Count = Crash_FunctionCalls.Where(c => c.CrashId == CrashInstance.Id && c.FunctionCallId == CurrentFunctionCall.Id).Count();
                        if (Count < 1)
                        {
                            Crash_FunctionCall JoinTable = new Crash_FunctionCall();
                            JoinTable.Crash        = CrashInstance;
                            JoinTable.FunctionCall = CurrentFunctionCall;
                            Crash_FunctionCalls.InsertOnSubmit(JoinTable);
                        }

                        SubmitChanges();

                        Pattern.Add(CurrentFunctionCall.Id.ToString());
                    }

                    CrashInstance.Pattern = string.Join("+", Pattern);
                    SubmitChanges();
                }
                catch (Exception Ex)
                {
                    Debug.WriteLine("Exception in BuildPattern: " + Ex.ToString());
                }
            }
        }
Example #2
0
        /// <summary>
        /// Build a callstack pattern for a crash to ease bucketing of crashes into Buggs.
        /// </summary>
        public void BuildPattern(CrashReportDataContext Context)
        {
            using (FAutoScopedLogTimer LogTimer = new FAutoScopedLogTimer(this.GetType().ToString() + "(Crash=" + Id + ")"))
            {
                List <string> PatternList   = new List <string>();
                var           FunctionCalls = Context.FunctionCalls;

                // Get an array of callstack items
                CallStackContainer CallStack = GetCallStack();

                if (Pattern == null)
                {
                    // Set the module based on the modules in the callstack
                    Module = CallStack.GetModuleName();
                    try
                    {
                        foreach (CallStackEntry Entry in CallStack.CallStackEntries.Take(64))
                        {
                            FunctionCall CurrentFunctionCall = new FunctionCall();

                            if (FunctionCalls.Where(f => f.Call == Entry.FunctionName).Count() > 0)
                            {
                                CurrentFunctionCall = FunctionCalls.Where(f => f.Call == Entry.FunctionName).First();
                            }
                            else
                            {
                                CurrentFunctionCall      = new FunctionCall();
                                CurrentFunctionCall.Call = Entry.FunctionName;
                                FunctionCalls.InsertOnSubmit(CurrentFunctionCall);
                            }

                            Context.SubmitChanges();

                            PatternList.Add(CurrentFunctionCall.Id.ToString());
                        }

                        //CrashInstance.Pattern = "+";
                        Pattern = string.Join("+", PatternList);
                        // We need something like this +1+2+3+5+ for searching for exact pattern like +5+
                        //CrashInstance.Pattern += "+";

                        Context.SubmitChanges();
                    }
                    catch (Exception Ex)
                    {
                        FLogger.Global.WriteException("BuildPattern: " + Ex.ToString());
                    }
                }
            }
        }
Example #3
0
        /// <summary>
        /// Build a callstack pattern for a crash to ease bucketing of crashes into Buggs.
        /// </summary>
        /// <param name="CrashInstance">A crash that was recently added to the database.</param>
        public void BuildPattern(Crash CrashInstance)
        {
            using (FAutoScopedLogTimer LogTimer = new FAutoScopedLogTimer(this.GetType().ToString() + "(Crash=" + CrashInstance.Id + ")"))
            {
                List <string> Pattern = new List <string>();

                // Get an array of callstack items
                CallStackContainer CallStack = new CallStackContainer(CrashInstance);
                CallStack.bDisplayFunctionNames = true;

                if (CrashInstance.Pattern == null)
                {
                    // Set the module based on the modules in the callstack
                    CrashInstance.Module = CallStack.GetModuleName();
                    try
                    {
                        foreach (CallStackEntry Entry in CallStack.CallStackEntries)
                        {
                            FunctionCall CurrentFunctionCall = new FunctionCall();

                            if (FunctionCalls.Where(f => f.Call == Entry.FunctionName).Count() > 0)
                            {
                                CurrentFunctionCall = FunctionCalls.Where(f => f.Call == Entry.FunctionName).First();
                            }
                            else
                            {
                                CurrentFunctionCall      = new FunctionCall();
                                CurrentFunctionCall.Call = Entry.FunctionName;
                                FunctionCalls.InsertOnSubmit(CurrentFunctionCall);
                            }

                            SubmitChanges();

                            Pattern.Add(CurrentFunctionCall.Id.ToString());
                        }

                        //CrashInstance.Pattern = "+";
                        CrashInstance.Pattern = string.Join("+", Pattern);
                        // We need something like this +1+2+3+5+ for searching for exact pattern like +5+
                        //CrashInstance.Pattern += "+";

                        SubmitChanges();
                    }
                    catch (Exception Ex)
                    {
                        FLogger.WriteException("BuildPattern: " + Ex.ToString());
                    }
                }
            }
        }
        /// <summary>
        /// Get the id of a function from its name.
        /// </summary>
        /// <param name="FunctionCallName">The name of the function to look up.</param>
        /// <returns>The unique id of the function name, or zero if none is found.</returns>
        public int GetFunctionCallId(string FunctionCallName)
        {
            try
            {
                FunctionCall FunctionCall = BuggsDataContext.FunctionCalls.Where(FunctionCallInstance => FunctionCallInstance.Call.Contains(FunctionCallName)).First();
                return(FunctionCall.Id);
            }
            catch (Exception Ex)
            {
                Debug.WriteLine("Exception in GetFunctionCallId: " + Ex.ToString());
            }

            return(0);
        }
Example #5
0
        /// <summary>
        /// Build a callstack pattern for a crash to ease bucketing of crashes into Buggs.
        /// </summary>
        public void BuildPattern(CrashReportDataContext Context)
        {
            using (FAutoScopedLogTimer LogTimer = new FAutoScopedLogTimer(this.GetType().ToString() + "(Crash=" + Id + ")"))
            {
                List <string> PatternList   = new List <string>();
                var           FunctionCalls = Context.FunctionCalls;

                // Get an array of call stack items
                CallStackContainer CallStack = GetCallStack();

                if (Pattern == null)
                {
                    // Set the module based on the modules in the call stack
                    Module = CallStack.GetModuleName();
                    try
                    {
                        foreach (CallStackEntry Entry in CallStack.CallStackEntries.Take(CallStackContainer.MaxLinesToParse))
                        {
                            FunctionCall currentFunctionCall;

                            if (FunctionCalls.Any(f => f.Call == Entry.FunctionName))
                            {
                                currentFunctionCall = FunctionCalls.First(f => f.Call == Entry.FunctionName);
                            }
                            else
                            {
                                currentFunctionCall      = new FunctionCall();
                                currentFunctionCall.Call = Entry.FunctionName;
                                FunctionCalls.InsertOnSubmit(currentFunctionCall);
                            }

                            Context.SubmitChanges();
                            PatternList.Add(currentFunctionCall.Id.ToString());
                        }

                        Pattern = string.Join("+", PatternList);

                        Context.SubmitChanges();
                    }
                    catch (Exception Ex)
                    {
                        FLogger.Global.WriteException("BuildPattern exception: " + Ex.Message.ToString());
                    }
                }
            }
        }
Example #6
0
        /// <summary>
        /// Get the id of a function from its name.
        /// </summary>
        /// <param name="FunctionCallName">The name of the function to look up.</param>
        /// <returns>The unique id of the function name, or zero if none is found.</returns>
        public int GetFunctionCallId(string FunctionCallName)
        {
            using (FAutoScopedLogTimer LogTimer = new FAutoScopedLogTimer(this.GetType().ToString()))
            {
                try
                {
                    FunctionCall FunctionCall = BuggsDataContext.FunctionCalls.Where(FunctionCallInstance => FunctionCallInstance.Call.Contains(FunctionCallName)).First();
                    return(FunctionCall.Id);
                }
                catch (Exception Ex)
                {
                    Debug.WriteLine("Exception in GetFunctionCallId: " + Ex.ToString());
                }

                return(0);
            }
        }
 partial void DeleteFunctionCall(FunctionCall instance);
 partial void UpdateFunctionCall(FunctionCall instance);
 partial void InsertFunctionCall(FunctionCall instance);
Example #10
0
        /// <summary>
        /// Build a callstack pattern for a crash to ease bucketing of crashes into Buggs.
        /// </summary>
        public void BuildPattern( CrashReportDataContext Context )
        {
            using( FAutoScopedLogTimer LogTimer = new FAutoScopedLogTimer( this.GetType().ToString() + "(Crash=" + Id + ")" ) )
            {
                List<string> PatternList = new List<string>();
                var FunctionCalls = Context.FunctionCalls;

                // Get an array of callstack items
                CallStackContainer CallStack = GetCallStack();

                if( Pattern == null )
                {
                    // Set the module based on the modules in the callstack
                    Module = CallStack.GetModuleName();
                    try
                    {
                        foreach (CallStackEntry Entry in CallStack.CallStackEntries.Take( CallStackContainer.MaxLinesToParse ))
                        {
                            FunctionCall CurrentFunctionCall = new FunctionCall();

                            if( FunctionCalls.Where( f => f.Call == Entry.FunctionName ).Count() > 0 )
                            {
                                CurrentFunctionCall = FunctionCalls.Where( f => f.Call == Entry.FunctionName ).First();
                            }
                            else
                            {
                                CurrentFunctionCall = new FunctionCall();
                                CurrentFunctionCall.Call = Entry.FunctionName;
                                FunctionCalls.InsertOnSubmit( CurrentFunctionCall );
                            }

                            Context.SubmitChanges();

                            PatternList.Add( CurrentFunctionCall.Id.ToString() );
                        }

                        Pattern = string.Join( "+", PatternList );

                        Context.SubmitChanges();
                    }
                    catch( Exception Ex )
                    {
                        FLogger.Global.WriteException( "BuildPattern: " + Ex.ToString() );
                    }
                }
            }
        }
Example #11
0
		void BuildPattern( Crash CrashInstance )
		{

			List<string> Pattern = new List<string>();

			// Get an array of callstack items
			CallStackContainer CallStack = new CallStackContainer( CrashInstance );
			CallStack.bDisplayFunctionNames = true;

			if( CrashInstance.Pattern == null )
			{
				// Set the module based on the modules in the callstack
				CrashInstance.Module = CallStack.GetModuleName();
				try
				{
					using( FAutoScopedLogTimer LogTimer = new FAutoScopedLogTimer( this.GetType().ToString() + "(Id=" + CrashInstance.Id + ")" ) )
					{
						foreach( CallStackEntry Entry in CallStack.CallStackEntries.Take( 64 ) )
						{
							FunctionCall CurrentFunctionCall = new FunctionCall();

							if( FunctionCalls.Where( f => f.Call == Entry.FunctionName ).Count() > 0 )
							{
								CurrentFunctionCall = FunctionCalls.Where( f => f.Call == Entry.FunctionName ).First();
							}
							else
							{
								CurrentFunctionCall = new FunctionCall();
								CurrentFunctionCall.Call = Entry.FunctionName;
								FunctionCalls.InsertOnSubmit( CurrentFunctionCall );
							}

							//CrashRepository.Context.SubmitChanges();

							Pattern.Add( CurrentFunctionCall.Id.ToString() );
						}

						//CrashInstance.Pattern = "+";
						CrashInstance.Pattern = string.Join( "+", Pattern );
						// We need something like this +1+2+3+5+ for searching for exact pattern like +5+
						//CrashInstance.Pattern += "+";

						CrashRepository.Context.SubmitChanges();
					}

				}
				catch( Exception Ex )
				{
					FLogger.WriteEvent( "Exception in BuildPattern: " + Ex.ToString() );
				}
			}
		}