diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h
index dabb52a9ec26fdac01e985221eda242eae31ea81..c9c9d5326267ea6c15ff44cf294c237a86bc8c76 100644
--- a/src/plugins/debugger/debuggerengine.h
+++ b/src/plugins/debugger/debuggerengine.h
@@ -208,6 +208,7 @@ public:
         LosesChild = DebuggerCommand::LosesChild,
         RebuildBreakpointModel = DebuggerCommand::RebuildBreakpointModel,
         InUpdateLocals = DebuggerCommand::InUpdateLocals,
+        NativeCommand = DebuggerCommand::NativeCommand,
         Silent = DebuggerCommand::Silent
     };
 
diff --git a/src/plugins/debugger/debuggerprotocol.h b/src/plugins/debugger/debuggerprotocol.h
index d17beecafa2093c057f47ce338fdd5e53880f4d6..c23c5060b7bd691c0624e09d05ca155196b2afe6 100644
--- a/src/plugins/debugger/debuggerprotocol.h
+++ b/src/plugins/debugger/debuggerprotocol.h
@@ -84,6 +84,8 @@ public:
         LosesChild = 64,
         // Trigger breakpoint model rebuild when no such commands are pending anymore.
         RebuildBreakpointModel = 128,
+        // This is a native (non-Python) command that's handled directly by the backend.
+        NativeCommand = 256,
         // This is a command that needs to be wrapped into -interpreter-exec console
         ConsoleCommand = 512,
         // This is the UpdateLocals commannd during which we ignore notifications
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index f78b96c341ff3a04f2f1747f4a25653d2c14bcbf..1117d76f13c22cc0778928487e803a7881089728 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -939,7 +939,7 @@ void GdbEngine::runCommand(const DebuggerCommand &command)
         ++m_nonDiscardableCount;
 
     bool isPythonCommand = true;
-    if (cmd.function.contains('-') || cmd.function.contains(' '))
+    if ((cmd.flags & NativeCommand) || cmd.function.contains('-') || cmd.function.contains(' '))
         isPythonCommand = false;
     if (isPythonCommand) {
         cmd.arg("token", token);
@@ -4157,7 +4157,7 @@ void GdbEngine::resetInferior()
         foreach (QString command, commands.split('\n')) {
             command = command.trimmed();
             if (!command.isEmpty())
-                runCommand({command, ConsoleCommand | NeedsTemporaryStop});
+                runCommand({command, ConsoleCommand | NeedsTemporaryStop | NativeCommand});
         }
     }
     m_rerunPending = true;
@@ -4205,7 +4205,7 @@ void GdbEngine::handleInferiorPrepared()
     if (!rp.commandsAfterConnect.isEmpty()) {
         const QString commands = expand(rp.commandsAfterConnect);
         for (const QString &command : commands.split('\n'))
-            runCommand({command});
+            runCommand({command, NativeCommand});
     }
 
     //runCommand("set follow-exec-mode new");