- fix: Can't debug when debug a file while other file has breakpoints
- change: Don't save breakpoints for non-project files
This commit is contained in:
parent
60db5a894b
commit
fcca49e9e5
4
NEWS.md
4
NEWS.md
|
@ -3,7 +3,9 @@ Red Panda C++ Version 2.13
|
||||||
- fix: Only C/C++/GAS files can set breakpoints.
|
- fix: Only C/C++/GAS files can set breakpoints.
|
||||||
- Enhancement: Don't show breakpoints/watch related menuitems in context menu for non-C/C++/GAS files.
|
- Enhancement: Don't show breakpoints/watch related menuitems in context menu for non-C/C++/GAS files.
|
||||||
- Enhancement: Disable reformat code for non-C/C++ files.
|
- Enhancement: Disable reformat code for non-C/C++ files.
|
||||||
- Enhancement: Support C11 ano
|
- Enhancement: Support C11 anonymous struct/union
|
||||||
|
- fix: Can't debug when debug a file while other file has breakpoints
|
||||||
|
- change: Don't save breakpoints for non-project files
|
||||||
|
|
||||||
Red Panda C++ Version 2.12
|
Red Panda C++ Version 2.12
|
||||||
|
|
||||||
|
|
|
@ -71,9 +71,9 @@ Debugger::~Debugger()
|
||||||
// delete mMemoryModel;
|
// delete mMemoryModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Debugger::start(int compilerSetIndex, const QString& inferior, const QStringList& binDirs)
|
bool Debugger::start(int compilerSetIndex, const QString& inferior, const QStringList& binDirs, const QString& sourceFile)
|
||||||
{
|
{
|
||||||
|
mCurrentSourceFile = sourceFile;
|
||||||
Settings::PCompilerSet compilerSet = pSettings->compilerSets().getSet(compilerSetIndex);
|
Settings::PCompilerSet compilerSet = pSettings->compilerSets().getSet(compilerSetIndex);
|
||||||
if (!compilerSet) {
|
if (!compilerSet) {
|
||||||
compilerSet = pSettings->compilerSets().defaultSet();
|
compilerSet = pSettings->compilerSets().defaultSet();
|
||||||
|
@ -218,6 +218,7 @@ void Debugger::stop() {
|
||||||
}
|
}
|
||||||
mReader->stopDebug();
|
mReader->stopDebug();
|
||||||
}
|
}
|
||||||
|
mCurrentSourceFile="";
|
||||||
}
|
}
|
||||||
void Debugger::cleanUpReader()
|
void Debugger::cleanUpReader()
|
||||||
{
|
{
|
||||||
|
@ -347,7 +348,11 @@ void Debugger::addBreakpoint(int line, const QString &filename, bool forProject)
|
||||||
bp->timestamp = QDateTime::currentMSecsSinceEpoch();
|
bp->timestamp = QDateTime::currentMSecsSinceEpoch();
|
||||||
mBreakpointModel->addBreakpoint(bp,forProject);
|
mBreakpointModel->addBreakpoint(bp,forProject);
|
||||||
if (mExecuting) {
|
if (mExecuting) {
|
||||||
sendBreakpointCommand(bp);
|
if (forProject && mBreakpointModel->isForProject()) {
|
||||||
|
sendBreakpointCommand(bp);
|
||||||
|
} else if (filename == mCurrentSourceFile) {
|
||||||
|
sendBreakpointCommand(bp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,7 +435,11 @@ void Debugger::setBreakPointCondition(int index, const QString &condition, bool
|
||||||
void Debugger::sendAllBreakpointsToDebugger()
|
void Debugger::sendAllBreakpointsToDebugger()
|
||||||
{
|
{
|
||||||
for (PBreakpoint breakpoint:mBreakpointModel->breakpoints(mBreakpointModel->isForProject())) {
|
for (PBreakpoint breakpoint:mBreakpointModel->breakpoints(mBreakpointModel->isForProject())) {
|
||||||
sendBreakpointCommand(breakpoint);
|
if (mBreakpointModel->isForProject()) {
|
||||||
|
sendBreakpointCommand(breakpoint);
|
||||||
|
} else if (breakpoint->filename == mCurrentSourceFile) {
|
||||||
|
sendBreakpointCommand(breakpoint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -747,7 +756,9 @@ void Debugger::save(const QString &filename, const QString& projectFolder)
|
||||||
QJsonObject rootObj;
|
QJsonObject rootObj;
|
||||||
rootObj["timestamp"] = QString("%1").arg(saveTimestamp);
|
rootObj["timestamp"] = QString("%1").arg(saveTimestamp);
|
||||||
|
|
||||||
rootObj["breakpoints"] = mBreakpointModel->toJson(projectFolder);
|
if (forProject) {
|
||||||
|
rootObj["breakpoints"] = mBreakpointModel->toJson(projectFolder);
|
||||||
|
}
|
||||||
rootObj["watchvars"] = mWatchModel->toJson(forProject);
|
rootObj["watchvars"] = mWatchModel->toJson(forProject);
|
||||||
QJsonDocument doc;
|
QJsonDocument doc;
|
||||||
doc.setObject(rootObj);
|
doc.setObject(rootObj);
|
||||||
|
|
|
@ -307,7 +307,7 @@ public:
|
||||||
explicit Debugger(QObject *parent = nullptr);
|
explicit Debugger(QObject *parent = nullptr);
|
||||||
~Debugger();
|
~Debugger();
|
||||||
// Play/pause
|
// Play/pause
|
||||||
bool start(int compilerSetIndex, const QString& inferior, const QStringList& binDirs);
|
bool start(int compilerSetIndex, const QString& inferior, const QStringList& binDirs, const QString& sourceFile=QString());
|
||||||
void sendCommand(const QString& command, const QString& params,
|
void sendCommand(const QString& command, const QString& params,
|
||||||
DebugCommandSource source = DebugCommandSource::Other);
|
DebugCommandSource source = DebugCommandSource::Other);
|
||||||
bool commandRunning();
|
bool commandRunning();
|
||||||
|
@ -415,6 +415,7 @@ private:
|
||||||
int mLeftPageIndexBackup;
|
int mLeftPageIndexBackup;
|
||||||
qint64 mLastLoadtime;
|
qint64 mLastLoadtime;
|
||||||
qint64 mProjectLastLoadtime;
|
qint64 mProjectLastLoadtime;
|
||||||
|
QString mCurrentSourceFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DebugTarget: public QThread {
|
class DebugTarget: public QThread {
|
||||||
|
|
|
@ -1034,7 +1034,7 @@ void Editor::onGutterPaint(QPainter &painter, int aLine, int X, int Y)
|
||||||
} else {
|
} else {
|
||||||
icon = pIconsManager->getPixmap(IconsManager::GUTTER_SYNTAX_WARNING);
|
icon = pIconsManager->getPixmap(IconsManager::GUTTER_SYNTAX_WARNING);
|
||||||
}
|
}
|
||||||
} else if (hasBookmark(aLine)) {
|
} else if (hasBookmark(aLine)) {
|
||||||
icon = pIconsManager->getPixmap(IconsManager::GUTTER_BOOKMARK);
|
icon = pIconsManager->getPixmap(IconsManager::GUTTER_BOOKMARK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4810,7 +4810,7 @@ void Editor::reformat(bool doReparse)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
//we must remove all breakpoints and syntax issues
|
//we must remove all breakpoints and syntax issues
|
||||||
onLinesDeleted(1,document()->count());
|
// onLinesDeleted(1,document()->count());
|
||||||
QByteArray content = text().toUtf8();
|
QByteArray content = text().toUtf8();
|
||||||
QStringList args = pSettings->codeFormatter().getArguments();
|
QStringList args = pSettings->codeFormatter().getArguments();
|
||||||
//qDebug()<<args;
|
//qDebug()<<args;
|
||||||
|
|
|
@ -2273,7 +2273,7 @@ void MainWindow::debug()
|
||||||
|
|
||||||
prepareDebugger();
|
prepareDebugger();
|
||||||
QString filePath = debugFile.filePath().replace('\\','/');
|
QString filePath = debugFile.filePath().replace('\\','/');
|
||||||
if (!mDebugger->start(pSettings->compilerSets().defaultIndex(),filePath, binDirs))
|
if (!mDebugger->start(pSettings->compilerSets().defaultIndex(),filePath, binDirs,e->filename()))
|
||||||
return;
|
return;
|
||||||
mDebugger->sendCommand("-file-exec-and-symbols", QString("\"%1\"").arg(filePath));
|
mDebugger->sendCommand("-file-exec-and-symbols", QString("\"%1\"").arg(filePath));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue