Pin
Public Member Functions | Static Public Member Functions | Friends | List of all members
LEVEL_PINCLIENT::CLIENT_TLS Class Reference

Public Member Functions

TLS_KEY AllocateKey (DESTRUCTFUN destructFun=NULL)
 
BOOL FreeKey (TLS_KEY tlsKey)
 
BOOL IsKeyAllocated (TLS_KEY tlsKey)
 
VOID InitCurrentTls (THREADID currentThreadId)
 
VOID DestructThreadTls (THREADID threadId)
 
BOOL IsCurrentTlsAllocated (THREADID currentThreadId)
 

Static Public Member Functions

static VOID * GetData (TLS_KEY tlsKey, THREADID threadId)
 
static BOOL SetData (TLS_KEY tlsKey, const VOID *value, THREADID threadId)
 
static BOOL IsValidTlsKey (TLS_KEY tlsKey, THREADID threadId)
 
static CLIENT_TLSInstance ()
 

Friends

class DUMMY_GCC32
 

Detailed Description

Singleton that keeps client's TLS data for all active threads

Member Function Documentation

◆ AllocateKey()

TLS_KEY LEVEL_PINCLIENT::CLIENT_TLS::AllocateKey ( DESTRUCTFUN  destructFun = NULL)

Allocate a new TLS key and associate it with a given data destruction function. See PIN_CreateThreadDataKey() description.

◆ DestructThreadTls()

VOID LEVEL_PINCLIENT::CLIENT_TLS::DestructThreadTls ( THREADID  threadId)

Destruct all per-thread data stored in TLS slots of the given thread. This function is called when the given thread is about to exit, just after notifying the client about thread exit.

Parameters
[in]threadIdID of the exiting thread assigned by pin.

◆ FreeKey()

BOOL LEVEL_PINCLIENT::CLIENT_TLS::FreeKey ( TLS_KEY  tlsKey)

Release TLS key, allocated by a previous call to the CreateThreadDataKey() function. See PIN_DeleteThreadDataKey() description.

◆ GetData()

static VOID* LEVEL_PINCLIENT::CLIENT_TLS::GetData ( TLS_KEY  tlsKey,
THREADID  threadId 
)
inlinestatic

Get/Set the value of the specified TLS slot of the given thread. See PIN_GetThreadData() and PIN_SetThreadData() description.

Parameters
[in]threadIdThread ID assigned by pin of the thread for which TLS access is desired, not necessarily the current thread. This ID can be obtained by the PIN_ThreadId() function call or received as the value of the IARG_THREAD_ID argument.
Note
The Get/SetData functions are defined as static to eliminate overhead of the Instance() function. These functions assume that the Instance() function is invoked at least once before the first call to these functions. This assumption is valid because we enforce Instance() invocation from the static initializer of the <m_pInstance> member.

◆ InitCurrentTls()

VOID LEVEL_PINCLIENT::CLIENT_TLS::InitCurrentTls ( THREADID  currentThreadId)

Zero-initialize all TLS slots in the current thread. This function should be called on the thread start but before the client is notified about the new thread.

Parameters
[in]currentThreadIdID of the new (current) thread assigned by pin.

◆ Instance()

static CLIENT_TLS* LEVEL_PINCLIENT::CLIENT_TLS::Instance ( )
static

Return single instance of this class.

◆ IsCurrentTlsAllocated()

BOOL LEVEL_PINCLIENT::CLIENT_TLS::IsCurrentTlsAllocated ( THREADID  currentThreadId)

Return TRUE if TLS slots are allocated for current thread, FALSE otherwise.

Parameters
[in]currentThreadIdID of the current thread assigned by pin.

◆ IsKeyAllocated()

BOOL LEVEL_PINCLIENT::CLIENT_TLS::IsKeyAllocated ( TLS_KEY  tlsKey)

Return TRUE if TLS key is allocated by a previous call to the CreateThreadDataKey() function, FALSE otherwise

◆ IsValidTlsKey()

static BOOL LEVEL_PINCLIENT::CLIENT_TLS::IsValidTlsKey ( TLS_KEY  tlsKey,
THREADID  threadId 
)
inlinestatic

Check whether the input TLS_KEY is valid.

Parameters
[in]tlsKeyThe TLS key
[in]currentThreadIdID of the current thread assigned by pin.
Returns
TRUE if TLS key is valid, FALSE otherwise

◆ SetData()

static BOOL LEVEL_PINCLIENT::CLIENT_TLS::SetData ( TLS_KEY  tlsKey,
const VOID *  value,
THREADID  threadId 
)
inlinestatic

Get/Set the value of the specified TLS slot of the current/given thread. See above.


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