diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -6,12 +6,9 @@ # END: Analyzers # BEGIN: Debuggers -if(NOT WIN32) - # TODO: Make compile under Windows - add_subdirectory(debuggercommon) - add_subdirectory(lldb) - add_subdirectory(gdb) -endif() +add_subdirectory(debuggercommon) +add_subdirectory(lldb) +add_subdirectory(gdb) # END: Debuggers # BEGIN: Documentation diff --git a/plugins/debuggercommon/midebugger.cpp b/plugins/debuggercommon/midebugger.cpp --- a/plugins/debuggercommon/midebugger.cpp +++ b/plugins/debuggercommon/midebugger.cpp @@ -39,6 +39,10 @@ #include #include +#ifdef Q_OS_WIN +#include +#endif + // #define DEBUG_NO_TRY //to get a backtrace to where the exception was thrown using namespace KDevMI; @@ -102,11 +106,16 @@ void MIDebugger::interrupt() { - //TODO:win32 Porting needed +#ifndef Q_OS_WIN int pid = m_process->pid(); if (pid != 0) { ::kill(pid, SIGINT); } +#else + SetConsoleCtrlHandler(nullptr, true); + GenerateConsoleCtrlEvent(0, 0); + SetConsoleCtrlHandler(nullptr, false); +#endif } MICommand* MIDebugger::currentCommand() const diff --git a/plugins/debuggercommon/midebugsession.cpp b/plugins/debuggercommon/midebugsession.cpp --- a/plugins/debuggercommon/midebugsession.cpp +++ b/plugins/debuggercommon/midebugsession.cpp @@ -254,12 +254,14 @@ connect(m_tty.get(), &STTY::ErrOutput, this, &MIDebugSession::inferiorTtyStderr); } QString tty(m_tty->getSlave()); +#ifndef Q_OS_WIN if (tty.isEmpty()) { KMessageBox::information(qApp->activeWindow(), m_tty->lastError(), i18n("warning")); m_tty.reset(nullptr); return false; } +#endif addCommand(InferiorTtySet, tty); // Change the working directory to the correct one diff --git a/plugins/debuggercommon/stty.cpp b/plugins/debuggercommon/stty.cpp --- a/plugins/debuggercommon/stty.cpp +++ b/plugins/debuggercommon/stty.cpp @@ -32,26 +32,30 @@ #endif #include +#ifndef _MSC_VER #include -#include #include #include #include +#endif +#include #ifdef HAVE_SYS_STROPTS_H #include #define _NEW_TTY_CTRL #endif #include #include +#ifndef _MSC_VER #include +#include +#include +#endif #include #include #include -#include #include -#include #include #if defined (_HPUX_SOURCE) @@ -83,6 +87,7 @@ // param grant: 1 to grant, 0 to revoke // returns 1 on success 0 on fail { +#ifndef Q_OS_WIN void(*tmp)(int) = signal(SIGCHLD,SIG_DFL); pid_t pid = fork(); if (pid < 0) { @@ -115,6 +120,7 @@ return (rc != -1 && WIFEXITED(w) && WEXITSTATUS(w) == 0); } signal(SIGCHLD,tmp); +#endif return 0; //dummy. } @@ -143,19 +149,21 @@ STTY::~STTY() { +#ifndef Q_OS_WIN if (out) { ::close(fout); delete out; } +#endif } // ************************************************************************** int STTY::findTTY() { int ptyfd = -1; bool needGrantPty = true; - +#ifndef Q_OS_WIN // Find a master pty that we can open //////////////////////////////// #ifdef __sgi__ @@ -250,13 +258,15 @@ "and/or add the user to the tty group using " "\"usermod -aG tty username\"."); } +#endif return ptyfd; } // ************************************************************************** void STTY::OutReceived(int f) { +#ifndef Q_OS_WIN char buf[1024]; int n; @@ -279,7 +289,7 @@ // cycles. out->setEnabled(false); } - +#endif } void STTY::readRemaining() @@ -290,6 +300,7 @@ bool STTY::findExternalTTY(const QString& termApp) { +#ifndef Q_OS_WIN QString appName(termApp.isEmpty() ? QStringLiteral("xterm") : termApp); if (QStandardPaths::findExecutable(appName).isEmpty()) { @@ -340,6 +351,7 @@ if (ttySlave.isEmpty()) { m_lastError = i18n("Can't receive %1 tty/pty. Check that %1 is actually a terminal and that it accepts these arguments: -e sh -c \"tty> %2 ;exec<&-;exec>&-;while :;do sleep 3600;done\"", appName, file.fileName()); } +#endif return true; } // ************************************************************************** diff --git a/plugins/debuggercommon/tests/debuggees/debugeemultiplebreakpoint.cpp b/plugins/debuggercommon/tests/debuggees/debugeemultiplebreakpoint.cpp --- a/plugins/debuggercommon/tests/debuggees/debugeemultiplebreakpoint.cpp +++ b/plugins/debuggercommon/tests/debuggees/debugeemultiplebreakpoint.cpp @@ -18,6 +18,7 @@ #include +#include class Str2 { public: void print(void) { diff --git a/plugins/debuggercommon/tests/debuggees/debugeepath.cpp b/plugins/debuggercommon/tests/debuggees/debugeepath.cpp --- a/plugins/debuggercommon/tests/debuggees/debugeepath.cpp +++ b/plugins/debuggercommon/tests/debuggees/debugeepath.cpp @@ -20,7 +20,12 @@ */ #include +#ifndef _MSC_VER #include +#else +#include +#define getcwd _getcwd +#endif // !_MSC_VER int main() { diff --git a/plugins/debuggercommon/tests/debuggees/debugeeslow.cpp b/plugins/debuggercommon/tests/debuggees/debugeeslow.cpp --- a/plugins/debuggercommon/tests/debuggees/debugeeslow.cpp +++ b/plugins/debuggercommon/tests/debuggees/debugeeslow.cpp @@ -18,7 +18,12 @@ #include +#ifndef _MSC_VER #include +#else +#include +#define sleep Sleep +#endif void foo() { static int i=0; diff --git a/plugins/debuggercommon/tests/debuggees/debugeethreads.cpp b/plugins/debuggercommon/tests/debuggees/debugeethreads.cpp --- a/plugins/debuggercommon/tests/debuggees/debugeethreads.cpp +++ b/plugins/debuggercommon/tests/debuggees/debugeethreads.cpp @@ -17,7 +17,9 @@ */ #include #include +#ifndef _MSC_VER #include +#endif class TestThread : public QThread { @@ -36,7 +38,7 @@ t1.start(); t2.start(); t3.start(); - usleep(500000); - usleep(600000); + QThread::usleep(500000); + QThread::usleep(600000); return 0; } diff --git a/plugins/lldb/controllers/framestackmodel.cpp b/plugins/lldb/controllers/framestackmodel.cpp --- a/plugins/lldb/controllers/framestackmodel.cpp +++ b/plugins/lldb/controllers/framestackmodel.cpp @@ -42,6 +42,7 @@ using namespace KDevMI::LLDB; using namespace KDevMI::MI; +using namespace KDevMI; LldbFrameStackModel::LldbFrameStackModel(DebugSession *session) : MIFrameStackModel(session) diff --git a/plugins/lldb/debugsession.cpp b/plugins/lldb/debugsession.cpp --- a/plugins/lldb/debugsession.cpp +++ b/plugins/lldb/debugsession.cpp @@ -52,6 +52,7 @@ using namespace KDevMI::LLDB; using namespace KDevMI::MI; +using namespace KDevMI; using namespace KDevelop; struct ExecRunHandler : public MICommandHandler