Pin
Classes | Enumerations | Functions
SYM: Symbol Object

Classes

class  LEVEL_PINCLIENT::SymbolAddressRange
 
struct  LEVEL_PINCLIENT::SymbolDebugInfo
 

Enumerations

enum  LEVEL_PINCLIENT::UNDECORATION {
  LEVEL_PINCLIENT::UNDECORATION_COMPLETE,
  LEVEL_PINCLIENT::UNDECORATION_NAME_ONLY
}
 

Functions

SYM LEVEL_PINCLIENT::SYM_Next (SYM x)
 
SYM LEVEL_PINCLIENT::SYM_Prev (SYM x)
 
const std::string & LEVEL_PINCLIENT::SYM_Name (SYM x)
 
SYM LEVEL_PINCLIENT::SYM_Invalid ()
 
BOOL LEVEL_PINCLIENT::SYM_Valid (SYM x)
 
BOOL LEVEL_PINCLIENT::SYM_Dynamic (SYM x)
 
BOOL LEVEL_PINCLIENT::SYM_GeneratedByPin (SYM x)
 
BOOL LEVEL_PINCLIENT::SYM_IFuncImplementation (SYM x)
 
BOOL LEVEL_PINCLIENT::SYM_IFuncResolver (SYM x)
 
ADDRINT LEVEL_PINCLIENT::SYM_Value (SYM x)
 
UINT32 LEVEL_PINCLIENT::SYM_Index (SYM x)
 
ADDRINT LEVEL_PINCLIENT::SYM_Address (SYM x)
 
std::string LEVEL_PINCLIENT::PIN_UndecorateSymbolName (const std::string &symbolName, UNDECORATION style)
 

Detailed Description

Symbol objects provide information about function symbols in the application. See Symbols for more information.

You must call PIN_InitSymbols to make symbols available.

Can be accessed at instrumentation time and analysis time.
APIs from this group are available in any thread, including any internal thread spawned by the tool.

Iteration idioms:

// Forward pass over all symbols in an image
for( SYM sym= IMG_RegsymHead(img); SYM_Valid(sym); sym = SYM_Next(sym) )
Availability:
Mode: JIT & Probe
O/S: Linux & Windows
CPU: All

Enumeration Type Documentation

◆ UNDECORATION

List of supported symbol name undecoration styles. Used in PIN_UndecorateSymbolName()

Enumerator
UNDECORATION_COMPLETE 

Undecorate to full symbol signature.

UNDECORATION_NAME_ONLY 

Undecorate to [scope::]name.

Function Documentation

◆ PIN_UndecorateSymbolName()

std::string LEVEL_PINCLIENT::PIN_UndecorateSymbolName ( const std::string &  symbolName,
UNDECORATION  style 
)

Undecorate symbol name.
Provides undecoration of C++ names and decorated C names. The behavior of this function
is compiler and OS specific.
The C++ mangled name is undecorated either to its full signature (UNDECORATION_COMPLETE style)
or to [scope::]name form (UNDECORATION_NAME_ONLY style).
Example of undecoration of symbol generated by Microsoft compiler in Windows:

Style Original name Undecorated name
===================== ================== ======================================
UNDECORATION_COMPLETE ?foo@ccc@@QAEPADH@Z public: char * __thiscall ccc::foo(int)

Symbol name decorated according to Windows IA32 C calling conventions is undecorated as follows:

_foo -> foo (__cdecl convention)
_foo@4 -> foo (__stdcall convention)
@foo@12 -> foo (__fastcall convention)

Example of undecoration of symbol generated by GCC compiler on Linux:

Style Original name Undecorated name
===================== ================== ======================================
UNDECORATION_COMPLETE _ZN1A7method1ERKSt6vectorIiSaIiEE A::method1(std::vector<int, std::allocator<int> > const&)

Undecoration of macOS* symbols is done similarly to Linux (Remove the leading '_' and undecorate like Linux)

You should be careful if using this function, since some of the undecorated names it generates for symbols generated by the compiler may not be valid C++ symbol names. For example on Linux demangling can give names like construction vtable for std::istream-in-std::iostream, or non-virtual thunk to std::strstream::~strstream(), which are not valid C++ names.

Parameters
[in]symbolNameDecorated name
[in]styleUndecoration style, relevant only to C++ undecoration
Values:
UNDECORATION_COMPLETE undecorate to full signature
UNDECORATION_NAME_ONLY undecorate to [scope::]name
Returns
string containing undecorated symbol name.
If undecoration fails or not supported, the function returns the unmodified original name.
Availability:
Mode: JIT & Probe
O/S: Windows, Linux & macOS*
CPU: All

◆ SYM_Address()

ADDRINT LEVEL_PINCLIENT::SYM_Address ( SYM  x)
Returns
address of the symbol in memory

◆ SYM_Dynamic()

BOOL LEVEL_PINCLIENT::SYM_Dynamic ( SYM  x)
Returns
True if x is a dynamic symbol

◆ SYM_GeneratedByPin()

BOOL LEVEL_PINCLIENT::SYM_GeneratedByPin ( SYM  x)
Returns
True if x is a symbol which did not appear in the image's original symbol table and was added by Pin (for example when resolving an ifunc). False if the symbol existed in the image's symbol table

◆ SYM_IFuncImplementation()

BOOL LEVEL_PINCLIENT::SYM_IFuncImplementation ( SYM  x)
Returns
True if x is an IFUNC implementation symbol

◆ SYM_IFuncResolver()

BOOL LEVEL_PINCLIENT::SYM_IFuncResolver ( SYM  x)
Returns
True if x is an IFUNC resolver symbol

◆ SYM_Index()

UINT32 LEVEL_PINCLIENT::SYM_Index ( SYM  x)
Returns
section index of a symbol

◆ SYM_Invalid()

SYM LEVEL_PINCLIENT::SYM_Invalid ( )
Returns
Used to indicate no symbol

◆ SYM_Name()

const std::string& LEVEL_PINCLIENT::SYM_Name ( SYM  x)
Returns
Name of symbol

◆ SYM_Next()

SYM LEVEL_PINCLIENT::SYM_Next ( SYM  x)
Returns
Routine that follows x, or SYM_Invalid() if x is the last in the section

◆ SYM_Prev()

SYM LEVEL_PINCLIENT::SYM_Prev ( SYM  x)
Returns
Routine that precedes x, or SYM_Invalid() if x is the first in the section

◆ SYM_Valid()

BOOL LEVEL_PINCLIENT::SYM_Valid ( SYM  x)
Returns
True if x is not SYM_Invalid()

◆ SYM_Value()

ADDRINT LEVEL_PINCLIENT::SYM_Value ( SYM  x)
Returns
Value of symbol, usually an address relative to beginning of image