diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 147e7f74e585227ad3b38168ace2b8a5298e4b14..b7c8c006050393bf5968b2024ffc147ff6a32d6d 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -4420,9 +4420,11 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
 
     postCommand(_("show version"), CB(handleShowVersion));
 
-    postCommand(_("python execfile('%1dumper.py')").arg(dumperSourcePath),
+    postCommand(_("-interpreter-exec console \"python execfile('%1dumper.py')\"")
+            .arg(dumperSourcePath),
         NonCriticalResponse);
-    postCommand(_("python execfile('%1gdbmacros.py')").arg(dumperSourcePath),
+    postCommand(_("-interpreter-exec console \"python execfile('%1gdbmacros.py')\"")
+            .arg(dumperSourcePath),
         NonCriticalResponse);
 
     postCommand(_("-interpreter-exec console \"help bb\""),