diff options
author | Filippo Gentile <gentilefilippo01@gmail.com> | 2023-02-08 13:03:40 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2023-03-27 12:19:17 +0000 |
commit | 193b1295f6363d9d88600f34cdaca73ff288546e (patch) | |
tree | bfc3fcd0bd82c0b2eb43ab4bf6c6c853040f3493 /src/plugins/debugger/gdb/gdbengine.cpp | |
parent | 9783ffd7c38263ff03146b92e9b869124226acc9 (diff) | |
download | qt-creator-193b1295f6363d9d88600f34cdaca73ff288546e.tar.gz |
Debugger: run GDB post attach commands also for local inferiors
GDB post attach commands previously where only run for Remote or
Extended Remote targets.
Now they are also run for Local and Local Attach targets
Task-number: QTCREATORBUG-28764
Change-Id: I6cf34091f2e53ffc7ea436465c2c1de3ef637e9d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/debugger/gdb/gdbengine.cpp')
-rw-r--r-- | src/plugins/debugger/gdb/gdbengine.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 90aa6dd36e..8a98c0e433 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4557,7 +4557,13 @@ void GdbEngine::handleLocalAttach(const DebuggerResponse &response) switch (response.resultClass) { case ResultDone: case ResultRunning: + { showMessage("INFERIOR ATTACHED"); + + QString commands = expand(debuggerSettings()->gdbPostAttachCommands.value()); + if (!commands.isEmpty()) + runCommand({commands, NativeCommand}); + if (state() == EngineRunRequested) { // Happens e.g. for "Attach to unstarted application" // We will get a '*stopped' later that we'll interpret as 'spontaneous' @@ -4577,6 +4583,7 @@ void GdbEngine::handleLocalAttach(const DebuggerResponse &response) updateAll(); } break; + } case ResultError: if (response.data["msg"].data() == "ptrace: Operation not permitted.") { QString msg = msgPtraceError(runParameters().startMode); @@ -4731,6 +4738,13 @@ void GdbEngine::handleExecRun(const DebuggerResponse &response) CHECK_STATE(EngineRunRequested); if (response.resultClass == ResultRunning) { + + if (isLocalRunEngine()) { + QString commands = expand(debuggerSettings()->gdbPostAttachCommands.value()); + if (!commands.isEmpty()) + runCommand({commands, NativeCommand}); + } + notifyEngineRunAndInferiorRunOk(); showMessage("INFERIOR STARTED"); showMessage(msgInferiorSetupOk(), StatusBar); |