| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CLibSymbolInfo Class Reference

`#include <LibSymbolInfo.h>`

Collaboration diagram for CLibSymbolInfo:
[legend]

## Public Member Functions
| CLibSymbolInfo ()
virtual | ~CLibSymbolInfo ()
BOOL | DumpSymbols (LPTSTR lpszLibPathName, std::ostream &pFile)
std::string | GetLastError () const

## Protected Member Functions
BOOL | Dump (LPTSTR lpszLibPathName, std::ostream &pFile)
BOOL | IsRegularLibSymbol (PSTR pszSymbolName)
BOOL | IsFiltedSymbol (std::string &pszSymbolName)
DWORD | ConvertBigEndian (DWORD bigEndian)

## Protected Attributes
std::string | m_strResultsString
std::string | m_strErrorMsg

## Detailed Description

Definition at line 15 of file LibSymbolInfo.h.

## Constructor & Destructor Documentation

CLibSymbolInfo::CLibSymbolInfo | ( |  | ) |

Definition at line 23 of file LibSymbolInfo.cpp.

24 {
25 }

CLibSymbolInfo::~CLibSymbolInfo | ( |  | ) |
| virtual

Definition at line 27 of file LibSymbolInfo.cpp.

28 {
29 }

## Member Function Documentation

DWORD CLibSymbolInfo::ConvertBigEndian | ( | DWORD | bigEndian | ) |
| protected

Definition at line 179 of file LibSymbolInfo.cpp.

180 {
181 DWORD temp = 0;
182
183 temp |= bigEndian >> 24;
184 temp |= ((bigEndian & 0x00FF0000) >> 8);
185 temp |= ((bigEndian & 0x0000FF00) << 8);
186 temp |= ((bigEndian & 0x000000FF) << 24);
187
188 return temp;
189 }

BOOL CLibSymbolInfo::Dump | ( | LPTSTR | lpszLibPathName,
|  | std::ostream & | pFile
| ) |  |
| protected

Definition at line 67 of file LibSymbolInfo.cpp.

68 {
69 string sBuff;
70 MEMORY_MAPPED_FILE libFile(lpszLibPathName);
71
72 // Ensure that the file mapping worked
73 if( FALSE == libFile.IsValid() ) {
74 m_strErrorMsg = "Unable to access file ";
75 m_strErrorMsg+= lpszLibPathName;
76 return FALSE;
77 }
78 // All COFF libraries start with the string "!<arch>\n". Verify that this
79 // string is at the beginning of the mapped file
80
81 PSTR pArchiveStartString = (PSTR)libFile.GetBase();
82
83 if ( 0 != strncmp( pArchiveStartString, IMAGE_ARCHIVE_START,
84 IMAGE_ARCHIVE_START_SIZE ) ) {
85 m_strErrorMsg.assign("Not a valid COFF LIB file.");
86 return FALSE;
87 }
88
89 // Point to the first archive member. This entry contains the LIB symbols,
90 // and immediately follows the archive start string ("!<arch>\n")
91 PIMAGE_ARCHIVE_MEMBER_HEADER pMbrHdr;
92 pMbrHdr = MakePtr( PIMAGE_ARCHIVE_MEMBER_HEADER, pArchiveStartString,
93 IMAGE_ARCHIVE_START_SIZE );
94
95 // First DWORD after this member header is a symbol count
96 PDWORD pcbSymbols = (PDWORD)(pMbrHdr + 1); // Pointer math!
97
98 // The symbol count is stored in big endian format, so adjust as
99 // appropriate for the target architecture
100 DWORD cSymbols = ConvertBigEndian( *pcbSymbols );
101
102 // Following the symbol count is an array of offsets to archive members
103 // (essentially, embedded .OBJ files)
104 PDWORD pMemberOffsets = pcbSymbols + 1; // Pointer math!
105
106 // Following the array of member offsets is an array of offsets to symbol
107 // names.
108 PSTR pszSymbolName = MakePtr( PSTR, pMemberOffsets, 4 * cSymbols );
109
110 //
111 // Loop through every symbol in the first archive member
112 //
113 for ( unsigned i = 0; i < cSymbols; i++ )
114 {
115 DWORD offset;
116
117 // The offsets to the archive member that contains the symbol is stored
118 // in big endian format, so convert it appropriately.
119 offset = ConvertBigEndian( *pMemberOffsets );
120
121 // Call DisplayLibInfoForSymbol, which figures out what kind of symbol
122 // it is. The "IsRegularLibSymbol" filters out symbols that are
123 // internal to the linking process
124 if ( IsRegularLibSymbol( pszSymbolName ) ) {
125 string symbol(pszSymbolName);
126 if (IsFiltedSymbol(symbol) ) {
127 pFile << symbol << endl;
128 }
129 }
130 // Advanced to the next symbol offset and name. The MemberOffsets
131 // array has fixed length entries, while the symbol names are
132 // sequential null-terminated strings
133 pMemberOffsets++;
134 pszSymbolName += strlen(pszSymbolName) + 1;
135 }
136 return TRUE;
137 }
std::endl
T endl(T...args)
GaudiKernel.Constants.TRUE
TRUE
for job options legacy (TODO: get rid of these!) ----------------------—
Definition: Constants.py:20
MakePtr
#define MakePtr(cast, ptr, addValue)
Definition: LibSymbolInfo.cpp:18
std::strlen
T strlen(T...args)
GaudiKernel.Constants.FALSE
FALSE
Definition: Constants.py:21
CLibSymbolInfo::m_strErrorMsg
std::string m_strErrorMsg
Definition: LibSymbolInfo.h:25
MEMORY_MAPPED_FILE
Definition: LibSymbolInfo.h:36
std::string::assign
T assign(T...args)
std::strncmp
T strncmp(T...args)
CLibSymbolInfo::IsFiltedSymbol
BOOL IsFiltedSymbol(std::string &pszSymbolName)
Definition: LibSymbolInfo.cpp:159
CLibSymbolInfo::ConvertBigEndian
DWORD ConvertBigEndian(DWORD bigEndian)
Definition: LibSymbolInfo.cpp:179
ana.i
list i
Definition: ana.py:128
CLibSymbolInfo::IsRegularLibSymbol
BOOL IsRegularLibSymbol(PSTR pszSymbolName)
Definition: LibSymbolInfo.cpp:143

BOOL CLibSymbolInfo::DumpSymbols | ( | LPTSTR | lpszLibPathName,
|  | std::ostream & | pFile
| ) |  |

Definition at line 43 of file LibSymbolInfo.cpp.

44 {
45 if(lpszLibPathName == NULL || pFile.bad() ) {
46 assert(lpszLibPathName != NULL);
47 assert(pFile.good());
48 m_strErrorMsg.assign("NULL <lpszLibPathName> or Invalid file handle.");
49 return FALSE;
50 }
51
52 if(!Dump(lpszLibPathName, pFile)) return FALSE;
53 return TRUE;
54 }
std::ostream::good
T good(T...args)
GaudiKernel.Constants.TRUE
TRUE
for job options legacy (TODO: get rid of these!) ----------------------—
Definition: Constants.py:20
CLibSymbolInfo::Dump
BOOL Dump(LPTSTR lpszLibPathName, std::ostream &pFile)
Definition: LibSymbolInfo.cpp:67
GaudiKernel.Constants.FALSE
FALSE
Definition: Constants.py:21
CLibSymbolInfo::m_strErrorMsg
std::string m_strErrorMsg
Definition: LibSymbolInfo.h:25
std::string::assign
T assign(T...args)
std::ostream::bad
T bad(T...args)

string CLibSymbolInfo::GetLastError | ( |  | ) | const

Definition at line 191 of file LibSymbolInfo.cpp.

192 {
193 return m_strErrorMsg;
194 }
CLibSymbolInfo::m_strErrorMsg
std::string m_strErrorMsg
Definition: LibSymbolInfo.h:25

BOOL CLibSymbolInfo::IsFiltedSymbol | ( | std::string & | pszSymbolName | ) |
| protected

Definition at line 159 of file LibSymbolInfo.cpp.

160 {
161 if ( symbolName.compare(0,2,"__") == 0 )
162 return FALSE;
163 if ( symbolName.compare(0,3,"??_") == 0 && symbolName[3] != '0') // Keep 'operator/=' [??_0]
164 return FALSE;
165 if( symbolName[0] == '_') {
166 symbolName.erase(0, 1); // C functions ...
167 }
168 // Filter the internal Boost symbols
169 if (symbolName.find ("detail@boost") != string::npos )
170 return FALSE;
171 if (symbolName.find ("details@boost") != string::npos )
172 return FALSE;
173 return TRUE;
174 }
GaudiKernel.Constants.TRUE
TRUE
for job options legacy (TODO: get rid of these!) ----------------------—
Definition: Constants.py:20
GaudiKernel.Constants.FALSE
FALSE
Definition: Constants.py:21

BOOL CLibSymbolInfo::IsRegularLibSymbol | ( | PSTR | pszSymbolName | ) |
| protected

Definition at line 143 of file LibSymbolInfo.cpp.

144 {
145 if ( 0 == strncmp( pszSymbolName, "__IMPORT_DESCRIPTOR_", 20 ) )
146 return FALSE;
147
148 if ( 0 == strncmp( pszSymbolName, "__NULL_IMPORT_DESCRIPTOR", 24 ) )
149 return FALSE;
150
151 if ( strstr( pszSymbolName, "_NULL_THUNK_DATA" ) )
152 return FALSE;
153
154 return TRUE;
155 }
GaudiKernel.Constants.TRUE
TRUE
for job options legacy (TODO: get rid of these!) ----------------------—
Definition: Constants.py:20
GaudiKernel.Constants.FALSE
FALSE
Definition: Constants.py:21
std::strncmp
T strncmp(T...args)
std::strstr
T strstr(T...args)

## Member Data Documentation

std::string CLibSymbolInfo::m_strErrorMsg
| protected

Definition at line 25 of file LibSymbolInfo.h.

std::string CLibSymbolInfo::m_strResultsString
| protected

Definition at line 24 of file LibSymbolInfo.h.

The documentation for this class was generated from the following files:

- GaudiKernel/src/Util/LibSymbolInfo.h
- GaudiKernel/src/Util/LibSymbolInfo.cpp