- enhancement: Execute the last debug command in the debug console if ENTER pressed.
This commit is contained in:
parent
86dac40057
commit
365c15a874
3
NEWS.md
3
NEWS.md
|
@ -52,7 +52,8 @@ Red Panda C++ Version 2.27
|
|||
- fix: In the debugger console, Auto-wrapped lines can't be correctly selected.
|
||||
- enhancement: Auto choose a better font for theme choosing dialog in the first run.
|
||||
- fix: Debugger console's background not correctly cleared before redrawn.
|
||||
- enhancement: Make output in the debugger console cleaner.
|
||||
- enhancement: Make output in the debug console cleaner.
|
||||
- enhancement: Execute the last debug command in the debug console if ENTER pressed.
|
||||
|
||||
Red Panda C++ Version 2.26
|
||||
- enhancement: Code suggestion for embedded std::vectors.
|
||||
|
|
|
@ -42,11 +42,24 @@ void GDBMIDebuggerClient::postCommand(const QString &command, const QString &par
|
|||
DebugCommandSource source)
|
||||
{
|
||||
QMutexLocker locker(&mCmdQueueMutex);
|
||||
PDebugCommand pCmd = std::make_shared<DebugCommand>();
|
||||
PGDBMICommand pCmd;
|
||||
if (source == DebugCommandSource::Console) {
|
||||
if (command.trimmed().isEmpty()) {
|
||||
if (mLastConsoleCmd) {
|
||||
pCmd = mLastConsoleCmd;
|
||||
mCmdQueue.enqueue(pCmd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
pCmd = std::make_shared<GDBMICommand>();
|
||||
if (source == DebugCommandSource::Console)
|
||||
mLastConsoleCmd = pCmd;
|
||||
pCmd->command = command;
|
||||
pCmd->params = params;
|
||||
pCmd->source = source;
|
||||
mCmdQueue.enqueue(pCmd);
|
||||
|
||||
// if (!mCmdRunning)
|
||||
// runNextCmd();
|
||||
}
|
||||
|
@ -54,7 +67,7 @@ void GDBMIDebuggerClient::postCommand(const QString &command, const QString &par
|
|||
void GDBMIDebuggerClient::registerInferiorStoppedCommand(const QString &command, const QString ¶ms)
|
||||
{
|
||||
QMutexLocker locker(&mCmdQueueMutex);
|
||||
PDebugCommand pCmd = std::make_shared<DebugCommand>();
|
||||
PGDBMICommand pCmd = std::make_shared<GDBMICommand>();
|
||||
pCmd->command = command;
|
||||
pCmd->params = params;
|
||||
pCmd->source = DebugCommandSource::Other;
|
||||
|
@ -171,7 +184,7 @@ void GDBMIDebuggerClient::runNextCmd()
|
|||
return;
|
||||
}
|
||||
|
||||
PDebugCommand pCmd = mCmdQueue.dequeue();
|
||||
PGDBMICommand pCmd = mCmdQueue.dequeue();
|
||||
mCmdRunning = true;
|
||||
mCurrentCmd = pCmd;
|
||||
if (pCmd->source!=DebugCommandSource::HeartBeat)
|
||||
|
@ -779,16 +792,17 @@ void GDBMIDebuggerClient::processExecAsyncRecord(const QByteArray &line)
|
|||
runInferiorStoppedHook();
|
||||
if (reason.isEmpty()) {
|
||||
QMutexLocker locker(&mCmdQueueMutex);
|
||||
foreach (const PDebugCommand& cmd, mCmdQueue) {
|
||||
foreach (const PGDBMICommand& cmd, mCmdQueue) {
|
||||
//gdb-server connected, just ignore it
|
||||
if (cmd->command=="-exec-continue")
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (mCurrentCmd && mCurrentCmd->source == DebugCommandSource::Console)
|
||||
emit inferiorStopped(mCurrentFile, mCurrentLine, false);
|
||||
else
|
||||
emit inferiorStopped(mCurrentFile, mCurrentLine, true);
|
||||
// if (mCurrentCmd && mCurrentCmd->source == DebugCommandSource::Console)
|
||||
// emit inferiorStopped(mCurrentFile, mCurrentLine, false);
|
||||
// else
|
||||
// emit inferiorStopped(mCurrentFile, mCurrentLine, true);
|
||||
emit inferiorStopped(mCurrentFile, mCurrentLine, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -953,7 +967,7 @@ void GDBMIDebuggerClient::asyncUpdate()
|
|||
mAsyncUpdated = false;
|
||||
}
|
||||
|
||||
const PDebugCommand &GDBMIDebuggerClient::currentCmd() const
|
||||
const PGDBMICommand &GDBMIDebuggerClient::currentCmd() const
|
||||
{
|
||||
return mCurrentCmd;
|
||||
}
|
||||
|
@ -1242,7 +1256,7 @@ void GDBMIDebuggerClient::addSymbolSearchDirectories(const QStringList &lst)
|
|||
void GDBMIDebuggerClient::runInferiorStoppedHook()
|
||||
{
|
||||
QMutexLocker locker(&mCmdQueueMutex);
|
||||
foreach (const PDebugCommand& cmd, mInferiorStoppedHookCommands) {
|
||||
foreach (const PGDBMICommand& cmd, mInferiorStoppedHookCommands) {
|
||||
mCmdQueue.push_front(cmd);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,13 +27,13 @@
|
|||
#include <memory>
|
||||
#include <QRegularExpression>
|
||||
|
||||
struct DebugCommand{
|
||||
struct GDBMICommand{
|
||||
QString command;
|
||||
QString params;
|
||||
DebugCommandSource source;
|
||||
};
|
||||
|
||||
using PDebugCommand = std::shared_ptr<DebugCommand>;
|
||||
using PGDBMICommand = std::shared_ptr<GDBMICommand>;
|
||||
|
||||
class GDBMIDebuggerClient: public DebuggerClient {
|
||||
Q_OBJECT
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
void stopDebug() override;
|
||||
DebuggerType clientType() override;
|
||||
const PDebugCommand ¤tCmd() const;
|
||||
const PGDBMICommand ¤tCmd() const;
|
||||
bool commandRunning() override;
|
||||
|
||||
void initialize(const QString& inferior, bool hasSymbols) override;
|
||||
|
@ -135,9 +135,10 @@ private:
|
|||
|
||||
static const QRegularExpression REGdbSourceLine;
|
||||
|
||||
QQueue<PDebugCommand> mCmdQueue;
|
||||
PDebugCommand mCurrentCmd;
|
||||
QList<PDebugCommand> mInferiorStoppedHookCommands;
|
||||
QQueue<PGDBMICommand> mCmdQueue;
|
||||
PGDBMICommand mCurrentCmd;
|
||||
PGDBMICommand mLastConsoleCmd;
|
||||
QList<PGDBMICommand> mInferiorStoppedHookCommands;
|
||||
|
||||
DebuggerType mClientType;
|
||||
};
|
||||
|
|
|
@ -570,7 +570,7 @@ void QConsole::keyPressEvent(QKeyEvent *event)
|
|||
if (mReadonly)
|
||||
return;
|
||||
emit commandInput(mCommand);
|
||||
if (mHistorySize>0) {
|
||||
if (mHistorySize>0 && !mCommand.trimmed().isEmpty()) {
|
||||
if (mCommandHistory.size()==mHistorySize) {
|
||||
mCommandHistory.pop_front();
|
||||
mHistoryIndex--;
|
||||
|
|
Loading…
Reference in New Issue