ios: fix kill when running on device

Change-Id: I2bd9a461c055ef8aa5f5ed9facc879def0078f6f
Task-number: QTCREATORBUG-13259
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.com>
This commit is contained in:
Fawzi Mohamed
2014-12-01 15:26:13 +01:00
committed by Fawzi Mohamed
parent 6b894b50e6
commit a1076c209a
4 changed files with 85 additions and 23 deletions

View File

@@ -311,8 +311,10 @@ public:
const QString &info);
void deviceWithId(QString deviceId, int timeout, DeviceAvailableCallback callback, void *userData);
int processGdbServer(int fd);
void stopGdbServer(int fd, int phase);
private:
IosDeviceManager *q;
QMutex m_sendMutex;
QHash<QString, AMDeviceRef> m_devices;
QMultiHash<QString, PendingDeviceLookup *> m_pendingLookups;
AMDeviceNotificationRef m_notification;
@@ -631,7 +633,10 @@ enum GdbServerStatus {
int IosDeviceManagerPrivate::processGdbServer(int fd)
{
CommandSession session((QString()));
session.sendGdbCommand(fd, "vCont;c"); // resume all threads
{
QMutexLocker l(&m_sendMutex);
session.sendGdbCommand(fd, "vCont;c"); // resume all threads
}
GdbServerStatus state = NORMAL_PROCESS;
int maxRetry = 10;
int maxSignal = 5;
@@ -711,10 +716,17 @@ int IosDeviceManagerPrivate::processGdbServer(int fd)
addError(QLatin1String("hit maximum number of consecutive signals, stopping"));
break;
}
if (session.sendGdbCommand(fd, "vCont;c"))
state = NORMAL_PROCESS;
else
break;
{
if (signal == 17) {
state = NORMAL_PROCESS; // Ctrl-C to kill the process
} else {
QMutexLocker l(&m_sendMutex);
if (session.sendGdbCommand(fd, "vCont;c"))
state = NORMAL_PROCESS;
else
break;
}
}
} else {
maxSignal = 5;
}
@@ -727,6 +739,16 @@ int IosDeviceManagerPrivate::processGdbServer(int fd)
return state != INFERIOR_EXITED;
}
void IosDeviceManagerPrivate::stopGdbServer(int fd, int phase)
{
CommandSession session((QString()));
QMutexLocker l(&m_sendMutex);
if (phase == 0)
session.writeAll(fd,"\x03",1);
else
session.sendGdbCommand(fd, "k", 1);
}
// ------- ConnectSession implementation --------
CommandSession::CommandSession(const QString &deviceId) : DeviceSession(deviceId), device(0),
@@ -1686,6 +1708,11 @@ int IosDeviceManager::processGdbServer(int fd)
return d->processGdbServer(fd);
}
void IosDeviceManager::stopGdbServer(int fd, int phase)
{
return d->stopGdbServer(fd, phase);
}
QStringList IosDeviceManager::errors() {
return d->errors();
}