From 12299e98e9bc99b389bae2d1cb25a5db183a778a Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Tue, 12 Mar 2024 20:28:38 +0800 Subject: [PATCH] - fix #267: When debugging, can't watch expressions that has spaces in it. --- RedPandaIDE/debugger/debugger.cpp | 2 +- RedPandaIDE/debugger/gdbmidebugger.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/RedPandaIDE/debugger/debugger.cpp b/RedPandaIDE/debugger/debugger.cpp index 166dc43d..287e8b23 100644 --- a/RedPandaIDE/debugger/debugger.cpp +++ b/RedPandaIDE/debugger/debugger.cpp @@ -1710,7 +1710,7 @@ PWatchVar WatchModel::findWatchVar(const QModelIndex &index) PWatchVar WatchModel::findWatchVar(const QString &expr) { foreach (const PWatchVar &var, watchVars(mIsForProject)) { - if (expr == var->expression) { + if (expr == QString("\"%1\"").arg(var->expression)) { return var; } } diff --git a/RedPandaIDE/debugger/gdbmidebugger.cpp b/RedPandaIDE/debugger/gdbmidebugger.cpp index 3d68e21d..944d3272 100644 --- a/RedPandaIDE/debugger/gdbmidebugger.cpp +++ b/RedPandaIDE/debugger/gdbmidebugger.cpp @@ -1128,7 +1128,7 @@ void GDBMIDebuggerClient::setBreakpointCondition(PBreakpoint breakpoint) void GDBMIDebuggerClient::addWatch(const QString &expression) { - postCommand("-var-create", expression); + postCommand("-var-create", QString("\"%1\"").arg(expression)); } void GDBMIDebuggerClient::removeWatch(PWatchVar watchVar)