|
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.Collections.Generic; |
|
19 using System.Text; |
|
20 using SymbianUtils; |
|
21 using SymbianUtils.Tracer; |
|
22 using SymbianDebugLib.Engine; |
|
23 using SymbianDebugLib.Entity; |
|
24 using SymbianDebugLib.PluginAPI; |
|
25 using SymbianDebugLib.PluginAPI.Types; |
|
26 using SymbianDebugLib.PluginAPI.Types.Code; |
|
27 using SymbianStructuresLib.Arm; |
|
28 using SymbianStructuresLib.Arm.Instructions; |
|
29 using SymbianCodeLib.SourceManagement; |
|
30 using SymbianCodeLib.SourceManagement.Source; |
|
31 using SymbianCodeLib.SourceManagement.Provisioning; |
|
32 |
|
33 namespace SymbianCodeLib.DbgEnginePlugin |
|
34 { |
|
35 internal class CodePlugin : DbgEngineCode, ITracer |
|
36 { |
|
37 #region Constructors |
|
38 public CodePlugin( DbgEngine aEngine ) |
|
39 : base( aEngine ) |
|
40 { |
|
41 iSourceManager = new CodeSourceManager( this ); |
|
42 iProvisioningManager = new CodeSourceProviderManager( this, aEngine.IdAllocator ); |
|
43 } |
|
44 #endregion |
|
45 |
|
46 #region From DbgSymbolEngine |
|
47 public override bool IsReady |
|
48 { |
|
49 get { return true; } |
|
50 } |
|
51 |
|
52 public override string Name |
|
53 { |
|
54 get { return "DbgPluginCode"; } |
|
55 } |
|
56 |
|
57 public override bool IsSupported( string aFileName, out string aType ) |
|
58 { |
|
59 CodeSourceProvider provider = iProvisioningManager.GetProvider( aFileName ); |
|
60 // |
|
61 if ( provider != null ) |
|
62 { |
|
63 aType = provider.Name; |
|
64 } |
|
65 else |
|
66 { |
|
67 aType = string.Empty; |
|
68 } |
|
69 // |
|
70 return provider != null; |
|
71 } |
|
72 |
|
73 public override DbgPluginPrimer CreatePrimer() |
|
74 { |
|
75 return new CodePrimer( this ); |
|
76 } |
|
77 |
|
78 public override void PrepareToPrime( DbgEntityList aEntities ) |
|
79 { |
|
80 List<string> fileNames = new List<string>(); |
|
81 foreach ( DbgEntity entity in aEntities ) |
|
82 { |
|
83 fileNames.Add( entity.FullName ); |
|
84 } |
|
85 |
|
86 ProvisioningManager.PrepareToCreateSources( fileNames ); |
|
87 } |
|
88 |
|
89 protected override DbgPluginView DoCreateView( string aName ) |
|
90 { |
|
91 CodeView ret = new CodeView( aName, this ); |
|
92 return ret; |
|
93 } |
|
94 |
|
95 protected override void DoClear() |
|
96 { |
|
97 if ( iSourceManager != null ) |
|
98 { |
|
99 iSourceManager.Dispose(); |
|
100 } |
|
101 iSourceManager = new CodeSourceManager( this ); |
|
102 } |
|
103 #endregion |
|
104 |
|
105 #region API |
|
106 #endregion |
|
107 |
|
108 #region Properties |
|
109 internal CodeSourceManager SourceManager |
|
110 { |
|
111 get { return iSourceManager; } |
|
112 } |
|
113 |
|
114 internal CodeSourceProviderManager ProvisioningManager |
|
115 { |
|
116 get { return iProvisioningManager; } |
|
117 } |
|
118 #endregion |
|
119 |
|
120 #region From DisposableObject |
|
121 protected override void CleanupManagedResources() |
|
122 { |
|
123 try |
|
124 { |
|
125 base.CleanupManagedResources(); |
|
126 } |
|
127 finally |
|
128 { |
|
129 iProvisioningManager.Dispose(); |
|
130 iSourceManager.Dispose(); |
|
131 } |
|
132 } |
|
133 #endregion |
|
134 |
|
135 #region Internal methods |
|
136 #endregion |
|
137 |
|
138 #region Data members |
|
139 private CodeSourceManager iSourceManager; |
|
140 private readonly CodeSourceProviderManager iProvisioningManager; |
|
141 #endregion |
|
142 } |
|
143 } |