source: rtems-tools/tester/covoar/SymbolTable.h @ 3e187ba

5
Last change on this file since 3e187ba was 100f517, checked in by Chris Johns <chrisj@…>, on 05/09/14 at 11:50:37

covoar: Merger the covoar source from rtems-testing.git.

Use waf to build covoar.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*! @file SymbolTable.h
2 *  @brief SymbolTable Specification
3 *
4 *  This file contains the specification of the SymbolTable class.
5 */
6
7#ifndef __SYMBOLTABLE_H__
8#define __SYMBOLTABLE_H__
9
10#include <stdint.h>
11#include <string>
12#include <map>
13#include <list>
14
15namespace Coverage {
16
17  /*! @class SymbolTable
18   *
19   *  This class maintains information for each desired symbol within an
20   *  executable.  A desired symbol is a symbol for which analysis is to
21   *  be performed.
22   */
23  class SymbolTable {
24
25  public:
26
27    /*!
28     *  This structure defines the information kept for each symbol.
29     */
30    typedef struct {
31      uint32_t startingAddress;
32      uint32_t length;
33    } symbolInfo_t;
34 
35   typedef std::list< symbolInfo_t > symbolInfo;
36   typedef std::list< symbolInfo_t >::iterator  symbolInfoIterator_t;
37 
38   
39
40    /*!
41     *  This method constructs a SymbolTable instance.
42     */
43    SymbolTable();
44
45    /*!
46     *  This method destructs a SymbolTable instance.
47     */
48    virtual ~SymbolTable();
49
50    /*!
51     *  This method adds the specified symbol information to the
52     *  symbol table.
53     *
54     *  @param[in] symbol specifies the symbol to add
55     *  @param[in] start specifies the symbol's start address
56     *  @param[in] length specifies the symbol's length
57     *
58     */
59    void addSymbol(
60      const std::string& symbol,
61      const uint32_t     start,
62      const uint32_t     length
63    );
64
65    /*!
66     *  This method returns the symbol information for the specified symbol.
67     *
68     *  @param[in] symbol specifies the symbol for which to obtain information
69     *
70     *  @return Returns a pointer to the symbol information
71     */
72    symbolInfo* getInfo(
73      const std::string& symbol
74    );
75
76    /*!
77     *  This method returns the length in bytes of the specified symbol.
78     *
79     *  @param[in] symbol specifies the symbol for which to obtain the length
80     *
81     *  @return Returns the length of the symbol
82     */
83    uint32_t getLength(
84      const std::string& symbol
85    );
86
87    /*!
88     *  This method returns the symbol that contains the specified address.
89     *
90     *  @param[in] address specifies the address for which to obtain the symbol
91     *
92     *  @return Returns the symbol containing the address
93     */
94    std::string getSymbol(
95      uint32_t address
96    );
97
98    /*!
99     *  This method prints SymbolTable content to stdout
100     *
101     */
102    void dumpSymbolTable( void );
103
104  private:
105
106    /*!
107     *  This map associates the end address of a symbol's address
108     *  range with the symbol's address range definition.
109     */
110    typedef struct {
111       uint32_t    low;
112       uint32_t    high;
113       std::string symbol;
114    } symbol_entry_t;
115    typedef std::map< uint32_t, symbol_entry_t > contents_t;
116    contents_t contents;
117
118    /*!
119     *  This map associates each symbol from an executable with
120     *  the symbol's information.
121     */
122    typedef std::map<std::string, symbolInfo> info_t;
123    typedef std::map<std::string, symbolInfo>::iterator infoIterator_t;
124    info_t info;
125
126  };
127}
128#endif
Note: See TracBrowser for help on using the repository browser.