Index: kinit/kioslave.cpp =================================================================== --- kinit/kioslave.cpp (revision 768586) +++ kinit/kioslave.cpp (working copy) @@ -33,6 +33,7 @@ #include #include #include +#include #include "kstandarddirs.h" #endif @@ -111,11 +112,12 @@ #ifdef Q_WS_WIN // enter debugger in case debugging is actived - QString mSlaveDebug = getenv("KDE_SLAVE_DEBUG_WAIT"); - - if (mSlaveDebug == argv[2]) -#ifdef Q_CC_GNU + if (QString::fromLatin1( getenv("KDE_SLAVE_DEBUG_WAIT") ) == argv[2]) { +# ifdef Q_CC_MSVC + // msvc debugger or windbg supports jit debugging, the latter requires setting up windbg jit with windbg -i + DebugBreak(); +# else // gdb does not support win32 jit debug support, so implement it by ourself QByteArray buf(1024,0); GetModuleFileName(NULL,buf.data(),buf.size()); @@ -124,12 +126,18 @@ params << QString::number(GetCurrentProcessId()); QProcess::startDetached("gdb",params); Sleep(1000); +# endif + } +# ifdef Q_CC_MSVC + else if (QString::fromLatin1( getenv("KDE_SLAVE_DEBUG_POPUP") ) == argv[2]) { + // A workaround for OSes where DebugBreak() does not work in administrative mode (actually Vista with msvc 2k5) + // - display a native message box so developer can attach the debugger to the KIO slave process and click OK. + MessageBoxA(NULL, + QString("Please attach the debugger to process #%1 (%2)").arg(getpid()).arg(argv[0]).toLatin1(), + QString("\"%1\" KIO Slave Debugging").arg(argv[2]).toLatin1(), MB_OK|MB_ICONINFORMATION|MB_TASKMODAL); } -#else - // msvc: windbg supports jit debugging, require install windbg jit with windbg -i - DebugBreak(); -#endif -#endif +# endif +#endif // Q_WS_WIN int (*func)(int, char *[]) = (int (*)(int, char *[])) sym;