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