| The Gaudi Framework v32r1 (f65d50dc)

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::CLibSymbolInfo | ( |  | ) |

Definition at line 21 of file LibSymbolInfo.cpp.

21 {}

## ◆ ~CLibSymbolInfo()

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

Definition at line 23 of file LibSymbolInfo.cpp.

23 {}

## Member Function Documentation

## ◆ ConvertBigEndian()

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

Definition at line 158 of file LibSymbolInfo.cpp.

158 {
159 DWORD temp = 0;
160
161 temp |= bigEndian >> 24;
162 temp |= ( ( bigEndian & 0x00FF0000 ) >> 8 );
163 temp |= ( ( bigEndian & 0x0000FF00 ) << 8 );
164 temp |= ( ( bigEndian & 0x000000FF ) << 24 );
165
166 return temp;
167 }

## ◆ Dump()

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

Definition at line 60 of file LibSymbolInfo.cpp.

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

## ◆ DumpSymbols()

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

Definition at line 37 of file LibSymbolInfo.cpp.

37 {
38 if ( lpszLibPathName == NULL || pFile.bad() ) {
39 assert( lpszLibPathName != NULL );
40 assert( pFile.good() );
41 m_strErrorMsg.assign( "NULL <lpszLibPathName> or Invalid file handle." );
42 return FALSE;
43 }
44
45 if ( !Dump( lpszLibPathName, pFile ) ) return FALSE;
46 return TRUE;
47 }
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:60
CLibSymbolInfo::m_strErrorMsg
std::string m_strErrorMsg
Definition: LibSymbolInfo.h:24
GaudiKernel.Constants.FALSE
bool FALSE
Definition: Constants.py:21
std::string::assign
T assign(T... args)
std::ostream::bad
T bad(T... args)

## ◆ GetLastError()

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

Definition at line 169 of file LibSymbolInfo.cpp.

169 { return m_strErrorMsg; }
CLibSymbolInfo::m_strErrorMsg
std::string m_strErrorMsg
Definition: LibSymbolInfo.h:24

## ◆ IsFiltedSymbol()

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

Definition at line 142 of file LibSymbolInfo.cpp.

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

## ◆ IsRegularLibSymbol()

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

Definition at line 130 of file LibSymbolInfo.cpp.

130 {
131 if ( 0 == strncmp( pszSymbolName, "__IMPORT_DESCRIPTOR_", 20 ) ) return FALSE;
132
133 if ( 0 == strncmp( pszSymbolName, "__NULL_IMPORT_DESCRIPTOR", 24 ) ) return FALSE;
134
135 if ( strstr( pszSymbolName, "_NULL_THUNK_DATA" ) ) return FALSE;
136
137 return TRUE;
138 }
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

## ◆ m_strErrorMsg

std::string CLibSymbolInfo::m_strErrorMsg
| protected

Definition at line 24 of file LibSymbolInfo.h.

## ◆ m_strResultsString

std::string CLibSymbolInfo::m_strResultsString
| protected

Definition at line 23 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