QNX: Fix shutdown of inferior and inserting breakpoints on Windows

When debugging on a QNX device on Windows, neither
DebugBreakProcess(..) nor "-exec-interrupt" works for interrupting
the inferior process. Neither does sending it a SIGINT signal using
"kill" on the device.

This changes the local gdb process to run under the CtrlC stub on
Windows when debugging on QNX. This enables us to send a Ctrl+C
message to gdb, which interrupts the inferior, and allows us to
insert breakpoints during runtime on Windows.

Change-Id: I4b01fbe81138f3fe7a939a7e64267bac4eb8bf43
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Tobias Nätterlund
2013-05-03 13:52:52 +02:00
committed by hjk
parent 14eee567f1
commit 515b6266c5
7 changed files with 71 additions and 10 deletions

View File

@@ -30,6 +30,8 @@
#include "qtcprocess.h"
#include "stringutils.h"
#include <utils/qtcassert.h>
#include <QDir>
#include <QDebug>
#include <QCoreApplication>
@@ -699,17 +701,28 @@ void QtcProcess::start()
}
#ifdef Q_OS_WIN
BOOL CALLBACK sendShutDownMessageToAllWindowsOfProcess_enumWnd(HWND hwnd, LPARAM lParam)
static BOOL sendMessage(UINT message, HWND hwnd, LPARAM lParam)
{
static UINT uiShutDownMessage = RegisterWindowMessage(L"qtcctrlcstub_shutdown");
DWORD dwProcessID;
GetWindowThreadProcessId(hwnd, &dwProcessID);
if ((DWORD)lParam == dwProcessID) {
SendNotifyMessage(hwnd, uiShutDownMessage, 0, 0);
SendNotifyMessage(hwnd, message, 0, 0);
return FALSE;
}
return TRUE;
}
BOOL CALLBACK sendShutDownMessageToAllWindowsOfProcess_enumWnd(HWND hwnd, LPARAM lParam)
{
static UINT uiShutDownMessage = RegisterWindowMessage(L"qtcctrlcstub_shutdown");
return sendMessage(uiShutDownMessage, hwnd, lParam);
}
BOOL CALLBACK sendInterruptMessageToAllWindowsOfProcess_enumWnd(HWND hwnd, LPARAM lParam)
{
static UINT uiInterruptMessage = RegisterWindowMessage(L"qtcctrlcstub_interrupt");
return sendMessage(uiInterruptMessage, hwnd, lParam);
}
#endif
void QtcProcess::terminate()
@@ -723,6 +736,11 @@ void QtcProcess::terminate()
}
#ifdef Q_OS_WIN
void QtcProcess::interrupt()
{
QTC_ASSERT(m_useCtrlCStub, return);
EnumWindows(sendInterruptMessageToAllWindowsOfProcess_enumWnd, pid()->dwProcessId);
}
// This function assumes that the resulting string will be quoted.
// That's irrelevant if it does not contain quotes itself.