work save
This commit is contained in:
parent
8ed76c06e3
commit
7de6e6fd8b
|
@ -8,7 +8,7 @@
|
|||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QMessageBox>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QDebug>
|
||||
|
||||
Debugger::Debugger(QObject *parent) : QObject(parent)
|
||||
|
@ -46,23 +46,12 @@ void Debugger::start()
|
|||
connect(mReader, &QThread::finished,this,&Debugger::clearUpReader);
|
||||
connect(mReader, &DebugReader::parseFinished,this,&Debugger::syncFinishedParsing,Qt::BlockingQueuedConnection);
|
||||
connect(mReader, &DebugReader::changeDebugConsoleLastLine,this,&Debugger::onChangeDebugConsoleLastline,Qt::BlockingQueuedConnection);
|
||||
connect(mReader, &DebugReader::addLocalWithLinebreak,this,&Debugger::onAddLocalWithLinebreak);
|
||||
connect(mReader, &DebugReader::addLocalWithoutLinebreak,this,&Debugger::onAddLocalWithoutLinebreak);
|
||||
connect(mReader, &DebugReader::clearLocals,this,&Debugger::onClearLocals);
|
||||
mReader->start();
|
||||
mReader->mStartSemaphore.acquire(1);
|
||||
|
||||
//fProcessID := pi.hProcess;
|
||||
|
||||
//// Create a thread that will read GDB output.
|
||||
//Reader := TDebugReader.Create(true);
|
||||
//Reader.PipeRead := fOutputRead;
|
||||
//Reader.PipeWrite := fInputWrite;
|
||||
//Reader.FreeOnTerminate := true;
|
||||
//Reader.BreakpointList := BreakPointList;
|
||||
//Reader.WatchVarList := WatchVarList;
|
||||
//Reader.WatchView := WatchView;
|
||||
//Reader.UseUTF8 := UseUTF8;
|
||||
//Reader.Resume;
|
||||
//Reader.OnInvalidateAllVars := OnInvalidateAllVars;
|
||||
|
||||
pMainWindow->updateAppTitle();
|
||||
|
||||
//Application.HintHidePause := 5000;
|
||||
|
@ -91,6 +80,8 @@ void Debugger::clearUpReader()
|
|||
// Free resources
|
||||
pMainWindow->removeActiveBreakpoints();
|
||||
|
||||
pMainWindow->txtLocals()->clear();
|
||||
|
||||
pMainWindow->updateAppTitle();
|
||||
|
||||
mBacktraceModel->clear();
|
||||
|
@ -101,6 +92,21 @@ void Debugger::clearUpReader()
|
|||
}
|
||||
}
|
||||
|
||||
void Debugger::onAddLocalWithoutLinebreak(const QString &text)
|
||||
{
|
||||
pMainWindow->txtLocals()->insertPlainText(text);
|
||||
}
|
||||
|
||||
void Debugger::onAddLocalWithLinebreak(const QString &text)
|
||||
{
|
||||
pMainWindow->txtLocals()->appendPlainText(text);
|
||||
}
|
||||
|
||||
void Debugger::onClearLocals()
|
||||
{
|
||||
pMainWindow->txtLocals()->clear();
|
||||
}
|
||||
|
||||
WatchModel *Debugger::watchModel() const
|
||||
{
|
||||
return mWatchModel;
|
||||
|
@ -888,9 +894,9 @@ void DebugReader::handleLocalOutput()
|
|||
// name(spaces)hexvalue(tab)decimalvalue
|
||||
QString s = getNextFilledLine();
|
||||
|
||||
bool breakLine = false;
|
||||
bool nobreakLine = false;
|
||||
while (true) {
|
||||
if (s.startsWith("\032\032")) {
|
||||
if (!s.startsWith("\032\032")) {
|
||||
s = TrimLeft(s);
|
||||
if (s == "No locals.") {
|
||||
return;
|
||||
|
@ -899,24 +905,24 @@ void DebugReader::handleLocalOutput()
|
|||
return;
|
||||
}
|
||||
//todo: update local view
|
||||
// if (breakLine and (MainForm.txtLocals.Lines.Count>0) then begin
|
||||
// MainForm.txtLocals.Lines[MainForm.txtLocals.Lines.Count-1] := MainForm.txtLocals.Lines[MainForm.txtLocals.Lines.Count-1] + s;
|
||||
// end else begin
|
||||
// MainForm.txtLocals.Lines.Add(s);
|
||||
// end;
|
||||
breakLine=false;
|
||||
if (nobreakLine and pMainWindow->txtLocals()->document()->lineCount()>0) {
|
||||
emit addLocalWithoutLinebreak(s);
|
||||
} else {
|
||||
emit addLocalWithLinebreak(s);
|
||||
}
|
||||
nobreakLine=false;
|
||||
} else {
|
||||
breakLine = true;
|
||||
nobreakLine = true;
|
||||
}
|
||||
s = getNextLine();
|
||||
if (!breakLine && s.isEmpty())
|
||||
if (!nobreakLine && s.isEmpty())
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DebugReader::handleLocals()
|
||||
{
|
||||
//todo: clear local view
|
||||
emit clearLocals();
|
||||
handleLocalOutput();
|
||||
}
|
||||
|
||||
|
|
|
@ -215,6 +215,9 @@ private slots:
|
|||
void syncFinishedParsing();
|
||||
void onChangeDebugConsoleLastline(const QString& text);
|
||||
void clearUpReader();
|
||||
void onAddLocalWithoutLinebreak(const QString& text);
|
||||
void onAddLocalWithLinebreak(const QString& text);
|
||||
void onClearLocals();
|
||||
private:
|
||||
bool mExecuting;
|
||||
bool mCommandChanged;
|
||||
|
@ -248,7 +251,10 @@ signals:
|
|||
void pauseWatchUpdate();
|
||||
void updateWatch();
|
||||
void processError(QProcess::ProcessError error);
|
||||
void changeDebugConsoleLastLine(const QString& test);
|
||||
void changeDebugConsoleLastLine(const QString& text);
|
||||
void addLocalWithoutLinebreak(const QString& text);
|
||||
void addLocalWithLinebreak(const QString& text);
|
||||
void clearLocals();
|
||||
private:
|
||||
void clearCmdQueue();
|
||||
bool findAnnotation(AnnotationType annotation);
|
||||
|
|
|
@ -307,6 +307,11 @@ void MainWindow::changeDebugOutputLastline(const QString &test)
|
|||
ui->debugConsole->changeLastLine(test);
|
||||
}
|
||||
|
||||
QPlainTextEdit *MainWindow::txtLocals()
|
||||
{
|
||||
return ui->txtLocals;
|
||||
}
|
||||
|
||||
void MainWindow::updateStatusbarForLineCol()
|
||||
{
|
||||
Editor* e = mEditorList->getEditor();
|
||||
|
|
|
@ -20,6 +20,7 @@ class CompilerManager;
|
|||
class Editor;
|
||||
class Debugger;
|
||||
class CPUDialog;
|
||||
class QPlainTextEdit;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
|
@ -65,10 +66,13 @@ public:
|
|||
void addDebugOutput(const QString& text);
|
||||
void changeDebugOutputLastline(const QString& text);
|
||||
|
||||
QPlainTextEdit* txtLocals();
|
||||
|
||||
CPUDialog *cpuDialog() const;
|
||||
|
||||
Debugger *debugger() const;
|
||||
|
||||
|
||||
protected:
|
||||
void openFiles(const QStringList& files);
|
||||
void openFile(const QString& filename);
|
||||
|
|
|
@ -416,7 +416,7 @@
|
|||
</widget>
|
||||
<widget class="QTabWidget" name="debugViews">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabDebugConsole">
|
||||
<attribute name="title">
|
||||
|
|
Loading…
Reference in New Issue