diff --git a/RedPandaIDE/debugger.cpp b/RedPandaIDE/debugger.cpp index 68f5e4ac..d548dd2f 100644 --- a/RedPandaIDE/debugger.cpp +++ b/RedPandaIDE/debugger.cpp @@ -136,9 +136,9 @@ bool Debugger::start(int compilerSetIndex, const QString& inferior, const QStrin mWatchModel->resetAllVarInfos(); if (pSettings->debugger().useGDBServer()) { //deleted when thread finished - QString params; + QStringList params; if (pSettings->executor().useParams()) - params = pSettings->executor().params(); + params = splitProcessCommand(pSettings->executor().params()); mTarget = new DebugTarget(inferior,compilerSet->debugServer(),pSettings->debugger().GDBServerPort(),params); if (pSettings->executor().redirectInput()) mTarget->setInputFile(pSettings->executor().inputFilename()); @@ -1850,7 +1850,7 @@ void DebugReader::run() mErrorOccured = false; QString cmd = mDebuggerPath; // QString arguments = "--annotate=2"; - QString arguments = "--interpret=mi --silent"; + QStringList arguments{"--interpret=mi", "--silent"}; QString workingDir = QFileInfo(mDebuggerPath).path(); mProcess = std::make_shared(); @@ -1858,7 +1858,7 @@ void DebugReader::run() mProcess.reset(); }); mProcess->setProgram(cmd); - mProcess->setArguments(splitProcessCommand(arguments)); + mProcess->setArguments(arguments); mProcess->setProcessChannelMode(QProcess::MergedChannels); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); @@ -3012,7 +3012,7 @@ DebugTarget::DebugTarget( const QString &inferior, const QString &GDBServer, int port, - const QString& arguments, + const QStringList& arguments, QObject *parent): QThread(parent), mInferior(inferior), @@ -3062,14 +3062,31 @@ void DebugTarget::run() mErrorOccured = false; //find first available port + QStringList execArgs = QStringList{ + mGDBServer, + QString("localhost:%1").arg(mPort), + mInferior, + } + mArguments; QString cmd; - QString arguments; + QStringList arguments; + std::unique_ptr fileOwner; #ifdef Q_OS_WIN - cmd= mGDBServer; - arguments = QString(" localhost:%1 \"%2\" %3").arg(mPort).arg(mInferior,mArguments); + if (pSettings->environment().useCustomTerminal()) { + std::tie(cmd, arguments, fileOwner) = wrapCommandForTerminalEmulator( + pSettings->environment().terminalPath(), + pSettings->environment().terminalArgumentsPattern(), + execArgs + ); + } else { + cmd = execArgs[0]; + arguments = execArgs.mid(1); + } #else - cmd= pSettings->environment().terminalPath(); - arguments = QString(" -e \"%1\" localhost:%2 \"%3\"").arg(mGDBServer).arg(mPort).arg(mInferior); + std::tie(cmd, arguments, fileOwner) = wrapCommandForTerminalEmulator( + pSettings->environment().terminalPath(), + pSettings->environment().terminalArgumentsPattern(), + execArgs + ); #endif QString workingDir = QFileInfo(mInferior).path(); @@ -3078,7 +3095,7 @@ void DebugTarget::run() mProcess.reset(); }); mProcess->setProgram(cmd); - mProcess->setArguments(splitProcessCommand(arguments)); + mProcess->setArguments(arguments); mProcess->setProcessChannelMode(QProcess::MergedChannels); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QString path = env.value("PATH"); diff --git a/RedPandaIDE/debugger.h b/RedPandaIDE/debugger.h index 7d304138..32e4bd13 100644 --- a/RedPandaIDE/debugger.h +++ b/RedPandaIDE/debugger.h @@ -431,7 +431,7 @@ public: explicit DebugTarget(const QString& inferior, const QString& GDBServer, int port, - const QString& arguments, + const QStringList& arguments, QObject *parent = nullptr); void setInputFile(const QString& inputFile); void stopDebug(); @@ -443,7 +443,7 @@ signals: void processError(QProcess::ProcessError error); private: QString mInferior; - QString mArguments; + QStringList mArguments; QString mGDBServer; int mPort; bool mStop; diff --git a/RedPandaIDE/resources/terminal-unix.json b/RedPandaIDE/resources/terminal-unix.json index cf0b9014..e8b3b595 100644 --- a/RedPandaIDE/resources/terminal-unix.json +++ b/RedPandaIDE/resources/terminal-unix.json @@ -81,7 +81,7 @@ { "name": "GNOME Terminal", "path": "gnome-terminal", - "argsPattern": "$term -- $argv" + "argsPattern": "$term --wait -- $argv" }, { "name": "GNOME Terminator", diff --git a/RedPandaIDE/resources/terminal-windows.json b/RedPandaIDE/resources/terminal-windows.json index e4bbe5b3..e8403480 100644 --- a/RedPandaIDE/resources/terminal-windows.json +++ b/RedPandaIDE/resources/terminal-windows.json @@ -38,6 +38,16 @@ "path": "alacritty.exe", "argsPattern": "$term -e $argv" }, + { + "name": "ConEmu", + "path": "ConEmu.exe", + "argsPattern": "$term -run $argv" + }, + { + "name": "ConEmu", + "path": "ConEmu64.exe", + "argsPattern": "$term -run $argv" + }, { "name": "Konsole", "path": "konsole.exe",