|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 using System; |
|
18 using System.Text; |
|
19 using System.Collections.Generic; |
|
20 using CrashItemLib.Crash.Container; |
|
21 using CrashItemLib.Crash.Base; |
|
22 using CrashItemLib.Crash.Messages; |
|
23 using CrashItemLib.Crash.Summarisable; |
|
24 using SymbianStructuresLib.Arm.Registers; |
|
25 |
|
26 namespace CrashItemLib.Engine.ProblemDetectors |
|
27 { |
|
28 internal abstract class CIProblemDetector |
|
29 { |
|
30 #region Constructors |
|
31 protected CIProblemDetector() |
|
32 { |
|
33 } |
|
34 #endregion |
|
35 |
|
36 #region API |
|
37 public abstract void Check( CIContainer aContainer ); |
|
38 |
|
39 public virtual long Priority |
|
40 { |
|
41 get { return long.MinValue; } |
|
42 } |
|
43 #endregion |
|
44 |
|
45 #region Internal methods |
|
46 protected string CreateIdentifierText( CISummarisableEntity aEntry ) |
|
47 { |
|
48 StringBuilder ret = new StringBuilder(); |
|
49 // |
|
50 if ( aEntry.IsAvailable( CISummarisableEntity.TElement.EElementThread ) ) |
|
51 { |
|
52 ret.AppendFormat( LibResources.CIProblemDetector_Msg_Thread, aEntry.Thread.FullName ); |
|
53 } |
|
54 else if ( aEntry.IsAvailable( CISummarisableEntity.TElement.EElementStack ) ) |
|
55 { |
|
56 ret.AppendFormat( LibResources.CIProblemDetector_Msg_Stack, ArmRegisterBankUtils.BankAsStringLong( aEntry.Stack.Type ) ); |
|
57 } |
|
58 // |
|
59 return ret.ToString(); |
|
60 } |
|
61 |
|
62 protected void CreateMessage( CIContainer aContainer, CIElement aAssociatedElement, string aTitle ) |
|
63 { |
|
64 CreateMessage( aContainer, aAssociatedElement, aTitle, string.Empty ); |
|
65 } |
|
66 |
|
67 protected void CreateMessage( CIContainer aContainer, CIElement aAssociatedElement, string aTitle, string aDescription ) |
|
68 { |
|
69 CIMessage message = CIMessage.NewMessage( aContainer ); |
|
70 message.Title = aTitle; |
|
71 message.Description = aDescription; |
|
72 // |
|
73 aAssociatedElement.AddChild( message ); |
|
74 } |
|
75 |
|
76 protected void CreateWarning( CIContainer aContainer, CIElement aAssociatedElement, string aTitle ) |
|
77 { |
|
78 CreateWarning( aContainer, aAssociatedElement, aTitle, string.Empty ); |
|
79 } |
|
80 |
|
81 protected void CreateWarning( CIContainer aContainer, CIElement aAssociatedElement, string aTitle, string aDescription ) |
|
82 { |
|
83 CIMessageWarning message = new CIMessageWarning( aContainer, aTitle ); |
|
84 message.Description = aDescription; |
|
85 // |
|
86 aAssociatedElement.AddChild( message ); |
|
87 } |
|
88 |
|
89 protected void CreateError( CIContainer aContainer, CIElement aAssociatedElement, string aTitle ) |
|
90 { |
|
91 CreateError( aContainer, aAssociatedElement, aTitle, string.Empty ); |
|
92 } |
|
93 |
|
94 protected void CreateError( CIContainer aContainer, CIElement aAssociatedElement, string aTitle, string aDescription ) |
|
95 { |
|
96 CIMessageError message = new CIMessageError( aContainer, aTitle ); |
|
97 message.Description = aDescription; |
|
98 // |
|
99 aAssociatedElement.AddChild( message ); |
|
100 } |
|
101 #endregion |
|
102 |
|
103 #region From System.Object |
|
104 #endregion |
|
105 |
|
106 #region Data members |
|
107 #endregion |
|
108 } |
|
109 } |