| The Gaudi Framework v30r0 (c919700c)

- 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 21 of file LibSymbolInfo.cpp.

21 {}

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

Definition at line 23 of file LibSymbolInfo.cpp.

23 {}

## Member Function Documentation

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

Definition at line 164 of file LibSymbolInfo.cpp.

165 {
166 DWORD temp = 0;
167
168 temp |= bigEndian >> 24;
169 temp |= ( ( bigEndian & 0x00FF0000 ) >> 8 );
170 temp |= ( ( bigEndian & 0x0000FF00 ) << 8 );
171 temp |= ( ( bigEndian & 0x000000FF ) << 24 );
172
173 return temp;
174 }

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

Definition at line 61 of file LibSymbolInfo.cpp.

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

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

Definition at line 37 of file LibSymbolInfo.cpp.

38 {
39 if ( lpszLibPathName == NULL || pFile.bad() ) {
40 assert( lpszLibPathName != NULL );
41 assert( pFile.good() );
42 m_strErrorMsg.assign( "NULL <lpszLibPathName> or Invalid file handle." );
43 return FALSE;
44 }
45
46 if ( !Dump( lpszLibPathName, pFile ) ) return FALSE;
47 return TRUE;
48 }
std::ostream::good
T good(T...args)
GaudiKernel.Constants.TRUE
bool TRUE
Definition: Constants.py:20
CLibSymbolInfo::Dump
BOOL Dump(LPTSTR lpszLibPathName, std::ostream &pFile)
Definition: LibSymbolInfo.cpp:61
CLibSymbolInfo::m_strErrorMsg
std::string m_strErrorMsg
Definition: LibSymbolInfo.h:25
GaudiKernel.Constants.FALSE
bool FALSE
Definition: Constants.py:21
std::string::assign
T assign(T...args)
std::ostream::bad
T bad(T...args)

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

Definition at line 176 of file LibSymbolInfo.cpp.

176 { return m_strErrorMsg; }
CLibSymbolInfo::m_strErrorMsg
std::string m_strErrorMsg
Definition: LibSymbolInfo.h:25

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

Definition at line 147 of file LibSymbolInfo.cpp.

148 {
149 if ( symbolName.compare( 0, 2, "__" ) == 0 ) return FALSE;
150 if ( symbolName.compare( 0, 3, "??_" ) == 0 && symbolName[3] != '0' ) // Keep 'operator/=' [??_0]
151 return FALSE;
152 if ( symbolName[0] == '_' ) {
153 symbolName.erase( 0, 1 ); // C functions ...
154 }
155 // Filter the internal Boost symbols
156 if ( symbolName.find( "detail@boost" ) != string::npos ) return FALSE;
157 if ( symbolName.find( "details@boost" ) != string::npos ) return FALSE;
158 return TRUE;
159 }
GaudiKernel.Constants.TRUE
bool TRUE
Definition: Constants.py:20
GaudiKernel.Constants.FALSE
bool FALSE
Definition: Constants.py:21

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

Definition at line 134 of file LibSymbolInfo.cpp.

135 {
136 if ( 0 == strncmp( pszSymbolName, "__IMPORT_DESCRIPTOR_", 20 ) ) return FALSE;
137
138 if ( 0 == strncmp( pszSymbolName, "__NULL_IMPORT_DESCRIPTOR", 24 ) ) return FALSE;
139
140 if ( strstr( pszSymbolName, "_NULL_THUNK_DATA" ) ) return FALSE;
141
142 return TRUE;
143 }
GaudiKernel.Constants.TRUE
bool TRUE
Definition: Constants.py:20
GaudiKernel.Constants.FALSE
bool 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