aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Tillmanns <marcus.tillmanns@qt.io>2023-08-15 15:27:15 +0200
committerMarcus Tillmanns <marcus.tillmanns@qt.io>2023-08-15 13:32:45 +0000
commit02e2a642dc21831af13893c74c81d4ad59e0e25e (patch)
tree4602985bb1a8b6193332d063f51426bba51f27d1
parent324e92417859949b67a7ed4e32c4e2ed6ece734b (diff)
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>
-rw-r--r--src/tools/process_stub/main.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/tools/process_stub/main.cpp b/src/tools/process_stub/main.cpp
index dfd9ce5613..702450f8b7 100644
--- a/src/tools/process_stub/main.cpp
+++ b/src/tools/process_stub/main.cpp
@@ -222,21 +222,23 @@ void onInferiorStarted()
if (!debugMode)
sendPid(inferiorId);
#else
- 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";
+ 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";
+ }
}
sendPid(inferiorId);