Exemple #1
0
void IDAP_run(int)
{
	IdaFile file;

	msg("Starting to profile %s\n", file.getName().c_str());

	Debugger debugger = file.getDebugger();

	debugger.addEventCallback(&debuggerCallback, new UserData);

	if (debugger.isActive() && !debugger.isSuspended())
	{
		// If the target process is already running, suspend it to set the breakpoints

		msg("Suspending the target process...\n");
		debugger.suspendProcess(true);
	}
	else if (debugger.isActive() && debugger.isSuspended())
	{
		// If the target is already suspended, set the breakpoints and resume the process.

		setBreakpoints();

		debugger.resumeProcess(true);
	}
	else
	{
		// If the debugger is not yet running, set the breakpoints and start the process.

		setBreakpoints();

		msg("Starting target process\n");

		debugger.startProcess(file.getInputfilePath(), "", "");
	}
}