- fix: messages send to the gdb process's standard error are not received

This commit is contained in:
royqh1979@gmail.com 2021-10-13 17:20:31 +08:00
parent a1e5ce379e
commit 0c6f4a10a4
8 changed files with 41 additions and 53 deletions

View File

@ -1,6 +1,8 @@
Version 0.6.7
- fix: debugger won't exit when the program has exited.
- fix: messages send to the gdb process's standard error are not received
- adjust: the max value of the debug console's vertical scrollbar.
- fix: shfit+click not correctly set selection's end
- fix: ctrl+home/end not correctly set cursor to start/end of the editor
Version 0.6.6
- fix: crash when create new file

View File

@ -11,6 +11,7 @@
#include <QMessageBox>
#include <QPlainTextEdit>
#include <QDebug>
#include <QDir>
Debugger::Debugger(QObject *parent) : QObject(parent)
{
@ -660,8 +661,6 @@ AnnotationType DebugReader::getAnnotation(const QString &s)
result = AnnotationType::TMemory;
}
return result;
} else if (s == "error") {
return AnnotationType::TError;
} else if (s == "error-begin") {
return AnnotationType::TErrorBegin;
} else if (s == "error-end") {
@ -886,18 +885,6 @@ void DebugReader::handleError()
}
}
void DebugReader::handleErrorExit()
{
if ((mCurrentCmd) && (
mCurrentCmd->command == "next"
|| mCurrentCmd->command == "step"
|| mCurrentCmd->command == "finish"
|| mCurrentCmd->command == "continue")) {
handleExit();
}
}
void DebugReader::handleExit()
{
doprocessexited=true;
@ -1200,9 +1187,6 @@ void DebugReader::processDebugOutput()
case AnnotationType::TSignal:
handleSignal();
break;
case AnnotationType::TError:
handleErrorExit();
break;
case AnnotationType::TExit:
handleExit();
break;
@ -1637,16 +1621,19 @@ void DebugReader::run()
mStop = false;
bool errorOccurred = false;
QString cmd = mDebuggerPath;
// QString arguments = "--annotate=2";
QString arguments = "--annotate=2 --silent";
QString workingDir = QFileInfo(mDebuggerPath).path();
mProcess = new QProcess();
mProcess->setProgram(cmd);
mProcess->setArguments(QProcess::splitCommand(arguments));
mProcess->setProcessChannelMode(QProcess::MergedChannels);
QString cmdDir = extractFileDir(cmd);
if (!cmdDir.isEmpty()) {
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QString path = env.value("PATH");
cmdDir.replace("/",QDir::separator());
if (path.isEmpty()) {
path = cmdDir;
} else {
@ -1661,20 +1648,13 @@ void DebugReader::run()
[&](){
errorOccurred= true;
});
// mProcess.connect(&process, &QProcess::readyReadStandardError,[&process,this](){
// this->error(QString::fromLocal8Bit( process.readAllStandardError()));
// });
// mProcess.connect(&mProcess, &QProcess::readyReadStandardOutput,[&process,this](){
// this->log(QString::fromLocal8Bit( process.readAllStandardOutput()));
// });
// process.connect(&mProcess, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),[&process,this](){
// this->error(COMPILE_PROCESS_END);
// });
QByteArray buffer;
QByteArray readed;
mProcess->start();
mProcess->waitForStarted(5000);
mStartSemaphore.release(1);
QByteArray buffer;
QByteArray readed;
while (true) {
mProcess->waitForFinished(1);
if (mProcess->state()!=QProcess::Running) {

View File

@ -26,7 +26,6 @@ enum class AnnotationType {
TFrameSourceFile, TFrameSourceBegin, TFrameSourceLine, TFrameFunctionName, TFrameWhere,
TFrameArgs,
TFrameBegin, TFrameEnd,
TError,
TErrorBegin, TErrorEnd,
TArrayBegin, TArrayEnd,
TElt, TEltRep, TEltRepEnd,
@ -308,7 +307,6 @@ private:
void handleDisassembly();
void handleDisplay();
void handleError();
void handleErrorExit();
void handleExit();
void handleFrames();
void handleLocalOutput();

View File

@ -185,12 +185,12 @@ void SynEditKeyStrokes::resetDefaults()
add(SynEditorCommand::ecSelPageTop, Qt::Key_PageUp, Qt::ShiftModifier|Qt::ControlModifier);
add(SynEditorCommand::ecLineStart, Qt::Key_Home, Qt::NoModifier);
add(SynEditorCommand::ecSelLineStart, Qt::Key_Home, Qt::ShiftModifier);
add(SynEditorCommand::ecEditorTop, Qt::Key_Home, Qt::ControlModifier);
add(SynEditorCommand::ecSelEditorTop, Qt::Key_Home, Qt::ShiftModifier|Qt::ControlModifier);
add(SynEditorCommand::ecEditorStart, Qt::Key_Home, Qt::ControlModifier);
add(SynEditorCommand::ecSelEditorStart, Qt::Key_Home, Qt::ShiftModifier|Qt::ControlModifier);
add(SynEditorCommand::ecLineEnd, Qt::Key_End, Qt::NoModifier);
add(SynEditorCommand::ecSelLineEnd, Qt::Key_End, Qt::ShiftModifier);
add(SynEditorCommand::ecEditorBottom, Qt::Key_End, Qt::ControlModifier);
add(SynEditorCommand::ecSelEditorBottom, Qt::Key_End, Qt::ShiftModifier|Qt::ControlModifier);
add(SynEditorCommand::ecEditorEnd, Qt::Key_End, Qt::ControlModifier);
add(SynEditorCommand::ecSelEditorEnd, Qt::Key_End, Qt::ShiftModifier|Qt::ControlModifier);
add(SynEditorCommand::ecToggleMode, Qt::Key_Insert, Qt::NoModifier);
add(SynEditorCommand::ecCopy, Qt::Key_Insert, Qt::ControlModifier);
add(SynEditorCommand::ecCut, Qt::Key_Delete, Qt::ShiftModifier);

View File

@ -40,8 +40,8 @@ enum class SynEditorCommand {
ecPageRight = 12, // Move cursor left one page
ecPageTop = 13, // Move cursor to top of page
ecPageBottom = 14, // Move cursor to bottom of page
ecEditorTop = 15, // Move cursor to absolute beginning
ecEditorBottom = 16, // Move cursor to absolute end
ecEditorStart = 15, // Move cursor to absolute beginning
ecEditorEnd = 16, // Move cursor to absolute end
ecGotoXY = 17, // Move cursor to specific coordinates, Data = PPoint
//******************************************************************************
@ -67,8 +67,8 @@ enum class SynEditorCommand {
ecSelPageRight = ecPageRight + ecSelection,
ecSelPageTop = ecPageTop + ecSelection,
ecSelPageBottom = ecPageBottom + ecSelection,
ecSelEditorTop = ecEditorTop + ecSelection,
ecSelEditorBottom = ecEditorBottom + ecSelection,
ecSelEditorStart = ecEditorStart + ecSelection,
ecSelEditorEnd = ecEditorEnd + ecSelection,
ecSelGotoXY = ecGotoXY + ecSelection, // Data = PPoint
ecSelWord = 198,

View File

@ -4953,14 +4953,17 @@ void SynEdit::ExecuteCommand(SynEditorCommand Command, QChar AChar, void *pData)
case SynEditorCommand::ecSelPageBottom:
moveCaretVert(mTopLine+mLinesInWindow-1-mCaretY, Command == SynEditorCommand::ecSelPageBottom);
break;
case SynEditorCommand::ecEditorTop:
case SynEditorCommand::ecSelEditorTop:
moveCaretVert(1-mCaretY, Command == SynEditorCommand::ecSelEditorTop);
case SynEditorCommand::ecEditorStart:
case SynEditorCommand::ecSelEditorStart:
moveCaretVert(1-mCaretY, Command == SynEditorCommand::ecSelEditorStart);
moveCaretToLineStart(Command == SynEditorCommand::ecSelEditorStart);
break;
case SynEditorCommand::ecEditorBottom:
case SynEditorCommand::ecSelEditorBottom:
if (!mLines->empty())
moveCaretVert(mLines->count()-mCaretY, Command == SynEditorCommand::ecSelEditorBottom);
case SynEditorCommand::ecEditorEnd:
case SynEditorCommand::ecSelEditorEnd:
if (!mLines->empty()) {
moveCaretVert(mLines->count()-mCaretY, Command == SynEditorCommand::ecSelEditorEnd);
moveCaretToLineEnd(Command == SynEditorCommand::ecSelEditorStart);
}
break;
// goto special line / column position
case SynEditorCommand::ecGotoXY:
@ -5517,8 +5520,8 @@ void SynEdit::mousePressEvent(QMouseEvent *event)
//I couldn't track down why, but sometimes (and definitely not all the time)
//the block positioning is lost. This makes sure that the block is
//maintained in case they started a drag operation on the block
mBlockBegin = TmpBegin;
mBlockEnd = TmpEnd;
// setBlockBegin(TmpBegin);
// setBlockEnd(TmpEnd);
setMouseTracking(true);
//if mousedown occurred in selected block begin drag operation
@ -5530,19 +5533,19 @@ void SynEdit::mousePressEvent(QMouseEvent *event)
if (bStartDrag) {
mStateFlags.setFlag(SynStateFlag::sfWaitForDragging);
} else {
if (event->modifiers() == Qt::ShiftModifier)
if (event->modifiers() == Qt::ShiftModifier) {
//BlockBegin and BlockEnd are restored to their original position in the
//code from above and SetBlockEnd will take care of proper invalidation
setBlockEnd(caretXY());
else if (mOptions.testFlag(eoAltSetsColumnMode) &&
} else if (mOptions.testFlag(eoAltSetsColumnMode) &&
(mActiveSelectionMode != SynSelectionMode::smLine)) {
if (event->modifiers() == Qt::AltModifier)
setSelectionMode(SynSelectionMode::smColumn);
else
setSelectionMode(SynSelectionMode::smNormal);
//Selection mode must be set before calling SetBlockBegin
setBlockBegin(caretXY());
}
//Selection mode must be set before calling SetBlockBegin
setBlockBegin(caretXY());
}
}
}

View File

@ -3,7 +3,7 @@
#include <QStringList>
#define DEVCPP_VERSION "0.6.6"
#define DEVCPP_VERSION "0.6.7"
#ifdef Q_OS_WIN
#define APP_SETTSINGS_FILENAME "redpandacpp.ini"

View File

@ -190,6 +190,11 @@ int getNewFileNumber();
class CppParser;
void resetCppParser(std::shared_ptr<CppParser> parser);
/**
* from https://github.com/Microsoft/GSL
**/
template <class F>
class final_action
{