- fix: current line of the disassembly in the cpu window not correctly setted
- enhancement: add "step into one machine instruction" and "step over one machine instruction" in the cpu window
This commit is contained in:
parent
436a299ebb
commit
879f001d0c
2
NEWS.md
2
NEWS.md
|
@ -2,6 +2,8 @@ Version 0.11.2 For Dev-C++ 7 Beta
|
||||||
- fix: button "run all problem cases" not disabled when compiling or debugging
|
- fix: button "run all problem cases" not disabled when compiling or debugging
|
||||||
- enhancement: set font for problem case input/output textedits
|
- enhancement: set font for problem case input/output textedits
|
||||||
- enhancement: when run problem cases, updates output immediately
|
- enhancement: when run problem cases, updates output immediately
|
||||||
|
- fix: current line of the disassembly in the cpu window not correctly setted
|
||||||
|
- enhancement: add "step into one machine instruction" and "step over one machine instruction" in the cpu window
|
||||||
|
|
||||||
Version 0.11.1 For Dev-C++ 7 Beta
|
Version 0.11.1 For Dev-C++ 7 Beta
|
||||||
- enhancement: Problem's test case shouldn't accept rich text inputs
|
- enhancement: Problem's test case shouldn't accept rich text inputs
|
||||||
|
|
|
@ -84,7 +84,8 @@ void ExecutableRunner::run()
|
||||||
args->startupInfo -> dwFlags &= ~STARTF_USESTDHANDLES;
|
args->startupInfo -> dwFlags &= ~STARTF_USESTDHANDLES;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
process.connect(&process, &QProcess::errorOccurred,
|
process.connect(
|
||||||
|
&process, &QProcess::errorOccurred,
|
||||||
[&](){
|
[&](){
|
||||||
errorOccurred= true;
|
errorOccurred= true;
|
||||||
});
|
});
|
||||||
|
|
|
@ -47,18 +47,14 @@ void OJProblemCasesRunner::runCase(int index,POJProblemCase problemCase)
|
||||||
}
|
}
|
||||||
env.insert("PATH",path);
|
env.insert("PATH",path);
|
||||||
process.setProcessEnvironment(env);
|
process.setProcessEnvironment(env);
|
||||||
process.setCreateProcessArgumentsModifier([this](QProcess::CreateProcessArguments * args){
|
|
||||||
args->flags |= CREATE_NEW_CONSOLE;
|
|
||||||
args->startupInfo -> dwFlags |= STARTF_USESHOWWINDOW;
|
|
||||||
args->startupInfo->wShowWindow = SW_HIDE;
|
|
||||||
});
|
|
||||||
process.setProcessChannelMode(QProcess::MergedChannels);
|
process.setProcessChannelMode(QProcess::MergedChannels);
|
||||||
process.connect(&process, &QProcess::errorOccurred,
|
process.connect(
|
||||||
|
&process, &QProcess::errorOccurred,
|
||||||
[&](){
|
[&](){
|
||||||
errorOccurred= true;
|
errorOccurred= true;
|
||||||
});
|
});
|
||||||
problemCase->output.clear();
|
problemCase->output.clear();
|
||||||
process.start(QProcess::ReadWrite|QProcess::Unbuffered);
|
process.start();
|
||||||
process.waitForStarted(5000);
|
process.waitForStarted(5000);
|
||||||
if (process.state()==QProcess::Running) {
|
if (process.state()==QProcess::Running) {
|
||||||
process.write(problemCase->input.toUtf8());
|
process.write(problemCase->input.toUtf8());
|
||||||
|
@ -85,10 +81,10 @@ void OJProblemCasesRunner::runCase(int index,POJProblemCase problemCase)
|
||||||
if (errorOccurred)
|
if (errorOccurred)
|
||||||
break;
|
break;
|
||||||
QList<QByteArray> lines = splitByteArrayToLines(buffer);
|
QList<QByteArray> lines = splitByteArrayToLines(buffer);
|
||||||
qDebug()<<"----do buffer----";
|
// qDebug()<<"----do buffer----";
|
||||||
qDebug()<<readed;
|
// qDebug()<<readed;
|
||||||
qDebug()<<buffer;
|
// qDebug()<<buffer;
|
||||||
qDebug()<<lines.count();
|
// qDebug()<<lines.count();
|
||||||
if (lines.count()>=2) {
|
if (lines.count()>=2) {
|
||||||
for (int i=0;i<lines.count()-1;i++) {
|
for (int i=0;i<lines.count()-1;i++) {
|
||||||
QString line = QString::fromLocal8Bit(lines[i]);
|
QString line = QString::fromLocal8Bit(lines[i]);
|
||||||
|
@ -140,10 +136,10 @@ void OJProblemCasesRunner::run()
|
||||||
auto action = finally([this]{
|
auto action = finally([this]{
|
||||||
emit terminated();
|
emit terminated();
|
||||||
});
|
});
|
||||||
for (int i=0;i<mProblemCases.size();i++) {
|
for (int i=0; i < mProblemCases.size(); i++) {
|
||||||
if (mStop)
|
if (mStop)
|
||||||
break;
|
break;
|
||||||
POJProblemCase problemCase =mProblemCases[i];
|
POJProblemCase problemCase = mProblemCases[i];
|
||||||
runCase(i,problemCase);
|
runCase(i,problemCase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1249,7 +1249,7 @@ void Editor::copyAsHTML()
|
||||||
void Editor::setCaretPosition(int line, int aChar)
|
void Editor::setCaretPosition(int line, int aChar)
|
||||||
{
|
{
|
||||||
this->uncollapseAroundLine(line);
|
this->uncollapseAroundLine(line);
|
||||||
this->setCaretXYCentered(true,BufferCoord{aChar,line});
|
this->setCaretXYCentered(BufferCoord{aChar,line});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setCaretPositionAndActivate(int line, int aChar)
|
void Editor::setCaretPositionAndActivate(int line, int aChar)
|
||||||
|
@ -1257,7 +1257,7 @@ void Editor::setCaretPositionAndActivate(int line, int aChar)
|
||||||
this->uncollapseAroundLine(line);
|
this->uncollapseAroundLine(line);
|
||||||
if (!this->hasFocus())
|
if (!this->hasFocus())
|
||||||
this->activate();
|
this->activate();
|
||||||
this->setCaretXYCentered(true,BufferCoord{aChar,line});
|
this->setCaretXYCentered(BufferCoord{aChar,line});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::addSyntaxIssues(int line, int startChar, int endChar, CompileIssueType errorType, const QString &hint)
|
void Editor::addSyntaxIssues(int line, int startChar, int endChar, CompileIssueType errorType, const QString &hint)
|
||||||
|
|
|
@ -3076,6 +3076,9 @@ void MainWindow::disableDebugActions()
|
||||||
ui->actionContinue->setEnabled(false);
|
ui->actionContinue->setEnabled(false);
|
||||||
ui->cbEvaluate->setEnabled(false);
|
ui->cbEvaluate->setEnabled(false);
|
||||||
ui->cbMemoryAddress->setEnabled(false);
|
ui->cbMemoryAddress->setEnabled(false);
|
||||||
|
if (mCPUDialog) {
|
||||||
|
mCPUDialog->updateButtonStates(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::enableDebugActions()
|
void MainWindow::enableDebugActions()
|
||||||
|
@ -3087,6 +3090,9 @@ void MainWindow::enableDebugActions()
|
||||||
ui->actionContinue->setEnabled(!mDebugger->inferiorRunning());
|
ui->actionContinue->setEnabled(!mDebugger->inferiorRunning());
|
||||||
ui->cbEvaluate->setEnabled(!mDebugger->inferiorRunning());
|
ui->cbEvaluate->setEnabled(!mDebugger->inferiorRunning());
|
||||||
ui->cbMemoryAddress->setEnabled(!mDebugger->inferiorRunning());
|
ui->cbMemoryAddress->setEnabled(!mDebugger->inferiorRunning());
|
||||||
|
if (mCPUDialog) {
|
||||||
|
mCPUDialog->updateButtonStates(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onTodoParseStarted(const QString&)
|
void MainWindow::onTodoParseStarted(const QString&)
|
||||||
|
|
|
@ -203,10 +203,10 @@ void SynEdit::setCaretY(int value)
|
||||||
|
|
||||||
void SynEdit::setCaretXY(const BufferCoord &value)
|
void SynEdit::setCaretXY(const BufferCoord &value)
|
||||||
{
|
{
|
||||||
setCaretXYCentered(false,value);
|
setCaretXYEx(true,value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEdit::setCaretXYEx(bool CallEnsureCursorPos, BufferCoord value)
|
void SynEdit::setCaretXYEx(bool CallEnsureCursorPosVisible, BufferCoord value)
|
||||||
{
|
{
|
||||||
bool vTriggerPaint=true; //how to test it?
|
bool vTriggerPaint=true; //how to test it?
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ void SynEdit::setCaretXYEx(bool CallEnsureCursorPos, BufferCoord value)
|
||||||
// calls could raise an exception, and we don't want fLastCaretX to be
|
// calls could raise an exception, and we don't want fLastCaretX to be
|
||||||
// left in an undefined state if that happens.
|
// left in an undefined state if that happens.
|
||||||
updateLastCaretX();
|
updateLastCaretX();
|
||||||
if (CallEnsureCursorPos)
|
if (CallEnsureCursorPosVisible)
|
||||||
ensureCursorPosVisible();
|
ensureCursorPosVisible();
|
||||||
mStateFlags.setFlag(SynStateFlag::sfCaretChanged);
|
mStateFlags.setFlag(SynStateFlag::sfCaretChanged);
|
||||||
mStateFlags.setFlag(SynStateFlag::sfScrollbarChanged);
|
mStateFlags.setFlag(SynStateFlag::sfScrollbarChanged);
|
||||||
|
@ -279,20 +279,19 @@ void SynEdit::setCaretXYEx(bool CallEnsureCursorPos, BufferCoord value)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEdit::setCaretXYCentered(bool ForceToMiddle, const BufferCoord &value)
|
void SynEdit::setCaretXYCentered(const BufferCoord &value)
|
||||||
{
|
{
|
||||||
incPaintLock();
|
incPaintLock();
|
||||||
auto action = finally([this] {
|
auto action = finally([this] {
|
||||||
decPaintLock();
|
decPaintLock();
|
||||||
});
|
});
|
||||||
mStatusChanges.setFlag(SynStatusChange::scSelection);
|
mStatusChanges.setFlag(SynStatusChange::scSelection);
|
||||||
setCaretXYEx(ForceToMiddle,value);
|
setCaretXYEx(false,value);
|
||||||
if (selAvail())
|
if (selAvail())
|
||||||
invalidateSelection();
|
invalidateSelection();
|
||||||
mBlockBegin.Char = mCaretX;
|
mBlockBegin.Char = mCaretX;
|
||||||
mBlockBegin.Line = mCaretY;
|
mBlockBegin.Line = mCaretY;
|
||||||
mBlockEnd = mBlockBegin;
|
mBlockEnd = mBlockBegin;
|
||||||
if (ForceToMiddle)
|
|
||||||
ensureCursorPosVisibleEx(true); // but here after block has been set
|
ensureCursorPosVisibleEx(true); // but here after block has been set
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -213,8 +213,8 @@ public:
|
||||||
void setCaretX(int value);
|
void setCaretX(int value);
|
||||||
void setCaretY(int value);
|
void setCaretY(int value);
|
||||||
void setCaretXY(const BufferCoord& value);
|
void setCaretXY(const BufferCoord& value);
|
||||||
void setCaretXYEx(bool CallEnsureCursorPos, BufferCoord value);
|
void setCaretXYEx(bool CallEnsureCursorPosVisible, BufferCoord value);
|
||||||
void setCaretXYCentered(bool ForceToMiddle, const BufferCoord& value);
|
void setCaretXYCentered(const BufferCoord& value);
|
||||||
void setCaretAndSelection(const BufferCoord& ptCaret,
|
void setCaretAndSelection(const BufferCoord& ptCaret,
|
||||||
const BufferCoord& ptBefore,
|
const BufferCoord& ptBefore,
|
||||||
const BufferCoord& ptAfter);
|
const BufferCoord& ptAfter);
|
||||||
|
|
|
@ -65,6 +65,12 @@ void CPUDialog::updateInfo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPUDialog::updateButtonStates(bool enable)
|
||||||
|
{
|
||||||
|
ui->btnStepIntoInstruction->setEnabled(enable);
|
||||||
|
ui->btnStepOverInstruction->setEnabled(enable);
|
||||||
|
}
|
||||||
|
|
||||||
void CPUDialog::setDisassembly(const QString& file, const QString& funcName,const QStringList& lines)
|
void CPUDialog::setDisassembly(const QString& file, const QString& funcName,const QStringList& lines)
|
||||||
{
|
{
|
||||||
ui->txtFunctionName->setText(QString("%1:%2").arg(file, funcName));
|
ui->txtFunctionName->setText(QString("%1:%2").arg(file, funcName));
|
||||||
|
@ -78,7 +84,7 @@ void CPUDialog::setDisassembly(const QString& file, const QString& funcName,cons
|
||||||
ui->txtCode->lines()->add(line);
|
ui->txtCode->lines()->add(line);
|
||||||
}
|
}
|
||||||
if (activeLine!=-1)
|
if (activeLine!=-1)
|
||||||
ui->txtCode->setCaretXYCentered(true,BufferCoord{1,activeLine});
|
ui->txtCode->setCaretXYEx(true,BufferCoord{1,activeLine+1});
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDialog::sendSyntaxCommand()
|
void CPUDialog::sendSyntaxCommand()
|
||||||
|
@ -117,3 +123,15 @@ void CPUDialog::on_chkBlendMode_stateChanged(int)
|
||||||
pSettings->debugger().setBlendMode(ui->chkBlendMode->isCheckable());
|
pSettings->debugger().setBlendMode(ui->chkBlendMode->isCheckable());
|
||||||
pSettings->debugger().save();
|
pSettings->debugger().save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPUDialog::on_btnStepOverInstruction_clicked()
|
||||||
|
{
|
||||||
|
pMainWindow->debugger()->sendCommand("-exec-next-instruction","");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CPUDialog::on_btnStepIntoInstruction_clicked()
|
||||||
|
{
|
||||||
|
pMainWindow->debugger()->sendCommand("-exec-step-instruction","");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ public:
|
||||||
explicit CPUDialog(QWidget *parent = nullptr);
|
explicit CPUDialog(QWidget *parent = nullptr);
|
||||||
~CPUDialog();
|
~CPUDialog();
|
||||||
void updateInfo();
|
void updateInfo();
|
||||||
|
void updateButtonStates(bool enable);
|
||||||
public slots:
|
public slots:
|
||||||
void setDisassembly(const QString& file, const QString& funcName,const QStringList& lines);
|
void setDisassembly(const QString& file, const QString& funcName,const QStringList& lines);
|
||||||
signals:
|
signals:
|
||||||
|
@ -30,6 +31,8 @@ private slots:
|
||||||
void on_rdIntel_toggled(bool checked);
|
void on_rdIntel_toggled(bool checked);
|
||||||
void on_rdATT_toggled(bool checked);
|
void on_rdATT_toggled(bool checked);
|
||||||
void on_chkBlendMode_stateChanged(int arg1);
|
void on_chkBlendMode_stateChanged(int arg1);
|
||||||
|
void on_btnStepOverInstruction_clicked();
|
||||||
|
void on_btnStepIntoInstruction_clicked();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CPUDIALOG_H
|
#endif // CPUDIALOG_H
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>767</width>
|
<width>879</width>
|
||||||
<height>498</height>
|
<height>498</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -110,6 +110,41 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="btnStepOverInstruction">
|
||||||
|
<property name="text">
|
||||||
|
<string>Step over one machine instruction</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../icons.qrc">
|
||||||
|
<normaloff>:/icons/images/newlook24/052-next.png</normaloff>:/icons/images/newlook24/052-next.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="btnStepIntoInstruction">
|
||||||
|
<property name="text">
|
||||||
|
<string>Step into one machine instruction</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../icons.qrc">
|
||||||
|
<normaloff>:/icons/images/newlook24/040-goto.png</normaloff>:/icons/images/newlook24/040-goto.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="rdATT">
|
<widget class="QRadioButton" name="rdATT">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -130,19 +165,6 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="chkBlendMode">
|
<widget class="QCheckBox" name="chkBlendMode">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -181,7 +203,9 @@
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="../icons.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
<buttongroups>
|
<buttongroups>
|
||||||
<buttongroup name="buttonGroup"/>
|
<buttongroup name="buttonGroup"/>
|
||||||
|
|
Loading…
Reference in New Issue