forked from qt-creator/qt-creator
debugger: make the command timer a direct member of GdbEngine
This commit is contained in:
@@ -182,9 +182,8 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters)
|
|||||||
setObjectName(QLatin1String("GdbEngine"));
|
setObjectName(QLatin1String("GdbEngine"));
|
||||||
qRegisterMetaType<WatchData>("WatchData");
|
qRegisterMetaType<WatchData>("WatchData");
|
||||||
|
|
||||||
m_commandTimer = new QTimer(this);
|
m_commandTimer.setSingleShot(true);
|
||||||
m_commandTimer->setSingleShot(true);
|
connect(&m_commandTimer, SIGNAL(timeout()), SLOT(commandTimeout()));
|
||||||
connect(m_commandTimer, SIGNAL(timeout()), SLOT(commandTimeout()));
|
|
||||||
|
|
||||||
// Needs no resetting in initializeVariables()
|
// Needs no resetting in initializeVariables()
|
||||||
m_busy = false;
|
m_busy = false;
|
||||||
@@ -247,7 +246,7 @@ void GdbEngine::initializeVariables()
|
|||||||
m_inbuffer.clear();
|
m_inbuffer.clear();
|
||||||
m_resultVarName.clear();
|
m_resultVarName.clear();
|
||||||
|
|
||||||
m_commandTimer->stop();
|
m_commandTimer.stop();
|
||||||
|
|
||||||
// ConverterState has no reset() function.
|
// ConverterState has no reset() function.
|
||||||
m_outputCodecState.~ConverterState();
|
m_outputCodecState.~ConverterState();
|
||||||
@@ -594,15 +593,14 @@ void GdbEngine::readGdbStandardError()
|
|||||||
|
|
||||||
void GdbEngine::readGdbStandardOutput()
|
void GdbEngine::readGdbStandardOutput()
|
||||||
{
|
{
|
||||||
if (m_commandTimer->isActive())
|
m_commandTimer.start(); // Restart timer.
|
||||||
m_commandTimer->start(); // Retrigger
|
|
||||||
|
|
||||||
int newstart = 0;
|
int newstart = 0;
|
||||||
int scan = m_inbuffer.size();
|
int scan = m_inbuffer.size();
|
||||||
|
|
||||||
m_inbuffer.append(gdbProc()->readAllStandardOutput());
|
m_inbuffer.append(gdbProc()->readAllStandardOutput());
|
||||||
|
|
||||||
// This can trigger when a dialog starts a nested event loop
|
// This can trigger when a dialog starts a nested event loop.
|
||||||
if (m_busy)
|
if (m_busy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -793,14 +791,14 @@ void GdbEngine::flushCommand(const GdbCommand &cmd0)
|
|||||||
m_gdbAdapter->write(cmd.command + "\r\n");
|
m_gdbAdapter->write(cmd.command + "\r\n");
|
||||||
|
|
||||||
// Start Watchdog.
|
// Start Watchdog.
|
||||||
if (m_commandTimer->interval() <= 20000)
|
if (m_commandTimer.interval() <= 20000)
|
||||||
m_commandTimer->setInterval(commandTimeoutTime());
|
m_commandTimer.setInterval(commandTimeoutTime());
|
||||||
// The process can die for external reason between the "-gdb-exit" was
|
// The process can die for external reason between the "-gdb-exit" was
|
||||||
// sent and a response could be retrieved. We don't want the watchdog
|
// sent and a response could be retrieved. We don't want the watchdog
|
||||||
// to bark in that case since the only possible outcome is a dead
|
// to bark in that case since the only possible outcome is a dead
|
||||||
// process anyway.
|
// process anyway.
|
||||||
if (!cmd.command.endsWith("-gdb-exit"))
|
if (!cmd.command.endsWith("-gdb-exit"))
|
||||||
m_commandTimer->start();
|
m_commandTimer.start();
|
||||||
|
|
||||||
//if (cmd.flags & LosesChild)
|
//if (cmd.flags & LosesChild)
|
||||||
// notifyInferiorIll();
|
// notifyInferiorIll();
|
||||||
@@ -828,8 +826,8 @@ void GdbEngine::commandTimeout()
|
|||||||
}
|
}
|
||||||
if (killIt) {
|
if (killIt) {
|
||||||
showMessage(_("TIMED OUT WAITING FOR GDB REPLY. COMMANDS STILL IN PROGRESS:"));
|
showMessage(_("TIMED OUT WAITING FOR GDB REPLY. COMMANDS STILL IN PROGRESS:"));
|
||||||
int timeOut = m_commandTimer->interval();
|
int timeOut = m_commandTimer.interval();
|
||||||
//m_commandTimer->stop();
|
//m_commandTimer.stop();
|
||||||
const QString msg = tr("The gdb process has not responded "
|
const QString msg = tr("The gdb process has not responded "
|
||||||
"to a command within %1 seconds. This could mean it is stuck "
|
"to a command within %1 seconds. This could mean it is stuck "
|
||||||
"in an endless loop or taking longer than expected to perform "
|
"in an endless loop or taking longer than expected to perform "
|
||||||
@@ -1011,7 +1009,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_cookieForToken.isEmpty())
|
if (m_cookieForToken.isEmpty())
|
||||||
m_commandTimer->stop();
|
m_commandTimer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::executeDebuggerCommand(const QString &command)
|
void GdbEngine::executeDebuggerCommand(const QString &command)
|
||||||
@@ -4300,8 +4298,8 @@ void GdbEngine::handleGdbError(QProcess::ProcessError error)
|
|||||||
|
|
||||||
void GdbEngine::handleGdbFinished(int code, QProcess::ExitStatus type)
|
void GdbEngine::handleGdbFinished(int code, QProcess::ExitStatus type)
|
||||||
{
|
{
|
||||||
if (m_commandTimer && m_commandTimer->isActive())
|
if (m_commandTimer.isActive())
|
||||||
m_commandTimer->stop();
|
m_commandTimer.stop();
|
||||||
|
|
||||||
//qDebug() << "GDB PROCESS FINISHED";
|
//qDebug() << "GDB PROCESS FINISHED";
|
||||||
showMessage(_("GDB PROCESS FINISHED, status %1, code %2").arg(type).arg(code));
|
showMessage(_("GDB PROCESS FINISHED, status %1, code %2").arg(type).arg(code));
|
||||||
@@ -4478,7 +4476,7 @@ void GdbEngine::handleCreateFullBacktrace(const GdbResponse &response)
|
|||||||
|
|
||||||
void GdbEngine::resetCommandQueue()
|
void GdbEngine::resetCommandQueue()
|
||||||
{
|
{
|
||||||
m_commandTimer->stop();
|
m_commandTimer.stop();
|
||||||
if (!m_cookieForToken.isEmpty()) {
|
if (!m_cookieForToken.isEmpty()) {
|
||||||
QString msg;
|
QString msg;
|
||||||
QTextStream ts(&msg);
|
QTextStream ts(&msg);
|
||||||
|
@@ -45,12 +45,9 @@
|
|||||||
#include <QtCore/QSet>
|
#include <QtCore/QSet>
|
||||||
#include <QtCore/QTextCodec>
|
#include <QtCore/QTextCodec>
|
||||||
#include <QtCore/QTime>
|
#include <QtCore/QTime>
|
||||||
|
#include <QtCore/QTimer>
|
||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QMainWindow;
|
|
||||||
class QTimer;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -257,7 +254,7 @@ private: ////////// Gdb Command Management //////////
|
|||||||
|
|
||||||
QHash<int, GdbCommand> m_cookieForToken;
|
QHash<int, GdbCommand> m_cookieForToken;
|
||||||
int commandTimeoutTime() const;
|
int commandTimeoutTime() const;
|
||||||
QTimer *m_commandTimer;
|
QTimer m_commandTimer;
|
||||||
|
|
||||||
QByteArray m_pendingConsoleStreamOutput;
|
QByteArray m_pendingConsoleStreamOutput;
|
||||||
QByteArray m_pendingLogStreamOutput;
|
QByteArray m_pendingLogStreamOutput;
|
||||||
|
Reference in New Issue
Block a user