|
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.Range; |
|
21 using SymbianStructuresLib.Arm; |
|
22 using SymbianStructuresLib.Arm.Instructions; |
|
23 using SymbianStructuresLib.CodeSegments; |
|
24 using SymbianStructuresLib.Debug.Code; |
|
25 |
|
26 namespace SymbianDebugLib.PluginAPI.Types.Code |
|
27 { |
|
28 public abstract class DbgViewCode : DbgPluginView, IArmInstructionProvider |
|
29 { |
|
30 #region Constructors |
|
31 protected DbgViewCode( string aName, DbgPluginEngine aEngine ) |
|
32 : base( aName, aEngine ) |
|
33 { |
|
34 } |
|
35 #endregion |
|
36 |
|
37 #region From IArmInstructionProvider |
|
38 public uint GetDataUInt32( uint aAddress ) |
|
39 { |
|
40 uint ret = 0; |
|
41 IArmInstruction[] inst = null; |
|
42 // |
|
43 bool available = GetInstructions( aAddress, TArmInstructionSet.EARM, 1, out inst ); |
|
44 if ( available && inst.Length >= 1 ) |
|
45 { |
|
46 ret = inst[ 0 ].AIRawValue; |
|
47 } |
|
48 // |
|
49 return ret; |
|
50 } |
|
51 |
|
52 public ushort GetDataUInt16( uint aAddress ) |
|
53 { |
|
54 ushort ret = 0; |
|
55 IArmInstruction[] inst = null; |
|
56 // |
|
57 bool available = GetInstructions( aAddress, TArmInstructionSet.ETHUMB, 1, out inst ); |
|
58 if ( available && inst.Length >= 1 ) |
|
59 { |
|
60 ret = inst[ 0 ].AIRawValue; |
|
61 } |
|
62 // |
|
63 return ret; |
|
64 } |
|
65 |
|
66 public bool IsInstructionAddressValid( uint aAddress ) |
|
67 { |
|
68 return Contains( aAddress ); |
|
69 } |
|
70 |
|
71 public bool GetInstructions( uint aAddress, TArmInstructionSet aInstructionSet, int aCount, out IArmInstruction[] aInstructions ) |
|
72 { |
|
73 return DoGetInstructions( aAddress, aInstructionSet, aCount, out aInstructions ); |
|
74 } |
|
75 #endregion |
|
76 |
|
77 #region Framework API |
|
78 public abstract CodeCollection ActivateAndGetCollection( CodeSegDefinition aCodeSegment ); |
|
79 |
|
80 public abstract IArmInstruction ConvertToInstruction( uint aAddress, TArmInstructionSet aInstructionSet, uint aRawValue ); |
|
81 |
|
82 protected abstract bool DoGetInstructions( uint aAddress, TArmInstructionSet aInstructionSet, int aCount, out IArmInstruction[] aInstructions ); |
|
83 #endregion |
|
84 |
|
85 #region Properties |
|
86 #endregion |
|
87 |
|
88 #region Internal methods |
|
89 #endregion |
|
90 |
|
91 #region Data members |
|
92 #endregion |
|
93 } |
|
94 } |