- fix: compile error in linux

- fix: can't receive gdb async output for commands
This commit is contained in:
Roy Qu 2021-12-27 21:32:30 +08:00
parent 5e44a2a1c6
commit fe8d3e9663
4 changed files with 25 additions and 12 deletions

View File

@ -1,3 +1,7 @@
Version 0.12.5 For Dev-C++ 7 Beta
- fix: compile error in linux
- fix: can't receive gdb async output for commands
Version 0.12.4 For Dev-C++ 7 Beta Version 0.12.4 For Dev-C++ 7 Beta
- change: add copyright infos to each source file - change: add copyright infos to each source file
- fix: watch and local infos not updated when changing current frame in the call stack panel - fix: watch and local infos not updated when changing current frame in the call stack panel

View File

@ -246,8 +246,6 @@ bool Debugger::inferiorRunning()
void Debugger::interrupt() void Debugger::interrupt()
{ {
sendCommand("-exec-interrupt", ""); sendCommand("-exec-interrupt", "");
QTimer::singleShot(1000,this, &Debugger::interruptRefresh);
} }
void Debugger::addBreakpoint(int line, const Editor* editor) void Debugger::addBreakpoint(int line, const Editor* editor)
@ -408,11 +406,6 @@ void Debugger::fetchVarChildren(const QString &varName)
} }
} }
void Debugger::interruptRefresh()
{
sendCommand("noop","");
}
void Debugger::removeWatchVars(bool deleteparent) void Debugger::removeWatchVars(bool deleteparent)
{ {
if (deleteparent) { if (deleteparent) {
@ -617,6 +610,7 @@ DebugReader::DebugReader(Debugger* debugger, QObject *parent) : QThread(parent),
mDebugger = debugger; mDebugger = debugger;
mProcess = std::make_shared<QProcess>(); mProcess = std::make_shared<QProcess>();
mCmdRunning = false; mCmdRunning = false;
mAsyncUpdated = false;
} }
void DebugReader::postCommand(const QString &Command, const QString &Params, void DebugReader::postCommand(const QString &Command, const QString &Params,
@ -936,12 +930,18 @@ void DebugReader::runNextCmd()
{ {
QMutexLocker locker(&mCmdQueueMutex); QMutexLocker locker(&mCmdQueueMutex);
PDebugCommand lastCmd = mCurrentCmd;
if (mCurrentCmd) { if (mCurrentCmd) {
mCurrentCmd.reset(); mCurrentCmd=nullptr;
emit cmdFinished(); emit cmdFinished();
} }
if (mCmdQueue.isEmpty()) if (mCmdQueue.isEmpty()) {
if (pSettings->debugger().useGDBServer() && mInferiorRunning && !mAsyncUpdated) {
mAsyncUpdated = true;
QTimer::singleShot(1000,this,&DebugReader::asyncUpdate);
}
return; return;
}
PDebugCommand pCmd = mCmdQueue.dequeue(); PDebugCommand pCmd = mCmdQueue.dequeue();
mCmdRunning = true; mCmdRunning = true;
@ -1237,6 +1237,14 @@ QByteArray DebugReader::removeToken(const QByteArray &line)
return line; return line;
} }
void DebugReader::asyncUpdate()
{
QMutexLocker locker(&mCmdQueueMutex);
if (mCmdQueue.isEmpty())
postCommand("noop","",DebugCommandSource::Other);
mAsyncUpdated = false;
}
const QString &DebugReader::signalMeaning() const const QString &DebugReader::signalMeaning() const
{ {
return mSignalMeaning; return mSignalMeaning;

View File

@ -275,7 +275,6 @@ private slots:
void updateRegisterValues(const QHash<int,QString>& values); void updateRegisterValues(const QHash<int,QString>& values);
void refreshWatchVars(); void refreshWatchVars();
void fetchVarChildren(const QString& varName); void fetchVarChildren(const QString& varName);
void interruptRefresh();
private: private:
bool mExecuting; bool mExecuting;
bool mCommandChanged; bool mCommandChanged;
@ -424,6 +423,8 @@ private:
void processDebugOutput(const QByteArray& debugOutput); void processDebugOutput(const QByteArray& debugOutput);
void runInferiorStoppedHook(); void runInferiorStoppedHook();
QByteArray removeToken(const QByteArray& line); QByteArray removeToken(const QByteArray& line);
private slots:
void asyncUpdate();
private: private:
Debugger *mDebugger; Debugger *mDebugger;
QString mDebuggerPath; QString mDebuggerPath;
@ -431,7 +432,7 @@ private:
QSemaphore mStartSemaphore; QSemaphore mStartSemaphore;
QQueue<PDebugCommand> mCmdQueue; QQueue<PDebugCommand> mCmdQueue;
bool mErrorOccured; bool mErrorOccured;
bool mAsyncUpdated;
//fOnInvalidateAllVars: TInvalidateAllVarsEvent; //fOnInvalidateAllVars: TInvalidateAllVarsEvent;
bool mCmdRunning; bool mCmdRunning;
PDebugCommand mCurrentCmd; PDebugCommand mCurrentCmd;

View File

@ -178,7 +178,7 @@ QString Settings::Dirs::appLibDir() const
return appDir(); return appDir();
#elif defined(Q_OS_LINUX) #elif defined(Q_OS_LINUX)
if (isGreenEdition()) { if (isGreenEdition()) {
return app(); return appDir();
} }
return includeTrailingPathDelimiter(PREFIX)+"lib"; return includeTrailingPathDelimiter(PREFIX)+"lib";
#endif #endif