analyzetool/commandlineengine/inc/CATMemoryAddress.h
branchRCL_3
changeset 13 da2cedce4920
equal deleted inserted replaced
12:d27dfa8884ad 13:da2cedce4920
       
     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:  Defines the CATMemoryAddress class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __CATMEMORYADDRESS_H__
       
    20 #define __CATMEMORYADDRESS_H__
       
    21 
       
    22 #include "../inc/ATCommonDefines.h"
       
    23 
       
    24 /**
       
    25 * Represents a single memory address / call stack item.
       
    26 * State tells the "success" of locating the symbol / code line.
       
    27 * Contains some utility functions used in this feature.
       
    28 */
       
    29 class CATMemoryAddress
       
    30 {
       
    31 public:
       
    32 	/**
       
    33 	* Enumeration representing the state of locating code lines.
       
    34 	*/
       
    35 	enum ADDRESS_TO_LINE_STATE
       
    36 	{
       
    37 		OUT_OF_PROCESS = 0, /** Not located code line.*/
       
    38 		OUT_OF_RANGE, /** Outside functions range. */
       
    39 		SYMBOL, /** Symbol/ Function located (no codeline) */
       
    40 		FUNCTION, /** Function and line number.*/
       
    41 		EXACT /** Exact code line located with all information.*/
       
    42 	};
       
    43 	/**
       
    44 	* Constructor
       
    45 	* @param sAddress
       
    46 	* @param iOffSet value used if need to use offset value
       
    47 	*/
       
    48 	CATMemoryAddress( string& sAddress, unsigned long iOffSet );
       
    49 	/**
       
    50 	* Destructor
       
    51 	*/
       
    52 	virtual ~CATMemoryAddress();
       
    53 	/**
       
    54 	* Find which binary this address belongs to.
       
    55 	* Sets also the offsetfrommodulestart.
       
    56 	* @param vDlls container of binarys to find from.
       
    57 	* @return true if found
       
    58 	*/
       
    59 	bool FindSetModuleName(vector<DLL_LOAD_INFO>* vDlls);
       
    60 	/**
       
    61 	* Get vector index to which module we found this address to belong to.
       
    62 	* @return -1 if not set.
       
    63 	*/
       
    64 	int GetDllLoadInfoIndex();
       
    65 	/**
       
    66 	* Note return value includes the set offset.
       
    67 	* So this value is not binary start - address.
       
    68 	* Instead it is.
       
    69 	* memory address - binary start address + offset
       
    70 	* @return adress
       
    71 	*/
       
    72 	unsigned long GetOffSetFromModuleStart();
       
    73 	/**
       
    74 	* Get the binary start address
       
    75 	* @return binary start address
       
    76 	*/
       
    77 	unsigned long GetModuleStartAddress() const;
       
    78 	/**
       
    79 	* Set time
       
    80 	* @param ullTime
       
    81 	*/
       
    82 	void SetTime( unsigned long long& ullTime );
       
    83 	/**
       
    84 	* Get time
       
    85 	* @return unsigned long long
       
    86 	*/
       
    87 	unsigned long long GetTime();
       
    88 	/**
       
    89 	* Set address
       
    90 	* @param sAddess
       
    91 	*/
       
    92 	void SetAddress( string& sAddress );
       
    93 	/**
       
    94 	* Get address string
       
    95 	* @return string
       
    96 	*/
       
    97 	string GetAddressString();
       
    98 	/**
       
    99 	* Set address
       
   100 	* @param iAddress
       
   101 	*/
       
   102 	void SetAddress( unsigned long iAddress );
       
   103 	/**
       
   104 	* Get Address
       
   105 	* @return unsigned long
       
   106 	*/
       
   107 	unsigned long GetAddress();
       
   108 	/**
       
   109 	* Set module name
       
   110 	* @param sModuleName
       
   111 	*/
       
   112 	void SetModuleName( string& sModuleName );
       
   113 	/**
       
   114 	* Get module name
       
   115 	* @return string
       
   116 	*/
       
   117 	string GetModuleName();
       
   118 	/**
       
   119 	* Set state of locating code line
       
   120 	* @param eState
       
   121 	*/
       
   122 	void SetAddressToLineState( ADDRESS_TO_LINE_STATE eState );
       
   123 	/**
       
   124 	* Get current state of locating code line
       
   125 	* @return int
       
   126 	*/
       
   127 	int GetAddressToLineState();
       
   128 	/**
       
   129 	* Set filename
       
   130 	* @param sFileName
       
   131 	*/
       
   132 	void SetFileName(string& sFileName);
       
   133 	/**
       
   134 	* Get filename
       
   135 	* @return string
       
   136 	*/
       
   137 	string GetFileName();
       
   138 	/**
       
   139 	* Set function name
       
   140 	* @param sFunctionName
       
   141 	*/
       
   142 	void SetFunctionName(string& sFunctionName);
       
   143 	/**
       
   144 	* Get function name
       
   145 	* @return string
       
   146 	*/
       
   147 	string GetFunctionName();
       
   148 	/**
       
   149 	* Set function line number
       
   150 	* @param iFunctionLineNumber
       
   151 	*/
       
   152 	void SetFunctionLineNumber(int iFunctionLineNumber);
       
   153 	/**
       
   154 	* Get function line number
       
   155 	* @return int
       
   156 	*/
       
   157 	int GetFunctionLineNumber();
       
   158 	/**
       
   159 	* Set exact line number
       
   160 	* @param iExactLineNumber
       
   161 	*/
       
   162 	void SetExactLineNumber(int iExactLineNumber);
       
   163 	/**
       
   164 	* Get exact line number
       
   165 	* @return int
       
   166 	*/
       
   167 	int GetExactLineNumber();
       
   168 	/**
       
   169 	* Set module start address
       
   170 	* @param iAddress
       
   171 	*/
       
   172 	void SetModuleStartAddress(unsigned long iAddress);
       
   173 
       
   174 #ifndef MODULE_TEST
       
   175 private:
       
   176 #endif
       
   177 	// Used offset to add to addresses
       
   178 	unsigned long m_iOffSet;
       
   179 	// Address related members
       
   180 	string m_sAddress;
       
   181 	unsigned long m_iAddress;
       
   182 
       
   183 	// Time (microseconds from 1970)
       
   184 	unsigned long long m_iTime;
       
   185 
       
   186 	// Module related members(if FindSetModule is successful)
       
   187 	string m_sModuleName;
       
   188 	unsigned long m_iOffSetFromModuleStart;
       
   189 	unsigned long m_iModuleStartAddress;
       
   190 
       
   191 	// Module to which address belong.
       
   192 	int m_iDllLoadinfoIndex;
       
   193 
       
   194 	// Pin pointing related members
       
   195 	int m_ePinPointState;
       
   196 	string m_sFileName;
       
   197 	string m_sFunctionName;
       
   198 
       
   199 	int m_iFunctionLineNumber;
       
   200 	int m_iExactLineNumber;
       
   201 };
       
   202 #endif