Commit b8c0801e authored by hjk's avatar hjk

Debugger: Run extra post-attach commands as "native" gdb commands

Change-Id: I5c3fac1e03b400f837a090b136ff8aa0ce8e21de
Task-number: QTCREATORBUG-17659
Reviewed-by: Kari Oikarinen's avatarKari Oikarinen <kari.oikarinen@qt.io>
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent a9a1f80f
......@@ -896,6 +896,12 @@ void GdbEngine::runCommand(const DebuggerCommand &command)
DebuggerCommand cmd = command;
if (cmd.function.isEmpty()) {
showMessage(QString("EMPTY FUNCTION RUN, TOKEN: %1 ARGS: %2")
.arg(token).arg(cmd.args.toString()));
QTC_ASSERT(false, return);
}
if (!stateAcceptsGdbCommands(state())) {
showMessage(QString("NO GDB PROCESS RUNNING, CMD IGNORED: %1 %2")
.arg(cmd.function).arg(state()));
......@@ -2201,7 +2207,7 @@ void GdbEngine::executeRunToLine(const ContextData &data)
loc = '"' + breakLocation(data.fileName) + '"' + ':' + QString::number(data.lineNumber);
runCommand({"tbreak " + loc});
runCommand({"continue", RunRequest, CB(handleExecuteRunToLine)});
runCommand({"continue", NativeCommand|RunRequest, CB(handleExecuteRunToLine)});
#else
// Seems to jump to unpredicatable places. Observed in the manual
// tests in the Foo::Foo() constructor with both gdb 6.8 and 7.1.
......
......@@ -277,7 +277,7 @@ void GdbRemoteServerEngine::handleTargetRemote(const DebuggerResponse &response)
showMessage(msgAttachedToStoppedInferior(), StatusBar);
QString commands = expand(stringSetting(GdbPostAttachCommands));
if (!commands.isEmpty())
runCommand({commands});
runCommand({commands, NativeCommand});
handleInferiorPrepared();
} else {
// 16^error,msg="hd:5555: Connection timed out."
......@@ -293,7 +293,7 @@ void GdbRemoteServerEngine::handleTargetExtendedRemote(const DebuggerResponse &r
showMessage(msgAttachedToStoppedInferior(), StatusBar);
QString commands = expand(stringSetting(GdbPostAttachCommands));
if (!commands.isEmpty())
runCommand({commands});
runCommand({commands, NativeCommand});
if (runParameters().attachPID > 0) { // attach to pid if valid
// gdb server will stop the remote application itself.
runCommand({"attach " + QString::number(runParameters().attachPID),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment