source: rtems-tools/tester/covoar/ExecutableInfo.h @ 99c90b3

Last change on this file since 99c90b3 was 99c90b3, checked in by Chris Johns <chrisj@…>, on Aug 5, 2018 at 11:41:08 PM

tester/covoar: Integrate DWARF function data.

Use DAWRF function data to create the executable coverage
maps. Integrate the existing objdump processing with this
data.

  • Refactor CoverageMapBase? to have the address ranges and address info as separate objects. Move the to address info into a vector. Add support for multiple address ranges.
  • DesiredSymbols? is only interested in function symbols.
  • ExecutableInfo? creates coverage maps from DWARF function data.
  • Add warning flags to the covoar build.
  • Varous C++11 refactoring.
  • Property mode set to 100644
File size: 4.9 KB
Line 
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 <rld-dwarf.h>
15#include <rld-files.h>
16#include <rld-symbols.h>
17
18#include "CoverageMapBase.h"
19#include "SymbolTable.h"
20
21namespace Coverage {
22
23  /*! @class ExecutableInfo
24   *
25   *  This class holds a collection of information for an executable
26   *  that is to be analyzed.
27   */
28  class ExecutableInfo {
29
30  public:
31
32    /*!
33     *  This method constructs an ExecutableInfo instance.
34     *
35     *  @param[in] theExecutableName specifies the name of the executable
36     *  @param[in] theLibraryName specifies the name of the executable
37     */
38    ExecutableInfo(
39      const char* const theExecutableName,
40      const char* const theLibraryName = NULL,
41      bool              verbose = false
42    );
43
44    /*!
45     *  This method destructs an ExecutableInfo instance.
46     */
47    virtual ~ExecutableInfo();
48
49    /*!
50     *  This method prints the contents of all coverage maps for
51     *  this executable.
52     */
53    void dumpCoverageMaps( void );
54
55    /*!
56     *  This method prints the contents of Executable info containers
57     */
58    void dumpExecutableInfo( void );
59
60    /*!
61     *  This method returns a pointer to the executable's coverage map
62     *  that contains the specified address.
63     *
64     *  @param[in] address specifies the desired address
65     *
66     *  @return Returns a pointer to the coverage map
67     */
68    CoverageMapBase* getCoverageMap( uint32_t address );
69
70    /*!
71     *  This method returns the file name of the executable.
72     *
73     *  @return Returns the executable's file name
74     */
75    const std::string getFileName( void ) const;
76
77    /*!
78     *  This method returns the library name associated with the executable.
79     *
80     *  @return Returns the executable's library name
81     */
82    const std::string getLibraryName( void ) const;
83
84    /*!
85     *  This method returns the load address of the dynamic library
86     *
87     *  @return Returns the load address of the dynamic library
88     */
89    uint32_t getLoadAddress( void ) const;
90
91    /*!
92     *  This method returns a pointer to the executable's symbol table.
93     *
94     *  @return Returns a pointer to the symbol table.
95     */
96    SymbolTable* getSymbolTable( void );
97
98    /*!
99     *  This method finds a coverage map for the specified symbol.
100     *
101     *  @param[in] symbolName specifies the name of the symbol
102     *
103     *  @return Returns a reference to the coverage map
104     */
105    CoverageMapBase& findCoverageMap( const std::string& symbolName );
106
107    /*!
108     *  This method gets the source location, the file and line number given an
109     *  address.
110     */
111    void getSourceAndLine(
112      const unsigned int address,
113      std::string&       location
114    );
115
116    /*!
117     *  This method indicates whether a dynamic library has been
118     *  associated with the executable.
119     *
120     *  @return Returns TRUE if
121     */
122    bool hasDynamicLibrary( void );
123
124    /*!
125     *  This method merges the coverage maps for this executable into
126     *  the unified coverage map.
127     */
128    void mergeCoverage( void );
129
130    /*!
131     *  This method sets the load address of the dynamic library
132     *
133     *  @param[in] address specifies the load address of the dynamic
134     *             library
135     */
136    void setLoadAddress( uint32_t address );
137
138  private:
139
140    /*!
141     *  This method creates a coverage map for the specified symbol.
142     *
143     *  @param[in] exefileName specifies the source of the information
144     *  @param[in] symbolName specifies the name of the symbol
145     *  @param[in] lowAddress specifies the low address of the coverage map
146     *  @param[in] highAddress specifies the high address of the coverage map
147     */
148    void createCoverageMap (
149      const std::string& exefileName,
150      const std::string& symbolName,
151      uint32_t           lowAddress,
152      uint32_t           highAddress
153    );
154
155    /*!
156     *  The ELF executable.
157     */
158    rld::files::object executable;
159
160    /*!
161     *  The DWARF data to the ELF executable.
162     */
163    rld::dwarf::file debug;
164
165    /*!
166     *  The executable's symbol table.
167     */
168    rld::symbols::table symbols;
169
170    /*!
171     *  This map associates a symbol with its coverage map.
172     */
173    typedef std::map<std::string, CoverageMapBase *> CoverageMaps;
174    CoverageMaps coverageMaps;
175
176    /*!
177     *  This member variable contains the name of a dynamic library
178     *  associated with the executable.
179     */
180    std::string libraryName;
181
182    /*!
183     *  This member variable contains the load address of a dynamic library
184     *  if one has been specified for the executable.
185     */
186    uint32_t loadAddress;
187
188    /*!
189     *  This member variable contains a pointer to the symbol table
190     *  of the executable or library.
191     */
192    SymbolTable theSymbolTable;
193
194  };
195}
196#endif
Note: See TracBrowser for help on using the repository browser.