- enhancement: Remove all breakpoints for a closed non-project file.

- enhancement: Check and remove all non-exist breakpoints before debug a project
This commit is contained in:
Roy Qu 2023-02-22 08:59:00 +08:00
parent 4c3ca8e7c4
commit c204b39e00
4 changed files with 18 additions and 1 deletions

View File

@ -4,6 +4,8 @@ Red Panda C++ Version 2.14
- fix: Enum value defines is not correctly parsed.
- enhancement: Use differenct source file for each language in project templates
- fix: Ctrl+click is too sensitive.
- enhancement: Remove all breakpoints for a closed non-project file.
- enhancement: Check and remove all non-exist breakpoints before debug a project
Red Panda C++ Version 2.13

View File

@ -380,6 +380,15 @@ void Debugger::deleteBreakpoints(bool forProject)
// }
}
void Debugger::deleteInvalidProjectBreakpoints(const QSet<QString> unitFiles)
{
for(int i=mBreakpointModel->breakpoints(true).count()-1;i>=0;i--) {
const PBreakpoint& bp=mBreakpointModel->breakpoint(i,true);
if (!unitFiles.contains(bp->filename))
mBreakpointModel->removeBreakpoint(i, true);
}
}
void Debugger::removeBreakpoint(int line, const Editor *editor)
{
removeBreakpoint(line,editor->filename(),editor->inProject());

View File

@ -324,6 +324,7 @@ public:
void deleteBreakpoints(const QString& filename, bool forProject);
void deleteBreakpoints(const Editor* editor);
void deleteBreakpoints(bool forProject);
void deleteInvalidProjectBreakpoints(const QSet<QString> unitFiles);
void removeBreakpoint(int line, const Editor* editor);
void removeBreakpoint(int line, const QString& filename, bool forProject);
void removeBreakpoint(int index, bool forProject);

View File

@ -2088,6 +2088,7 @@ void MainWindow::debug()
QString filePath;
QFileInfo debugFile;
QStringList binDirs;
QSet<QString> unitFiles;
switch(getCompileTarget()) {
case CompileTarget::Project:
compilerSet=pSettings->compilerSets().getSet(mProject->options().compilerSet);
@ -2175,6 +2176,10 @@ void MainWindow::debug()
// mDebugger->setUseUTF8(e->fileEncoding() == ENCODING_UTF8 || e->fileEncoding() == ENCODING_UTF8_BOM);
foreach(const PProjectUnit& unit, mProject->unitList()) {
unitFiles.insert(unit->fileName());
}
mDebugger->deleteInvalidProjectBreakpoints(unitFiles);
if (!mDebugger->start(mProject->options().compilerSet, filePath, binDirs))
return;
filePath.replace('\\','/');