|
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: Class representing a memory address and its details. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __CATMEMORYADDRESS_H__ |
|
20 #define __CATMEMORYADDRESS_H__ |
|
21 |
|
22 #include "../inc/ATCommonDefines.h" |
|
23 |
|
24 class CATMemoryAddress |
|
25 { |
|
26 public: |
|
27 // Enumeration representing the state of locating code lines. |
|
28 enum ADDRESS_TO_LINE_STATE |
|
29 { |
|
30 OUT_OF_PROCESS = 0, /* Not located code line.*/ |
|
31 OUT_OF_RANGE, /* Outside functions range. */ |
|
32 SYMBOL, /* Symbol/ Function located (no codeline) */ |
|
33 FUNCTION, /* Function and line number.*/ |
|
34 EXACT /* Exact code line located with all information.*/ |
|
35 }; |
|
36 |
|
37 /** |
|
38 * Constructor |
|
39 * @param sAddress |
|
40 * @param iOffSet value used if need to use offset value |
|
41 */ |
|
42 CATMemoryAddress( string& sAddress, unsigned long iOffSet ); |
|
43 |
|
44 /** |
|
45 * Destructor |
|
46 */ |
|
47 virtual ~CATMemoryAddress(); |
|
48 |
|
49 /** |
|
50 * Find which binary this address belongs to. |
|
51 * Sets also the offsetfrommodulestart. |
|
52 * @param vDlls container of binarys to find from. |
|
53 * @return true if found |
|
54 */ |
|
55 bool FindSetModuleName(vector<DLL_LOAD_INFO>* vDlls); |
|
56 |
|
57 /** |
|
58 * Get vector index to which module we found this address to belong to. |
|
59 * @return -1 if not set. |
|
60 */ |
|
61 int GetDllLoadInfoIndex(); |
|
62 |
|
63 /** |
|
64 * Note return value includes the set offset. |
|
65 * So this value is not binary start - address. |
|
66 * Instead it is. |
|
67 * memory address - binary start address + offset |
|
68 * @return adress |
|
69 */ |
|
70 unsigned long GetOffSetFromModuleStart(); |
|
71 |
|
72 /** |
|
73 * Get the binary start address |
|
74 * @return binary start address |
|
75 */ |
|
76 unsigned long GetModuleStartAddress() const; |
|
77 |
|
78 |
|
79 /** |
|
80 * Simple get and sets for member variables. |
|
81 */ |
|
82 void SetTime( unsigned long long& ullTime ); |
|
83 unsigned long long GetTime(); |
|
84 void SetAddress( string& sAddress ); |
|
85 string GetAddressString(); |
|
86 void SetAddress( unsigned long iAddress ); |
|
87 unsigned long GetAddress(); |
|
88 void SetModuleName( string& sModuleName ); |
|
89 string GetModuleName(); |
|
90 void SetAddressToLineState( ADDRESS_TO_LINE_STATE eState ); |
|
91 int GetAddressToLineState(); |
|
92 void SetFileName(string& sFileName); |
|
93 string GetFileName(); |
|
94 void SetFunctionName(string& sFunctionName); |
|
95 string GetFunctionName(); |
|
96 void SetFunctionLineNumber(int iFunctionLineNumber); |
|
97 int GetFunctionLineNumber(); |
|
98 void SetExactLineNumber(int iExactLineNumber); |
|
99 int GetExactLineNumber(); |
|
100 void SetModuleStartAddress(unsigned long iAddress); |
|
101 |
|
102 #ifndef MODULE_TEST |
|
103 private: |
|
104 #endif |
|
105 // Used offset to add to addresses |
|
106 unsigned long m_iOffSet; |
|
107 // Address related members |
|
108 string m_sAddress; |
|
109 unsigned long m_iAddress; |
|
110 |
|
111 // Time (microseconds from 1970) |
|
112 unsigned long long m_iTime; |
|
113 |
|
114 // Module related members(if FindSetModule is successful) |
|
115 string m_sModuleName; |
|
116 unsigned long m_iOffSetFromModuleStart; |
|
117 unsigned long m_iModuleStartAddress; |
|
118 |
|
119 // Module to which address belong. |
|
120 int m_iDllLoadinfoIndex; |
|
121 |
|
122 // Pin pointing related members |
|
123 int m_ePinPointState; |
|
124 string m_sFileName; |
|
125 string m_sFunctionName; |
|
126 |
|
127 int m_iFunctionLineNumber; |
|
128 int m_iExactLineNumber; |
|
129 }; |
|
130 #endif |