示例#1
0
/**
* Debugger callback that handles events that are necessary for profiling.
**/
int debuggerCallback(void *user_data, int notification_code, va_list va)
{
	UserData* userData = (UserData*)user_data;
	IdaFile file;
	Debugger debugger = file.getDebugger();

	if (notification_code == Debugger::EVENT_BREAKPOINT)
	{
		// Get the Thread ID
		thread_id_t tid = va_arg(va, thread_id_t);

		// Get the address of where the breakpoint was hit
		ea_t addr = va_arg(va, ea_t);

		_timeb timebuffer;
		_ftime64_s( &timebuffer );
		userData->getEventList().addEvent(Event(addr, timebuffer));

		debugger.resumeProcess(true);
	}
	else if (notification_code == Debugger::EVENT_PROCESS_SUSPENDED)
	{
		setBreakpoints();

		msg("Resuming target process...\n");

		debugger.resumeProcess(true);
	}
	else if (notification_code == Debugger::EVENT_PROCESS_EXIT)
	{
		handleExitProcess(userData);
	}

	return 0;
}