Example #1
0
extern "C" DLL_EXPORT void _dbg_dbgexitsignal()
{
    dputs("Stopping running debuggee...");
    cbDebugStop(0, 0);
    dputs("Aborting scripts...");
    scriptabort();
    dputs("Waiting for the debuggee to be stopped...");
    wait(WAITID_STOP); //after this, debugging stopped
    dputs("Unloading plugins...");
    pluginunload();
    dputs("Stopping command thread...");
    bStopCommandLoopThread = true;
    WaitForThreadTermination(hCommandLoopThread);
    dputs("Cleaning up allocated data...");
    cmdfree(command_list);
    varfree();
    MsgFreeStack(gMsgStack);
    yr_finalize();
    Capstone::GlobalFinalize();
    dputs("Checking for mem leaks...");
    if(memleaks())
        dprintf("%d memory leak(s) found!\n", memleaks());
    else
        DeleteFileA(alloctrace);
    dputs("Cleaning up wait objects...");
    waitdeinitialize();
    dputs("Cleaning up debugger threads...");
    dbgstop();
    dputs("Exit signal processed successfully!");
    bIsStopped = true;
}
Example #2
0
extern "C" DLL_EXPORT void _dbg_dbgexitsignal()
{
    cbStopDebug(0, 0);
    scriptabort();
    wait(WAITID_STOP); //after this, debugging stopped
    pluginunload();
    TerminateThread(hCommandLoopThread, 0);
    CloseHandle(hCommandLoopThread);
    cmdfree(command_list);
    varfree();
    MsgFreeStack(gMsgStack);
    yr_finalize();
    Capstone::GlobalFinalize();
    if(memleaks())
    {
        char msg[256] = "";
        sprintf(msg, "%d memory leak(s) found!\n\nPlease send contact the authors of x64dbg.", memleaks());
        MessageBoxA(0, msg, "error", MB_ICONERROR | MB_SYSTEMMODAL);
    }
    else
        DeleteFileA(alloctrace);

    SectionLockerGlobal::Deinitialize();
}