From 96ab0890ba0104f57582c66336bd3bea15a15e02 Mon Sep 17 00:00:00 2001 From: "royqh1979@gmail.com" Date: Mon, 27 Dec 2021 10:59:04 +0800 Subject: [PATCH] - fix: watch and local infos not updated when changing current frame in the call stack panel - enhancement: pause the debugging program (The debugger should work under gdb server mode, which is turned off by default in windows) --- NEWS.md | 5 ++ RedPandaIDE/debugger.cpp | 46 ++++-------- RedPandaIDE/debugger.h | 3 + RedPandaIDE/editor.cpp | 8 +- RedPandaIDE/icons.qrc | 1 + RedPandaIDE/iconsmanager.cpp | 2 +- RedPandaIDE/iconsmanager.h | 1 + .../newlook/actions/05Run-16Interrupt.svg | 73 +++++++++++++++++++ RedPandaIDE/mainwindow.cpp | 22 +++++- RedPandaIDE/mainwindow.h | 2 + RedPandaIDE/mainwindow.ui | 14 +++- RedPandaIDE/version.h | 2 +- RedPandaIDE/widgets/aboutdialog.ui | 13 +--- 13 files changed, 142 insertions(+), 50 deletions(-) create mode 100644 RedPandaIDE/images/newlook/actions/05Run-16Interrupt.svg diff --git a/NEWS.md b/NEWS.md index e42a40c6..fa4da537 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +Version 0.12.4 For Dev-C++ 7 Beta + - change: add copyright infos to each source file + - fix: watch and local infos not updated when changing current frame in the call stack panel + - enhancement: pause the debugging program (The debugger should work under gdb server mode, which is turned off by default in windows) + Version 0.12.3 For Dev-C++ 7 Beta - enhancement: basic linux compatibility - enhancement: debug with gdb server diff --git a/RedPandaIDE/debugger.cpp b/RedPandaIDE/debugger.cpp index cbbf5009..d4dbc022 100644 --- a/RedPandaIDE/debugger.cpp +++ b/RedPandaIDE/debugger.cpp @@ -243,6 +243,13 @@ bool Debugger::inferiorRunning() return false; } +void Debugger::interrupt() +{ + sendCommand("-exec-interrupt", ""); + QTimer::singleShot(1000,this, &Debugger::interruptRefresh); + +} + void Debugger::addBreakpoint(int line, const Editor* editor) { addBreakpoint(line,editor->filename()); @@ -401,6 +408,11 @@ void Debugger::fetchVarChildren(const QString &varName) } } +void Debugger::interruptRefresh() +{ + sendCommand("noop",""); +} + void Debugger::removeWatchVars(bool deleteparent) { if (deleteparent) { @@ -542,7 +554,9 @@ void Debugger::syncFinishedParsing() return; } - if (mReader->signalReceived()) { + if (mReader->signalReceived() + && mReader->signalName()!="SIGINT" + && mReader->signalName()!="SIGTRAP") { SignalMessageDialog dialog(pMainWindow); dialog.setOpenCPUInfo(pSettings->debugger().openCPUInfoWhenSignaled()); dialog.setMessage( @@ -553,38 +567,8 @@ void Debugger::syncFinishedParsing() if (result == QDialog::Accepted && dialog.openCPUInfo()) { pMainWindow->showCPUInfoDialog(); } - -//SignalDialog := CreateMessageDialog(fSignal, mtError, [mbOk]); -//SignalCheck := TCheckBox.Create(SignalDialog); - -//// Display it on top of everything -//SignalDialog.FormStyle := fsStayOnTop; - -//SignalDialog.Height := 150; - -//with SignalCheck do begin -// Parent := SignalDialog; -// Caption := 'Show CPU window'; -// Top := Parent.ClientHeight - 22; -// Left := 8; -// Width := Parent.ClientWidth - 16; -// Checked := devData.ShowCPUSignal; -//end; - -//MessageBeep(MB_ICONERROR); -//if SignalDialog.ShowModal = ID_OK then begin -// devData.ShowCPUSignal := SignalCheck.Checked; -// if SignalCheck.Checked and not Assigned(CPUForm) then begin -// MainForm.ViewCPUItemClick(nil); -// spawnedcpuform := true; -// end; -//end; - -//SignalDialog.Free; - } - // CPU form updates itself when spawned, don't update twice! if ((mReader->updateCPUInfo() && !spawnedcpuform) && (pMainWindow->cpuDialog()!=nullptr)) { pMainWindow->cpuDialog()->updateInfo(); diff --git a/RedPandaIDE/debugger.h b/RedPandaIDE/debugger.h index 0e700ec2..df43b4d6 100644 --- a/RedPandaIDE/debugger.h +++ b/RedPandaIDE/debugger.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "gdbmiresultparser.h" @@ -212,6 +213,7 @@ public: DebugCommandSource source = DebugCommandSource::Other); bool commandRunning(); bool inferiorRunning(); + void interrupt(); //breakpoints void addBreakpoint(int line, const Editor* editor); @@ -273,6 +275,7 @@ private slots: void updateRegisterValues(const QHash& values); void refreshWatchVars(); void fetchVarChildren(const QString& varName); + void interruptRefresh(); private: bool mExecuting; bool mCommandChanged; diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index db0c64ae..69da7cb3 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -998,7 +998,7 @@ bool Editor::event(QEvent *event) s = wordAtRowCol(p); break; case TipType::Identifier: - if (pMainWindow->debugger()->executing()) + if (pMainWindow->debugger()->executing() && !pMainWindow->debugger()->inferiorRunning()) s = getWordAtPosition(this,p, pBeginPos,pEndPos, WordPurpose::wpEvaluation); // debugging else if (//devEditor.ParserHints and !mCompletionPopup->isVisible() @@ -3042,10 +3042,10 @@ Editor::TipType Editor::getTipType(QPoint point, BufferCoord& pos) // do not allow when dragging selection if (isPointInSelection(pos)) return TipType::Selection; - } else if (attr == highlighter()->identifierAttribute()) - return TipType::Identifier; - else if (attr->name() == SYNS_AttrPreprocessor) + } else if (mParser && mParser->isIncludeLine(lines()->getString(pos.Line-1))) { return TipType::Preprocessor; + }else if (attr == highlighter()->identifierAttribute()) + return TipType::Identifier; } } } diff --git a/RedPandaIDE/icons.qrc b/RedPandaIDE/icons.qrc index 547cd9d3..44c24de5 100644 --- a/RedPandaIDE/icons.qrc +++ b/RedPandaIDE/icons.qrc @@ -209,5 +209,6 @@ images/newlook/actions/08Problem_03Properties.svg images/newlook/actions/08Problem_04EditSource.svg images/newlook/actions/08Problem_05RunCases.svg + images/newlook/actions/05Run-16Interrupt.svg diff --git a/RedPandaIDE/iconsmanager.cpp b/RedPandaIDE/iconsmanager.cpp index 7899d795..72319f01 100644 --- a/RedPandaIDE/iconsmanager.cpp +++ b/RedPandaIDE/iconsmanager.cpp @@ -135,7 +135,7 @@ void IconsManager::updateActionIcons(const QString iconSet, int size) mIconPixmaps.insert(ACTION_RUN_REMOVE_WATCH, createSVGIcon(iconFolder+"05Run-13RemoveWatch.svg",size,size)); mIconPixmaps.insert(ACTION_RUN_STEP_OVER_INSTRUCTION, createSVGIcon(iconFolder+"05Run-14StepOverInstruction.svg",size,size)); mIconPixmaps.insert(ACTION_RUN_STEP_INTO_INSTRUCTION, createSVGIcon(iconFolder+"05Run-15StepIntoInstruction.svg",size,size)); - + mIconPixmaps.insert(ACTION_RUN_INTERRUPT, createSVGIcon(iconFolder+"05Run-16Interrupt.svg",size,size)); mIconPixmaps.insert(ACTION_VIEW_MAXIMUM, createSVGIcon(iconFolder+"06View-01Maximum.svg",size,size)); mIconPixmaps.insert(ACTION_VIEW_CLASSBROWSER, createSVGIcon(iconFolder+"06View-02ClassBrowser.svg",size,size)); diff --git a/RedPandaIDE/iconsmanager.h b/RedPandaIDE/iconsmanager.h index c55705bf..e06e89b7 100644 --- a/RedPandaIDE/iconsmanager.h +++ b/RedPandaIDE/iconsmanager.h @@ -123,6 +123,7 @@ public: ACTION_RUN_REMOVE_WATCH, ACTION_RUN_STEP_OVER_INSTRUCTION, ACTION_RUN_STEP_INTO_INSTRUCTION, + ACTION_RUN_INTERRUPT, ACTION_VIEW_MAXIMUM, ACTION_VIEW_CLASSBROWSER, diff --git a/RedPandaIDE/images/newlook/actions/05Run-16Interrupt.svg b/RedPandaIDE/images/newlook/actions/05Run-16Interrupt.svg new file mode 100644 index 00000000..57ef8e79 --- /dev/null +++ b/RedPandaIDE/images/newlook/actions/05Run-16Interrupt.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 9fc50862..3c1a80b9 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1189,6 +1189,7 @@ void MainWindow::updateActionIcons() ui->actionRebuild->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_REBUILD)); ui->actionRun_Parameters->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_OPTIONS)); ui->actionDebug->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_DEBUG)); + ui->actionInterrupt->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_INTERRUPT)); ui->actionStep_Over->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_STEP_OVER)); ui->actionStep_Into->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_STEP_INTO)); ui->actionStep_Out->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_STEP_OUT)); @@ -1675,6 +1676,7 @@ void MainWindow::debug() mDebugger->sendAllBreakpointsToDebugger(); // Run the debugger + mDebugger->sendCommand("-gdb-set", "mi-async on"); mDebugger->sendCommand("-enable-pretty-printing",""); mDebugger->sendCommand("-data-list-register-names",""); mDebugger->sendCommand("-gdb-set", "width 0"); // don't wrap output, very annoying @@ -3285,6 +3287,7 @@ void MainWindow::onEditorTabContextMenu(QTabWidget* tabWidget, const QPoint &pos void MainWindow::disableDebugActions() { + ui->actionInterrupt->setEnabled(false); ui->actionStep_Into->setEnabled(false); ui->actionStep_Over->setEnabled(false); ui->actionStep_Out->setEnabled(false); @@ -3299,11 +3302,13 @@ void MainWindow::disableDebugActions() void MainWindow::enableDebugActions() { + ui->actionInterrupt->setEnabled(mDebugger->inferiorRunning()); ui->actionStep_Into->setEnabled(!mDebugger->inferiorRunning()); ui->actionStep_Over->setEnabled(!mDebugger->inferiorRunning()); ui->actionStep_Out->setEnabled(!mDebugger->inferiorRunning()); ui->actionRun_To_Cursor->setEnabled(!mDebugger->inferiorRunning()); - ui->actionContinue->setEnabled(!mDebugger->inferiorRunning()); + if (pSettings->debugger().useGDBServer()) + ui->actionContinue->setEnabled(!mDebugger->inferiorRunning()); ui->cbEvaluate->setEnabled(!mDebugger->inferiorRunning()); ui->cbMemoryAddress->setEnabled(!mDebugger->inferiorRunning()); if (mCPUDialog) { @@ -4805,6 +4810,12 @@ void MainWindow::on_tblStackTrace_doubleClicked(const QModelIndex &index) if (e) { e->setCaretPositionAndActivate(trace->line,1); } + mDebugger->sendCommand("-stack-select-frame", QString("%1").arg(trace->level)); + mDebugger->sendCommand("-stack-list-variables", "--all-values"); + mDebugger->sendCommand("-var-update", "--all-values *"); + if (this->mCPUDialog) { + this->mCPUDialog->updateInfo(); + } } } @@ -6026,3 +6037,12 @@ void MainWindow::on_btnCaseValidateOptions_clicked() ); } + +void MainWindow::on_actionInterrupt_triggered() +{ + if (mDebugger->executing()) { + //WatchView.Items.BeginUpdate(); + mDebugger->interrupt(); + } +} + diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index f4fc1f5b..aba47579 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -550,6 +550,8 @@ private slots: void on_btnCaseValidateOptions_clicked(); + void on_actionInterrupt_triggered(); + private: Ui::MainWindow *ui; EditorList *mEditorList; diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index c60ef15a..d65db685 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -540,7 +540,6 @@ - 50 false @@ -1398,7 +1397,7 @@ 0 0 1114 - 26 + 25 @@ -1438,6 +1437,7 @@ + @@ -1657,6 +1657,7 @@ false + @@ -2667,6 +2668,15 @@ Ctrl+Backspace + + + + :/icons/images/newlook24/093-pause.png:/icons/images/newlook24/093-pause.png + + + Interrupt + + diff --git a/RedPandaIDE/version.h b/RedPandaIDE/version.h index 5b487eb0..43e54985 100644 --- a/RedPandaIDE/version.h +++ b/RedPandaIDE/version.h @@ -19,6 +19,6 @@ #include -#define DEVCPP_VERSION "beta.0.12.3" +#define DEVCPP_VERSION "beta.0.12.4" #endif // VERSION_H diff --git a/RedPandaIDE/widgets/aboutdialog.ui b/RedPandaIDE/widgets/aboutdialog.ui index ed260e9a..60c90052 100644 --- a/RedPandaIDE/widgets/aboutdialog.ui +++ b/RedPandaIDE/widgets/aboutdialog.ui @@ -58,18 +58,11 @@ true - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.