forked from qt-creator/qt-creator
Debugger: Run extra post-attach commands as "native" gdb commands
Change-Id: I5c3fac1e03b400f837a090b136ff8aa0ce8e21de Task-number: QTCREATORBUG-17659 Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -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),
|
||||
|
Reference in New Issue
Block a user