- 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)
This commit is contained in:
royqh1979@gmail.com 2021-12-27 10:59:04 +08:00
parent 317db42876
commit 96ab0890ba
13 changed files with 142 additions and 50 deletions

View File

@ -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 Version 0.12.3 For Dev-C++ 7 Beta
- enhancement: basic linux compatibility - enhancement: basic linux compatibility
- enhancement: debug with gdb server - enhancement: debug with gdb server

View File

@ -243,6 +243,13 @@ bool Debugger::inferiorRunning()
return false; return false;
} }
void Debugger::interrupt()
{
sendCommand("-exec-interrupt", "");
QTimer::singleShot(1000,this, &Debugger::interruptRefresh);
}
void Debugger::addBreakpoint(int line, const Editor* editor) void Debugger::addBreakpoint(int line, const Editor* editor)
{ {
addBreakpoint(line,editor->filename()); addBreakpoint(line,editor->filename());
@ -401,6 +408,11 @@ void Debugger::fetchVarChildren(const QString &varName)
} }
} }
void Debugger::interruptRefresh()
{
sendCommand("noop","");
}
void Debugger::removeWatchVars(bool deleteparent) void Debugger::removeWatchVars(bool deleteparent)
{ {
if (deleteparent) { if (deleteparent) {
@ -542,7 +554,9 @@ void Debugger::syncFinishedParsing()
return; return;
} }
if (mReader->signalReceived()) { if (mReader->signalReceived()
&& mReader->signalName()!="SIGINT"
&& mReader->signalName()!="SIGTRAP") {
SignalMessageDialog dialog(pMainWindow); SignalMessageDialog dialog(pMainWindow);
dialog.setOpenCPUInfo(pSettings->debugger().openCPUInfoWhenSignaled()); dialog.setOpenCPUInfo(pSettings->debugger().openCPUInfoWhenSignaled());
dialog.setMessage( dialog.setMessage(
@ -553,38 +567,8 @@ void Debugger::syncFinishedParsing()
if (result == QDialog::Accepted && dialog.openCPUInfo()) { if (result == QDialog::Accepted && dialog.openCPUInfo()) {
pMainWindow->showCPUInfoDialog(); 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! // CPU form updates itself when spawned, don't update twice!
if ((mReader->updateCPUInfo() && !spawnedcpuform) && (pMainWindow->cpuDialog()!=nullptr)) { if ((mReader->updateCPUInfo() && !spawnedcpuform) && (pMainWindow->cpuDialog()!=nullptr)) {
pMainWindow->cpuDialog()->updateInfo(); pMainWindow->cpuDialog()->updateInfo();

View File

@ -28,6 +28,7 @@
#include <QQueue> #include <QQueue>
#include <QSemaphore> #include <QSemaphore>
#include <QThread> #include <QThread>
#include <QTimer>
#include <memory> #include <memory>
#include "gdbmiresultparser.h" #include "gdbmiresultparser.h"
@ -212,6 +213,7 @@ public:
DebugCommandSource source = DebugCommandSource::Other); DebugCommandSource source = DebugCommandSource::Other);
bool commandRunning(); bool commandRunning();
bool inferiorRunning(); bool inferiorRunning();
void interrupt();
//breakpoints //breakpoints
void addBreakpoint(int line, const Editor* editor); void addBreakpoint(int line, const Editor* editor);
@ -273,6 +275,7 @@ private slots:
void updateRegisterValues(const QHash<int,QString>& values); void updateRegisterValues(const QHash<int,QString>& values);
void refreshWatchVars(); void refreshWatchVars();
void fetchVarChildren(const QString& varName); void fetchVarChildren(const QString& varName);
void interruptRefresh();
private: private:
bool mExecuting; bool mExecuting;
bool mCommandChanged; bool mCommandChanged;

View File

@ -998,7 +998,7 @@ bool Editor::event(QEvent *event)
s = wordAtRowCol(p); s = wordAtRowCol(p);
break; break;
case TipType::Identifier: case TipType::Identifier:
if (pMainWindow->debugger()->executing()) if (pMainWindow->debugger()->executing() && !pMainWindow->debugger()->inferiorRunning())
s = getWordAtPosition(this,p, pBeginPos,pEndPos, WordPurpose::wpEvaluation); // debugging s = getWordAtPosition(this,p, pBeginPos,pEndPos, WordPurpose::wpEvaluation); // debugging
else if (//devEditor.ParserHints and else if (//devEditor.ParserHints and
!mCompletionPopup->isVisible() !mCompletionPopup->isVisible()
@ -3042,10 +3042,10 @@ Editor::TipType Editor::getTipType(QPoint point, BufferCoord& pos)
// do not allow when dragging selection // do not allow when dragging selection
if (isPointInSelection(pos)) if (isPointInSelection(pos))
return TipType::Selection; return TipType::Selection;
} else if (attr == highlighter()->identifierAttribute()) } else if (mParser && mParser->isIncludeLine(lines()->getString(pos.Line-1))) {
return TipType::Identifier;
else if (attr->name() == SYNS_AttrPreprocessor)
return TipType::Preprocessor; return TipType::Preprocessor;
}else if (attr == highlighter()->identifierAttribute())
return TipType::Identifier;
} }
} }
} }

View File

@ -209,5 +209,6 @@
<file>images/newlook/actions/08Problem_03Properties.svg</file> <file>images/newlook/actions/08Problem_03Properties.svg</file>
<file>images/newlook/actions/08Problem_04EditSource.svg</file> <file>images/newlook/actions/08Problem_04EditSource.svg</file>
<file>images/newlook/actions/08Problem_05RunCases.svg</file> <file>images/newlook/actions/08Problem_05RunCases.svg</file>
<file>images/newlook/actions/05Run-16Interrupt.svg</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -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_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_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_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_MAXIMUM, createSVGIcon(iconFolder+"06View-01Maximum.svg",size,size));
mIconPixmaps.insert(ACTION_VIEW_CLASSBROWSER, createSVGIcon(iconFolder+"06View-02ClassBrowser.svg",size,size)); mIconPixmaps.insert(ACTION_VIEW_CLASSBROWSER, createSVGIcon(iconFolder+"06View-02ClassBrowser.svg",size,size));

View File

@ -123,6 +123,7 @@ public:
ACTION_RUN_REMOVE_WATCH, ACTION_RUN_REMOVE_WATCH,
ACTION_RUN_STEP_OVER_INSTRUCTION, ACTION_RUN_STEP_OVER_INSTRUCTION,
ACTION_RUN_STEP_INTO_INSTRUCTION, ACTION_RUN_STEP_INTO_INSTRUCTION,
ACTION_RUN_INTERRUPT,
ACTION_VIEW_MAXIMUM, ACTION_VIEW_MAXIMUM,
ACTION_VIEW_CLASSBROWSER, ACTION_VIEW_CLASSBROWSER,

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="100"
height="100"
viewBox="0 0 26.458333 26.458333"
version="1.1"
id="svg5"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
sodipodi:docname="05Run-16Pause.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="px"
showgrid="false"
inkscape:zoom="1.2891301"
inkscape:cx="230.38793"
inkscape:cy="193.54137"
inkscape:window-width="1920"
inkscape:window-height="1001"
inkscape:window-x="-9"
inkscape:window-y="-9"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
units="px"
width="100px"
inkscape:snap-intersection-paths="true"
inkscape:snap-midpoints="true" />
<defs
id="defs2">
<linearGradient
id="linearGradient3056"
inkscape:swatch="gradient">
<stop
style="stop-color:#45c200;stop-opacity:1"
offset="0"
id="stop3052" />
<stop
style="stop-color:#45c200;stop-opacity:0"
offset="1"
id="stop3054" />
</linearGradient>
</defs>
<g
inkscape:label="图层 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#09e3e3;stroke-width:0.79375;stroke-linecap:round;stroke:#000000;stroke-opacity:1;fill-opacity:1"
id="rect1259"
width="7.5939455"
height="20.216314"
x="3.1812472"
y="3.0946889" />
<rect
style="fill:#09e3e3;stroke-width:0.79375;stroke-linecap:round;stroke:#000000;stroke-opacity:1;fill-opacity:1"
id="rect1259-9"
width="7.5939455"
height="20.216314"
x="16.008858"
y="3.0946889" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1189,6 +1189,7 @@ void MainWindow::updateActionIcons()
ui->actionRebuild->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_REBUILD)); ui->actionRebuild->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_REBUILD));
ui->actionRun_Parameters->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_OPTIONS)); ui->actionRun_Parameters->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_OPTIONS));
ui->actionDebug->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_DEBUG)); 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_Over->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_STEP_OVER));
ui->actionStep_Into->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_STEP_INTO)); ui->actionStep_Into->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_STEP_INTO));
ui->actionStep_Out->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_STEP_OUT)); ui->actionStep_Out->setIcon(pIconsManager->getIcon(IconsManager::ACTION_RUN_STEP_OUT));
@ -1675,6 +1676,7 @@ void MainWindow::debug()
mDebugger->sendAllBreakpointsToDebugger(); mDebugger->sendAllBreakpointsToDebugger();
// Run the debugger // Run the debugger
mDebugger->sendCommand("-gdb-set", "mi-async on");
mDebugger->sendCommand("-enable-pretty-printing",""); mDebugger->sendCommand("-enable-pretty-printing","");
mDebugger->sendCommand("-data-list-register-names",""); mDebugger->sendCommand("-data-list-register-names","");
mDebugger->sendCommand("-gdb-set", "width 0"); // don't wrap output, very annoying 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() void MainWindow::disableDebugActions()
{ {
ui->actionInterrupt->setEnabled(false);
ui->actionStep_Into->setEnabled(false); ui->actionStep_Into->setEnabled(false);
ui->actionStep_Over->setEnabled(false); ui->actionStep_Over->setEnabled(false);
ui->actionStep_Out->setEnabled(false); ui->actionStep_Out->setEnabled(false);
@ -3299,11 +3302,13 @@ void MainWindow::disableDebugActions()
void MainWindow::enableDebugActions() void MainWindow::enableDebugActions()
{ {
ui->actionInterrupt->setEnabled(mDebugger->inferiorRunning());
ui->actionStep_Into->setEnabled(!mDebugger->inferiorRunning()); ui->actionStep_Into->setEnabled(!mDebugger->inferiorRunning());
ui->actionStep_Over->setEnabled(!mDebugger->inferiorRunning()); ui->actionStep_Over->setEnabled(!mDebugger->inferiorRunning());
ui->actionStep_Out->setEnabled(!mDebugger->inferiorRunning()); ui->actionStep_Out->setEnabled(!mDebugger->inferiorRunning());
ui->actionRun_To_Cursor->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->cbEvaluate->setEnabled(!mDebugger->inferiorRunning());
ui->cbMemoryAddress->setEnabled(!mDebugger->inferiorRunning()); ui->cbMemoryAddress->setEnabled(!mDebugger->inferiorRunning());
if (mCPUDialog) { if (mCPUDialog) {
@ -4805,6 +4810,12 @@ void MainWindow::on_tblStackTrace_doubleClicked(const QModelIndex &index)
if (e) { if (e) {
e->setCaretPositionAndActivate(trace->line,1); 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();
}
}

View File

@ -550,6 +550,8 @@ private slots:
void on_btnCaseValidateOptions_clicked(); void on_btnCaseValidateOptions_clicked();
void on_actionInterrupt_triggered();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
EditorList *mEditorList; EditorList *mEditorList;

View File

@ -540,7 +540,6 @@
<widget class="IssuesTable" name="tableIssues"> <widget class="IssuesTable" name="tableIssues">
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
@ -1398,7 +1397,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1114</width> <width>1114</width>
<height>26</height> <height>25</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">
@ -1438,6 +1437,7 @@
<addaction name="actionRun_Parameters"/> <addaction name="actionRun_Parameters"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionDebug"/> <addaction name="actionDebug"/>
<addaction name="actionInterrupt"/>
<addaction name="actionStep_Over"/> <addaction name="actionStep_Over"/>
<addaction name="actionStep_Into"/> <addaction name="actionStep_Into"/>
<addaction name="actionStep_Out"/> <addaction name="actionStep_Out"/>
@ -1657,6 +1657,7 @@
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
<addaction name="actionDebug"/> <addaction name="actionDebug"/>
<addaction name="actionInterrupt"/>
<addaction name="actionStep_Over"/> <addaction name="actionStep_Over"/>
<addaction name="actionStep_Into"/> <addaction name="actionStep_Into"/>
<addaction name="actionStep_Out"/> <addaction name="actionStep_Out"/>
@ -2667,6 +2668,15 @@
<string>Ctrl+Backspace</string> <string>Ctrl+Backspace</string>
</property> </property>
</action> </action>
<action name="actionInterrupt">
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/icons/images/newlook24/093-pause.png</normaloff>:/icons/images/newlook24/093-pause.png</iconset>
</property>
<property name="text">
<string>Interrupt</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

View File

@ -19,6 +19,6 @@
#include <QObject> #include <QObject>
#define DEVCPP_VERSION "beta.0.12.3" #define DEVCPP_VERSION "beta.0.12.4"
#endif // VERSION_H #endif // VERSION_H

View File

@ -58,18 +58,11 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="plainText"> <property name="plainText">
<string> This program is free software: you can redistribute it and/or modify <string> 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.
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, 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.
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 You should have received a copy of the GNU General Public License along with this program. If not, see &lt;https://www.gnu.org/licenses/&gt;.</string>
along with this program. If not, see &lt;https://www.gnu.org/licenses/&gt;.</string>
</property> </property>
</widget> </widget>
</item> </item>