Skip to content

Commit

Permalink
- fix: Debugger not responding when debugging with gdb > 14.
Browse files Browse the repository at this point in the history
  • Loading branch information
royqh1979 committed Dec 28, 2024
1 parent dabdc27 commit f13ae94
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Red Panda C++ Version 3.3
- fix: Only press space key can exit consolepauser in linux. (by CyanoHao)
- fix: command line parameter escaping for consolepauser in windows. (by CyanoHao)
- enhancement: Localization for consolepauser.
- fix: Debugger not responding when debugging with gdb > 14.

Red Panda C++ Version 3.2

Expand Down
2 changes: 1 addition & 1 deletion RedPandaIDE/debugger/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ void Debugger::syncFinishedParsing()
for (const QString& line:mClient->consoleOutput()) {
pMainWindow->addDebugOutput(line);
}
pMainWindow->addDebugOutput("(gdb)");
//pMainWindow->addDebugOutput("(gdb)");
}
}
}
Expand Down
24 changes: 14 additions & 10 deletions RedPandaIDE/debugger/gdbmidebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void GDBMIDebuggerClient::run()
readed = mProcess->readAll();
buffer += readed;

if (readed.endsWith("\n")&& outputTerminated(buffer)) {
if (readed.endsWith("\n")) {
processDebugOutput(buffer);
buffer.clear();
// mCmdRunning = false;
Expand Down Expand Up @@ -329,15 +329,15 @@ QStringList GDBMIDebuggerClient::tokenize(const QString &s) const
return result;
}

bool GDBMIDebuggerClient::outputTerminated(const QByteArray &text) const
{
QStringList lines = textToLines(QString::fromUtf8(text));
foreach (const QString& line,lines) {
if (line.trimmed() == "(gdb)")
return true;
}
return false;
}
//bool GDBMIDebuggerClient::outputTerminated(const QByteArray &text) const
//{
// QStringList lines = textToLines(QString::fromUtf8(text));
// foreach (const QString& line,lines) {
// if (line.trimmed() == "(gdb)")
// return true;
// }
// return false;
//}

void GDBMIDebuggerClient::handleBreakpoint(const GDBMIResultParser::ParseObject& breakpoint)
{
Expand Down Expand Up @@ -928,6 +928,10 @@ void GDBMIDebuggerClient::processDebugOutput(const QByteArray& debugOutput)
case '+': // status async output
case '=': // notify async output
break;
case '(':
if (line.startsWith("(gdb)"))
mConsoleOutput.append(line);
break;
}
}
emit parseFinished();
Expand Down
2 changes: 1 addition & 1 deletion RedPandaIDE/debugger/gdbmidebugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class GDBMIDebuggerClient: public DebuggerClient {
void runNextCmd();
private:
QStringList tokenize(const QString& s) const;
bool outputTerminated(const QByteArray& text) const;
//bool outputTerminated(const QByteArray& text) const;
void handleBreakpoint(const GDBMIResultParser::ParseObject& breakpoint);
void handleCreateVar(const GDBMIResultParser::ParseObject &multiVars);
void handleFrame(const GDBMIResultParser::ParseValue &frame);
Expand Down

0 comments on commit f13ae94

Please sign in to comment.