work save
This commit is contained in:
parent
8c7cb8dd65
commit
b39f0e64a8
|
@ -181,6 +181,58 @@ void Debugger::sendAllBreakpointsToDebugger()
|
|||
}
|
||||
}
|
||||
|
||||
void Debugger::addWatchVar(int i)
|
||||
{
|
||||
//todo
|
||||
}
|
||||
|
||||
void Debugger::removeWatchVar(int i)
|
||||
{
|
||||
//todo
|
||||
}
|
||||
|
||||
void Debugger::addWatchVar(const QString &namein)
|
||||
{
|
||||
//todo
|
||||
}
|
||||
|
||||
void Debugger::renameWatchVar(const QString &oldname, const QString &newname)
|
||||
{
|
||||
//todo
|
||||
}
|
||||
|
||||
void Debugger::refreshWatchVars()
|
||||
{
|
||||
//todo
|
||||
}
|
||||
|
||||
void Debugger::deleteWatchVars(bool deleteparent)
|
||||
{
|
||||
//todo
|
||||
}
|
||||
|
||||
void Debugger::invalidateAllVars()
|
||||
{
|
||||
//todo
|
||||
}
|
||||
|
||||
void Debugger::sendAllWatchvarsToDebugger()
|
||||
{
|
||||
//todo
|
||||
}
|
||||
|
||||
void Debugger::invalidateWatchVar(PWatchVar var)
|
||||
{
|
||||
//toto
|
||||
}
|
||||
|
||||
void Debugger::updateDebugInfo()
|
||||
{
|
||||
sendCommand("backtrace", "");
|
||||
sendCommand("info locals", "");
|
||||
sendCommand("info args", "");
|
||||
}
|
||||
|
||||
bool Debugger::useUTF8() const
|
||||
{
|
||||
return mUseUTF8;
|
||||
|
@ -302,7 +354,7 @@ void Debugger::syncFinishedParsing()
|
|||
}
|
||||
|
||||
// Some part of the CPU form has been updated
|
||||
if (pMainWindow->CPUDialog()->isVisible() && !mReader->doreceivedsignal) {
|
||||
if (pMainWindow->cpuDialog()->isVisible() && !mReader->doreceivedsignal) {
|
||||
// if (mReader->doregistersready)
|
||||
// CPUForm.OnRegistersReady;
|
||||
|
||||
|
@ -315,7 +367,7 @@ void Debugger::syncFinishedParsing()
|
|||
|
||||
|
||||
if (mReader->doupdateexecution) {
|
||||
if (mReader->mCurrentCmd && mReader->mCurrentCmd == DebugCommandSource::Console) {
|
||||
if (mReader->mCurrentCmd && mReader->mCurrentCmd->source == DebugCommandSource::Console) {
|
||||
pMainWindow->setActiveBreakpoint(mReader->mBreakPointFile, mReader->mBreakPointLine,false);
|
||||
} else {
|
||||
pMainWindow->setActiveBreakpoint(mReader->mBreakPointFile, mReader->mBreakPointLine);
|
||||
|
@ -356,12 +408,22 @@ void Debugger::syncFinishedParsing()
|
|||
|
||||
|
||||
// CPU form updates itself when spawned, don't update twice!
|
||||
if ((mReader->doupdatecpuwindow && !spawnedcpuform) && (pMainWindow->CPUDialog()->isVisible())) {
|
||||
if ((mReader->doupdatecpuwindow && !spawnedcpuform) && (pMainWindow->cpuDialog()->isVisible())) {
|
||||
sendCommand("disas", "");
|
||||
sendCommand("info registers", "");
|
||||
}
|
||||
}
|
||||
|
||||
int Debugger::leftPageIndexBackup() const
|
||||
{
|
||||
return mLeftPageIndexBackup;
|
||||
}
|
||||
|
||||
void Debugger::setLeftPageIndexBackup(int leftPageIndexBackup)
|
||||
{
|
||||
mLeftPageIndexBackup = leftPageIndexBackup;
|
||||
}
|
||||
|
||||
bool Debugger::executing() const
|
||||
{
|
||||
return mExecuting;
|
||||
|
@ -665,7 +727,7 @@ void DebugReader::handleError()
|
|||
if (result != mWatchVarList.end()) {
|
||||
PWatchVar watchVar = result.value();
|
||||
//todo: update watch value to invalid
|
||||
invalidateWatchVar(watchVar);
|
||||
mDebugger->invalidateWatchVar(watchVar);
|
||||
watchVar->gdbIndex = -1;
|
||||
dorescanwatches = true;
|
||||
}
|
||||
|
@ -1112,6 +1174,7 @@ void DebugReader::stopDebug()
|
|||
mStop = true;
|
||||
}
|
||||
|
||||
|
||||
void DebugReader::run()
|
||||
{
|
||||
mStop = false;
|
||||
|
|
|
@ -131,6 +131,7 @@ public:
|
|||
bool showInConsole = false,
|
||||
DebugCommandSource source = DebugCommandSource::Other);
|
||||
|
||||
//breakpoints
|
||||
void addBreakpoint(int line, const Editor* editor);
|
||||
void addBreakpoint(int line, const QString& filename);
|
||||
void deleteBreakpoints(const QString& filename);
|
||||
|
@ -140,6 +141,21 @@ public:
|
|||
void removeBreakpoint(int index);
|
||||
void setBreakPointCondition(int index, const QString& condition);
|
||||
void sendAllBreakpointsToDebugger();
|
||||
//watch vars
|
||||
void addWatchVar(int i);
|
||||
void removeWatchVar(int i);
|
||||
void addWatchVar(const QString& namein);
|
||||
// void removeWatchVar(nodein: TTreeNode); overload;
|
||||
void renameWatchVar(const QString& oldname, const QString& newname);
|
||||
|
||||
void refreshWatchVars();
|
||||
void deleteWatchVars(bool deleteparent);
|
||||
void invalidateAllVars();
|
||||
void sendAllWatchvarsToDebugger();
|
||||
void invalidateWatchVar(PWatchVar var);
|
||||
|
||||
|
||||
void updateDebugInfo();
|
||||
|
||||
bool useUTF8() const;
|
||||
void setUseUTF8(bool useUTF8);
|
||||
|
@ -148,6 +164,9 @@ public:
|
|||
BreakpointModel* breakpointModel();
|
||||
bool executing() const;
|
||||
|
||||
int leftPageIndexBackup() const;
|
||||
void setLeftPageIndexBackup(int leftPageIndexBackup);
|
||||
|
||||
public slots:
|
||||
void stop();
|
||||
signals:
|
||||
|
@ -167,6 +186,7 @@ private:
|
|||
bool mUseUTF8;
|
||||
BacktraceModel* mBacktraceModel;
|
||||
DebugReader* mReader;
|
||||
int mLeftPageIndexBackup;
|
||||
};
|
||||
|
||||
class DebugReader : public QThread
|
||||
|
|
|
@ -1222,6 +1222,25 @@ void Editor::removeBreakpointFocus()
|
|||
}
|
||||
}
|
||||
|
||||
void Editor::setActiveBreakpointFocus(int Line, bool setFocus)
|
||||
{
|
||||
if (Line != mActiveBreakpointLine) {
|
||||
removeBreakpointFocus();
|
||||
|
||||
// Put the caret at the active breakpoint
|
||||
mActiveBreakpointLine = Line;
|
||||
|
||||
if (setFocus)
|
||||
setCaretPositionAndActivate(Line,1);
|
||||
else
|
||||
setCaretPosition(Line,1);
|
||||
|
||||
// Invalidate new active line
|
||||
invalidateGutterLine(Line);
|
||||
invalidateLine(Line);
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::applySettings()
|
||||
{
|
||||
SynEditorOptions options = eoAltSetsColumnMode |
|
||||
|
|
|
@ -112,6 +112,7 @@ public:
|
|||
void toggleBreakpoint(int line);
|
||||
bool hasBreakpoint(int line);
|
||||
void removeBreakpointFocus();
|
||||
void setActiveBreakpointFocus(int Line, bool setFocus=true);
|
||||
|
||||
signals:
|
||||
|
||||
|
|
|
@ -219,6 +219,22 @@ void MainWindow::removeActiveBreakpoints()
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::setActiveBreakpoint(QString FileName, int Line, bool setFocus)
|
||||
{
|
||||
removeActiveBreakpoints();
|
||||
|
||||
|
||||
// Then active the current line in the current file
|
||||
FileName.replace('/',QDir::separator());
|
||||
Editor *e = mEditorList->getEditorByFilename(FileName);
|
||||
if (e!=nullptr) {
|
||||
e->setActiveBreakpointFocus(Line,setFocus);
|
||||
}
|
||||
if (setFocus) {
|
||||
this->activateWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateAppTitle()
|
||||
{
|
||||
QString appName("Red Panda Dev-C++");
|
||||
|
@ -665,12 +681,10 @@ void MainWindow::debug()
|
|||
}
|
||||
|
||||
// Add breakpoints and watch vars
|
||||
for i := 0 to fDebugger.WatchVarList.Count - 1 do
|
||||
fDebugger.AddWatchVar(i);
|
||||
|
||||
// for i := 0 to fDebugger.WatchVarList.Count - 1 do
|
||||
// fDebugger.AddWatchVar(i);
|
||||
mDebugger->sendAllWatchvarsToDebugger();
|
||||
mDebugger->sendAllBreakpointsToDebugger();
|
||||
for i := 0 to fDebugger.BreakPointList.Count - 1 do
|
||||
fDebugger.AddBreakpoint(i);
|
||||
|
||||
// Run the debugger
|
||||
mDebugger->sendCommand("set", "width 0"); // don't wrap output, very annoying
|
||||
|
@ -687,7 +701,7 @@ void MainWindow::debug()
|
|||
|
||||
// }
|
||||
mDebugger->sendCommand("start",params);
|
||||
updateDebugInfo();
|
||||
mDebugger->updateDebugInfo();
|
||||
break;
|
||||
case CompileTarget::Project:
|
||||
//params := '';
|
||||
|
@ -710,7 +724,7 @@ void MainWindow::debug()
|
|||
|
||||
// }
|
||||
mDebugger->sendCommand("run",params);
|
||||
updateDebugInfo();
|
||||
mDebugger->updateDebugInfo();
|
||||
break;
|
||||
case CompileTarget::Project:
|
||||
//params := '';
|
||||
|
@ -771,7 +785,7 @@ void MainWindow::prepareDebugger()
|
|||
ui->txtEvalOutput->clear();
|
||||
|
||||
// Restore when no watch vars are shown
|
||||
mDebugger->leftPageIndexBackup = ui->tabInfos->currentIndex();
|
||||
mDebugger->setLeftPageIndexBackup(ui->tabInfos->currentIndex());
|
||||
|
||||
// Focus on the debugging buttons
|
||||
ui->tabInfos->setCurrentWidget(ui->tabWatch);
|
||||
|
@ -781,10 +795,10 @@ void MainWindow::prepareDebugger()
|
|||
|
||||
|
||||
// Reset watch vars
|
||||
mDebugger->deleteWatchVars(false);
|
||||
// mDebugger->deleteWatchVars(false);
|
||||
}
|
||||
|
||||
CPUDialog *MainWindow::CPUDialog() const
|
||||
CPUDialog *MainWindow::cpuDialog() const
|
||||
{
|
||||
return mCPUDialog;
|
||||
}
|
||||
|
|
|
@ -60,10 +60,11 @@ public:
|
|||
void applySettings();
|
||||
|
||||
void removeActiveBreakpoints();
|
||||
void setActiveBreakpoint(QString FileName, int Line, bool setFocus=true);
|
||||
void updateAppTitle();
|
||||
void addDebugOutput(const QString& text);
|
||||
|
||||
CPUDialog *CPUDialog() const;
|
||||
CPUDialog *cpuDialog() const;
|
||||
|
||||
protected:
|
||||
void openFiles(const QStringList& files);
|
||||
|
|
|
@ -21,7 +21,8 @@ Settings::Settings(const QString &filename):
|
|||
mEditor(this),
|
||||
mEnvironment(this),
|
||||
mCompilerSets(this),
|
||||
mExecutor(this)
|
||||
mExecutor(this),
|
||||
mDebugger(this)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -97,7 +98,7 @@ QString Settings::filename() const
|
|||
return mFilename;
|
||||
}
|
||||
|
||||
Debugger Settings::debugger() const
|
||||
Settings::Debugger& Settings::debugger()
|
||||
{
|
||||
return mDebugger;
|
||||
}
|
||||
|
|
|
@ -584,9 +584,9 @@ public:
|
|||
CompilerSets& compilerSets();
|
||||
Environment& environment();
|
||||
Executor& executor();
|
||||
Debugger& debugger();
|
||||
QString filename() const;
|
||||
|
||||
Debugger& debugger() const;
|
||||
|
||||
private:
|
||||
QString mFilename;
|
||||
|
|
Loading…
Reference in New Issue