Exemple #1
0
THREAD* InsertThread(PIN_THREAD_UID threadid, THREAD *node)
{
	if(node == NULL)
	{
		node = (THREAD*)malloc(sizeof(THREAD));
		assert(node);
		node->tid = threadid;
		node->left = NULL;
		node->right = NULL;
		node->stack = NULL;
	}
	else
	{
		if(node->tid < threadid)
			node->right = InsertThread(threadid, node->right);
		else if(node->tid < threadid)
			node->left = InsertThread(threadid, node->left);
		else
		{
			fprintf(stderr, "err %lx\n", threadid);
			assert(0);
		}
	}
	return node;
}
Exemple #2
0
/*
 * ThreadStart
 * Called when every single thread starts
 * Insert new thread to BST
 */
VOID ThreadStart(THREADID threadIndex, CONTEXT *ctxt, INT32 flags, VOID *v)
{
	PIN_THREAD_UID threadid = PIN_ThreadUid();
	PIN_RWMutexWriteLock(&thread_lock);
	root_thread = InsertThread(threadid, root_thread);
	PIN_RWMutexUnlock(&thread_lock);
}
Exemple #3
0
static void HandleCreateThread( struct TDebug *obj, struct TCreateThreadEvent *event )
{
    struct TDebugThread *dt;

    dt = (struct TDebugThread *)malloc( sizeof( struct TDebugThread ) );
    InitThreadDebugThread( dt, event );
    InsertThread( obj, dt );
}
Exemple #4
0
static void HandleCreateProcess( struct TDebug *obj, struct TCreateProcessEvent *event )
{
    struct TDebugThread *dt;
    struct TDebugModule *dm;

    dt = (struct TDebugThread *)malloc( sizeof( struct TDebugThread ) );
    InitProcessDebugThread( dt, event );
    InsertThread( obj, dt );

    dm = (struct TDebugModule *)malloc( sizeof( struct TDebugModule ) );
    InitProcessDebugModule( dm, event );
    InsertModule( obj, dm);       
}