forked from qt-creator/qt-creator
ProcessStub: Add missing if
When not starting in debug mode, the inferior is not waiting for ptrace(DETACH), so the code that calls DETACH waits for something that does not happen. Fixes: QTCREATORBUG-29503 Change-Id: Ic00a52b9e4f3a797d1be337a2ce53afc6ee63927 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -222,21 +222,23 @@ void onInferiorStarted()
|
||||
if (!debugMode)
|
||||
sendPid(inferiorId);
|
||||
#else
|
||||
qCInfo(log) << "Detaching ...";
|
||||
ptrace(PTRACE_DETACH, inferiorId, 0, SIGSTOP);
|
||||
if (debugMode) {
|
||||
qCInfo(log) << "Detaching ...";
|
||||
ptrace(PTRACE_DETACH, inferiorId, 0, SIGSTOP);
|
||||
|
||||
// Wait until the process actually finished detaching
|
||||
int status = 0;
|
||||
waitpid(inferiorId, &status, WUNTRACED);
|
||||
if (log().isInfoEnabled()) {
|
||||
if (WIFEXITED(status))
|
||||
qCInfo(log) << "inferior exited, status=" << WEXITSTATUS(status);
|
||||
else if (WIFSIGNALED(status))
|
||||
qCInfo(log) << "inferior killed by signal" << WTERMSIG(status);
|
||||
else if (WIFSTOPPED(status))
|
||||
qCInfo(log) << "inferior stopped by signal" << WSTOPSIG(status);
|
||||
else if (WIFCONTINUED(status))
|
||||
qCInfo(log) << "inferior continued";
|
||||
// Wait until the process actually finished detaching
|
||||
int status = 0;
|
||||
waitpid(inferiorId, &status, WUNTRACED);
|
||||
if (log().isInfoEnabled()) {
|
||||
if (WIFEXITED(status))
|
||||
qCInfo(log) << "inferior exited, status=" << WEXITSTATUS(status);
|
||||
else if (WIFSIGNALED(status))
|
||||
qCInfo(log) << "inferior killed by signal" << WTERMSIG(status);
|
||||
else if (WIFSTOPPED(status))
|
||||
qCInfo(log) << "inferior stopped by signal" << WSTOPSIG(status);
|
||||
else if (WIFCONTINUED(status))
|
||||
qCInfo(log) << "inferior continued";
|
||||
}
|
||||
}
|
||||
|
||||
sendPid(inferiorId);
|
||||
|
Reference in New Issue
Block a user