- 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 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. - 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 Version 0.6.6
- fix: crash when create new file - fix: crash when create new file

View File

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

View File

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

View File

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

View File

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

View File

@ -4953,14 +4953,17 @@ void SynEdit::ExecuteCommand(SynEditorCommand Command, QChar AChar, void *pData)
case SynEditorCommand::ecSelPageBottom: case SynEditorCommand::ecSelPageBottom:
moveCaretVert(mTopLine+mLinesInWindow-1-mCaretY, Command == SynEditorCommand::ecSelPageBottom); moveCaretVert(mTopLine+mLinesInWindow-1-mCaretY, Command == SynEditorCommand::ecSelPageBottom);
break; break;
case SynEditorCommand::ecEditorTop: case SynEditorCommand::ecEditorStart:
case SynEditorCommand::ecSelEditorTop: case SynEditorCommand::ecSelEditorStart:
moveCaretVert(1-mCaretY, Command == SynEditorCommand::ecSelEditorTop); moveCaretVert(1-mCaretY, Command == SynEditorCommand::ecSelEditorStart);
moveCaretToLineStart(Command == SynEditorCommand::ecSelEditorStart);
break; break;
case SynEditorCommand::ecEditorBottom: case SynEditorCommand::ecEditorEnd:
case SynEditorCommand::ecSelEditorBottom: case SynEditorCommand::ecSelEditorEnd:
if (!mLines->empty()) if (!mLines->empty()) {
moveCaretVert(mLines->count()-mCaretY, Command == SynEditorCommand::ecSelEditorBottom); moveCaretVert(mLines->count()-mCaretY, Command == SynEditorCommand::ecSelEditorEnd);
moveCaretToLineEnd(Command == SynEditorCommand::ecSelEditorStart);
}
break; break;
// goto special line / column position // goto special line / column position
case SynEditorCommand::ecGotoXY: 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) //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 //the block positioning is lost. This makes sure that the block is
//maintained in case they started a drag operation on the block //maintained in case they started a drag operation on the block
mBlockBegin = TmpBegin; // setBlockBegin(TmpBegin);
mBlockEnd = TmpEnd; // setBlockEnd(TmpEnd);
setMouseTracking(true); setMouseTracking(true);
//if mousedown occurred in selected block begin drag operation //if mousedown occurred in selected block begin drag operation
@ -5530,19 +5533,19 @@ void SynEdit::mousePressEvent(QMouseEvent *event)
if (bStartDrag) { if (bStartDrag) {
mStateFlags.setFlag(SynStateFlag::sfWaitForDragging); mStateFlags.setFlag(SynStateFlag::sfWaitForDragging);
} else { } else {
if (event->modifiers() == Qt::ShiftModifier) if (event->modifiers() == Qt::ShiftModifier) {
//BlockBegin and BlockEnd are restored to their original position in the //BlockBegin and BlockEnd are restored to their original position in the
//code from above and SetBlockEnd will take care of proper invalidation //code from above and SetBlockEnd will take care of proper invalidation
setBlockEnd(caretXY()); setBlockEnd(caretXY());
else if (mOptions.testFlag(eoAltSetsColumnMode) && } else if (mOptions.testFlag(eoAltSetsColumnMode) &&
(mActiveSelectionMode != SynSelectionMode::smLine)) { (mActiveSelectionMode != SynSelectionMode::smLine)) {
if (event->modifiers() == Qt::AltModifier) if (event->modifiers() == Qt::AltModifier)
setSelectionMode(SynSelectionMode::smColumn); setSelectionMode(SynSelectionMode::smColumn);
else else
setSelectionMode(SynSelectionMode::smNormal); 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> #include <QStringList>
#define DEVCPP_VERSION "0.6.6" #define DEVCPP_VERSION "0.6.7"
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#define APP_SETTSINGS_FILENAME "redpandacpp.ini" #define APP_SETTSINGS_FILENAME "redpandacpp.ini"

View File

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