[100f517] | 1 | /*! @file ExecutableInfo.h |
---|
| 2 | * @brief ExecutableInfo Specification |
---|
| 3 | * |
---|
| 4 | * This file contains the specification of the ExecutableInfo class. |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | #ifndef __EXECUTABLEINFO_H__ |
---|
| 8 | #define __EXECUTABLEINFO_H__ |
---|
| 9 | |
---|
| 10 | #include <map> |
---|
| 11 | #include <stdint.h> |
---|
| 12 | #include <string> |
---|
| 13 | |
---|
| 14 | #include "CoverageMapBase.h" |
---|
| 15 | #include "SymbolTable.h" |
---|
| 16 | |
---|
| 17 | namespace Coverage { |
---|
| 18 | |
---|
| 19 | /*! @class ExecutableInfo |
---|
| 20 | * |
---|
| 21 | * This class holds a collection of information for an executable |
---|
| 22 | * that is to be analyzed. |
---|
| 23 | */ |
---|
| 24 | class ExecutableInfo { |
---|
| 25 | |
---|
| 26 | public: |
---|
| 27 | |
---|
| 28 | /*! |
---|
| 29 | * This method constructs an ExecutableInfo instance. |
---|
| 30 | * |
---|
| 31 | * @param[in] theExecutableName specifies the name of the executable |
---|
| 32 | * @param[in] theLibraryName specifies the name of the executable |
---|
| 33 | */ |
---|
| 34 | ExecutableInfo( |
---|
| 35 | const char* const theExecutableName, |
---|
| 36 | const char* const theLibraryName = NULL |
---|
| 37 | ); |
---|
| 38 | |
---|
| 39 | /*! |
---|
| 40 | * This method destructs an ExecutableInfo instance. |
---|
| 41 | */ |
---|
| 42 | virtual ~ExecutableInfo(); |
---|
| 43 | |
---|
| 44 | /*! |
---|
| 45 | * This method prints the contents of all coverage maps for |
---|
| 46 | * this executable. |
---|
| 47 | */ |
---|
| 48 | void dumpCoverageMaps( void ); |
---|
| 49 | |
---|
| 50 | /*! |
---|
| 51 | * This method prints the contents of Executable info containers |
---|
| 52 | */ |
---|
| 53 | void dumpExecutableInfo( void ); |
---|
| 54 | |
---|
| 55 | /*! |
---|
| 56 | * This method returns a pointer to the executable's coverage map |
---|
| 57 | * that contains the specified address. |
---|
| 58 | * |
---|
| 59 | * @param[in] address specifies the desired address |
---|
| 60 | * |
---|
| 61 | * @return Returns a pointer to the coverage map |
---|
| 62 | */ |
---|
| 63 | CoverageMapBase* getCoverageMap( uint32_t address ); |
---|
| 64 | |
---|
| 65 | /*! |
---|
| 66 | * This method returns the file name of the executable. |
---|
| 67 | * |
---|
| 68 | * @return Returns the executable's file name |
---|
| 69 | */ |
---|
[3e187ba] | 70 | const std::string& getFileName( void ) const; |
---|
[100f517] | 71 | |
---|
| 72 | /*! |
---|
| 73 | * This method returns the library name associated with the executable. |
---|
| 74 | * |
---|
| 75 | * @return Returns the executable's library name |
---|
| 76 | */ |
---|
[3e187ba] | 77 | const std::string& getLibraryName( void ) const; |
---|
[100f517] | 78 | |
---|
| 79 | /*! |
---|
| 80 | * This method returns the load address of the dynamic library |
---|
| 81 | * |
---|
| 82 | * @return Returns the load address of the dynamic library |
---|
| 83 | */ |
---|
| 84 | uint32_t getLoadAddress( void ) const; |
---|
| 85 | |
---|
| 86 | /*! |
---|
| 87 | * This method returns a pointer to the executable's symbol table. |
---|
| 88 | * |
---|
| 89 | * @return Returns a pointer to the symbol table. |
---|
| 90 | */ |
---|
| 91 | SymbolTable* getSymbolTable( void ) const; |
---|
| 92 | |
---|
| 93 | /*! |
---|
| 94 | * This method creates a coverage map for the specified symbol. |
---|
| 95 | * |
---|
[cb018bc] | 96 | * @param[in] exefileName specifies the source of the information |
---|
[100f517] | 97 | * @param[in] symbolName specifies the name of the symbol |
---|
| 98 | * @param[in] lowAddress specifies the low address of the coverage map |
---|
| 99 | * @param[in] highAddress specifies the high address of the coverage map |
---|
| 100 | * |
---|
| 101 | * @return Returns a pointer to the coverage map |
---|
| 102 | */ |
---|
| 103 | CoverageMapBase* createCoverageMap ( |
---|
[cb018bc] | 104 | const std::string& exefileName, |
---|
[100f517] | 105 | const std::string& symbolName, |
---|
| 106 | uint32_t lowAddress, |
---|
| 107 | uint32_t highAddress |
---|
| 108 | ); |
---|
| 109 | |
---|
| 110 | /*! |
---|
| 111 | * This method indicates whether a dynamic library has been |
---|
| 112 | * associated with the executable. |
---|
| 113 | * |
---|
[3e187ba] | 114 | * @return Returns TRUE if |
---|
[100f517] | 115 | */ |
---|
| 116 | bool hasDynamicLibrary( void ); |
---|
| 117 | |
---|
| 118 | /*! |
---|
| 119 | * This method merges the coverage maps for this executable into |
---|
| 120 | * the unified coverage map. |
---|
| 121 | */ |
---|
| 122 | void mergeCoverage( void ); |
---|
| 123 | |
---|
| 124 | /*! |
---|
| 125 | * This method sets the load address of the dynamic library |
---|
| 126 | * |
---|
| 127 | * @param[in] address specifies the load address of the dynamic |
---|
| 128 | * library |
---|
| 129 | */ |
---|
| 130 | void setLoadAddress( uint32_t address ); |
---|
| 131 | |
---|
| 132 | private: |
---|
| 133 | |
---|
| 134 | /*! |
---|
| 135 | * This map associates a symbol with its coverage map. |
---|
| 136 | */ |
---|
| 137 | typedef std::map<std::string, CoverageMapBase *> coverageMaps_t; |
---|
| 138 | coverageMaps_t coverageMaps; |
---|
| 139 | |
---|
| 140 | /*! |
---|
| 141 | * This member variable contains the name of the executable. |
---|
| 142 | */ |
---|
| 143 | std::string executableName; |
---|
| 144 | |
---|
| 145 | /*! |
---|
| 146 | * This member variable contains the name of a dynamic library |
---|
| 147 | * associated with the executable. |
---|
| 148 | */ |
---|
| 149 | std::string libraryName; |
---|
| 150 | |
---|
| 151 | /*! |
---|
| 152 | * This member variable contains the load address of a dynamic library |
---|
| 153 | * if one has been specified for the executable. |
---|
| 154 | */ |
---|
| 155 | uint32_t loadAddress; |
---|
| 156 | |
---|
| 157 | /*! |
---|
| 158 | * This member variable contains a pointer to the symbol table |
---|
| 159 | * of the executable or library. |
---|
| 160 | */ |
---|
| 161 | SymbolTable* theSymbolTable; |
---|
| 162 | |
---|
| 163 | }; |
---|
| 164 | } |
---|
| 165 | #endif |
---|