- fix: Failed to evaluate expressions while debugging, if the expression has spaces in it.

This commit is contained in:
Roy Qu 2024-03-12 18:59:26 +08:00
parent 3e0db148ae
commit 80ec88e552
2 changed files with 10 additions and 2 deletions

View File

@ -44,6 +44,7 @@ Red Panda C++ Version 2.27
- fix: Hint for bold text (<b></b>) are not correctly handled in the function tips. - fix: Hint for bold text (<b></b>) are not correctly handled in the function tips.
- enhancement: Improve lldb-mi compatibility. - enhancement: Improve lldb-mi compatibility.
- fix: Full scope typed variables in lambda expressions is not correctly parsed. - fix: Full scope typed variables in lambda expressions is not correctly parsed.
- fix: Failed to evaluate expressions while debugging, if the expression has spaces in it.
Red Panda C++ Version 2.26 Red Panda C++ Version 2.26
- enhancement: Code suggestion for embedded std::vectors. - enhancement: Code suggestion for embedded std::vectors.

View File

@ -1166,7 +1166,14 @@ void GDBMIDebuggerClient::fetchWatchVarChildren(const QString& varName)
void GDBMIDebuggerClient::evalExpression(const QString &expression) void GDBMIDebuggerClient::evalExpression(const QString &expression)
{ {
postCommand("-data-evaluate-expression", expression); QString escaped;
foreach(const QChar& ch, expression) {
if (ch.unicode()<=32) {
escaped+=QString("\\%1").arg(ch.unicode(),0,8);
} else
escaped+=ch;
}
postCommand("-data-evaluate-expression", QString("\"%1\"").arg(escaped));
} }
void GDBMIDebuggerClient::selectFrame(PTrace trace) void GDBMIDebuggerClient::selectFrame(PTrace trace)