work save
This commit is contained in:
parent
b17406eb07
commit
5c17096e00
|
@ -65,6 +65,7 @@ bool Debugger::start()
|
|||
connect(mReader, &DebugReader::changeDebugConsoleLastLine,this,&Debugger::onChangeDebugConsoleLastline);
|
||||
connect(mReader, &DebugReader::cmdStarted,pMainWindow, &MainWindow::disableDebugActions);
|
||||
connect(mReader, &DebugReader::cmdFinished,pMainWindow, &MainWindow::enableDebugActions);
|
||||
connect(mReader, &DebugReader::inferiorStopped, pMainWindow, &MainWindow::enableDebugActions);
|
||||
|
||||
connect(mReader, &DebugReader::breakpointInfoGetted, mBreakpointModel,
|
||||
&BreakpointModel::updateBreakpointNumber);
|
||||
|
@ -76,9 +77,13 @@ bool Debugger::start()
|
|||
connect(mReader, &DebugReader::evalUpdated,[this](const QString& value) {
|
||||
emit evalValueReady(value);
|
||||
});
|
||||
connect(mReader, &DebugReader::inferiorContinued,pMainWindow,
|
||||
&MainWindow::removeActiveBreakpoints);
|
||||
connect(mReader, &DebugReader::inferiorStopped,pMainWindow,
|
||||
&MainWindow::setActiveBreakpoint);
|
||||
|
||||
mReader->registerInferiorStoppedCommand("-stack-list-frames","");
|
||||
mReader->registerInferiorStoppedCommand("-stack-list-variables", "--all-values");
|
||||
mReader->start();
|
||||
mReader->waitStart();
|
||||
|
||||
|
@ -153,6 +158,14 @@ bool Debugger::commandRunning()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Debugger::inferiorRunning()
|
||||
{
|
||||
if (mExecuting && mReader) {
|
||||
return mReader->inferiorRunning();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Debugger::addBreakpoint(int line, const Editor* editor)
|
||||
{
|
||||
addBreakpoint(line,editor->filename());
|
||||
|
@ -373,12 +386,6 @@ void Debugger::notifyAfterProcessWatchVar()
|
|||
mWatchModel->endUpdate();
|
||||
}
|
||||
|
||||
void Debugger::updateDebugInfo()
|
||||
{
|
||||
sendCommand("-stack-list-frames", "");
|
||||
sendCommand("-stack-list-variables", "--skip-unavailable --allvalues");
|
||||
}
|
||||
|
||||
bool Debugger::useUTF8() const
|
||||
{
|
||||
return mUseUTF8;
|
||||
|
@ -461,11 +468,7 @@ void Debugger::syncFinishedParsing()
|
|||
}
|
||||
}
|
||||
|
||||
// The program to debug has stopped. Stop the debugger
|
||||
if (mReader->processExited()) {
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// show command output
|
||||
if (pSettings->debugger().showCommandLog() ) {
|
||||
|
@ -480,6 +483,12 @@ void Debugger::syncFinishedParsing()
|
|||
}
|
||||
}
|
||||
|
||||
// The program to debug has stopped. Stop the debugger
|
||||
if (mReader->processExited()) {
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
|
||||
// Some part of the CPU form has been updated
|
||||
if (pMainWindow->cpuDialog()!=nullptr && !mReader->signalReceived()) {
|
||||
// if (mReader->doregistersready) {
|
||||
|
@ -646,7 +655,6 @@ void DebugReader::processExecAsyncRecord(const QByteArray &line)
|
|||
GDBMIResultParser parser;
|
||||
if (!parser.parseAsyncResult(line,result,multiValues))
|
||||
return;
|
||||
qDebug()<<result<<line;
|
||||
if (result == "running") {
|
||||
mInferiorRunning = true;
|
||||
mCurrentAddress=0;
|
||||
|
@ -682,7 +690,6 @@ void DebugReader::processExecAsyncRecord(const QByteArray &line)
|
|||
mCurrentLine = frameObj["line"].intValue();
|
||||
mCurrentFile = frameObj["fullname"].pathValue();
|
||||
}
|
||||
qDebug()<<mCurrentFile<<mCurrentLine;
|
||||
if (reason == "signal-received") {
|
||||
mSignalReceived = true;
|
||||
}
|
||||
|
@ -773,6 +780,8 @@ void DebugReader::processDebugOutput(const QByteArray& debugOutput)
|
|||
}
|
||||
|
||||
emit parseFinished();
|
||||
mConsoleOutput.clear();
|
||||
mFullOutput.clear();
|
||||
}
|
||||
|
||||
void DebugReader::runInferiorStoppedHook()
|
||||
|
@ -1126,7 +1135,7 @@ void DebugReader::handleStack(const QList<GDBMIResultParser::ParseValue> & stack
|
|||
PTrace trace = std::make_shared<Trace>();
|
||||
trace->funcname = frameObject["func"].value();
|
||||
trace->filename = frameObject["fullname"].pathValue();
|
||||
trace->line = frameObject["fullname"].intValue();
|
||||
trace->line = frameObject["line"].intValue();
|
||||
trace->level = frameObject["level"].intValue(0);
|
||||
trace->address = frameObject["addr"].value();
|
||||
mDebugger->backtraceModel()->addTrace(trace);
|
||||
|
@ -1180,6 +1189,11 @@ QByteArray DebugReader::removeToken(const QByteArray &line)
|
|||
return line;
|
||||
}
|
||||
|
||||
bool DebugReader::inferiorRunning() const
|
||||
{
|
||||
return mInferiorRunning;
|
||||
}
|
||||
|
||||
const QStringList &DebugReader::fullOutput() const
|
||||
{
|
||||
return mFullOutput;
|
||||
|
@ -1308,7 +1322,11 @@ void DebugReader::run()
|
|||
readed = mProcess->readAll();
|
||||
buffer += readed;
|
||||
|
||||
if ( readed.endsWith("\n")&& outputTerminated(buffer)) {
|
||||
if (!readed.isEmpty()) {
|
||||
qDebug()<<"*******";
|
||||
qDebug()<<readed;
|
||||
}
|
||||
if (readed.endsWith("\n")&& outputTerminated(buffer)) {
|
||||
processDebugOutput(buffer);
|
||||
buffer.clear();
|
||||
mCmdRunning = false;
|
||||
|
@ -1316,7 +1334,7 @@ void DebugReader::run()
|
|||
} else if (!mCmdRunning && readed.isEmpty()){
|
||||
runNextCmd();
|
||||
} else if (readed.isEmpty()){
|
||||
msleep(1);
|
||||
msleep(100);
|
||||
}
|
||||
}
|
||||
if (errorOccurred) {
|
||||
|
|
|
@ -176,6 +176,7 @@ public:
|
|||
void sendCommand(const QString& command, const QString& params,
|
||||
DebugCommandSource source = DebugCommandSource::Other);
|
||||
bool commandRunning();
|
||||
bool inferiorRunning();
|
||||
|
||||
//breakpoints
|
||||
void addBreakpoint(int line, const Editor* editor);
|
||||
|
@ -210,9 +211,6 @@ public:
|
|||
void notifyBeforeProcessWatchVar();
|
||||
void notifyAfterProcessWatchVar();
|
||||
|
||||
|
||||
void updateDebugInfo();
|
||||
|
||||
bool useUTF8() const;
|
||||
void setUseUTF8(bool useUTF8);
|
||||
|
||||
|
@ -307,6 +305,8 @@ public:
|
|||
|
||||
const QStringList &fullOutput() const;
|
||||
|
||||
bool inferiorRunning() const;
|
||||
|
||||
signals:
|
||||
void parseStarted();
|
||||
void invalidateAllVars();
|
||||
|
@ -366,16 +366,6 @@ private:
|
|||
QString mSignal;
|
||||
bool mUseUTF8;
|
||||
|
||||
// attempt to cut down on Synchronize calls
|
||||
bool dodisassemblerready;
|
||||
bool doregistersready;
|
||||
bool doevalready;
|
||||
bool doupdatecpuwindow;
|
||||
bool doupdateexecution;
|
||||
bool doreceivedsignal;
|
||||
bool doreceivedsfwarning;
|
||||
bool doupdatememoryview;
|
||||
|
||||
//
|
||||
QList<PDebugCommand> mInferiorStoppedHookCommands;
|
||||
bool mInferiorRunning;
|
||||
|
|
|
@ -51,8 +51,6 @@ bool GDBMIResultParser::parseAsyncResult(const QByteArray &record, QByteArray &r
|
|||
|
||||
bool GDBMIResultParser::parseMultiValues(const char* p, ParseObject &multiValue)
|
||||
{
|
||||
qDebug()<<"-------";
|
||||
qDebug()<<QByteArray(p);
|
||||
while (*p) {
|
||||
QByteArray propName;
|
||||
ParseValue propValue;
|
||||
|
@ -223,7 +221,6 @@ bool GDBMIResultParser::parseObject(const char *&p, ParseObject &obj)
|
|||
QByteArray propName;
|
||||
ParseValue propValue;
|
||||
bool result = parseNameAndValue(p,propName,propValue);
|
||||
qDebug()<<result<<propName<<QByteArray(p);
|
||||
if (result) {
|
||||
obj[propName]=propValue;
|
||||
} else {
|
||||
|
@ -254,12 +251,23 @@ bool GDBMIResultParser::parseArray(const char *&p, QList<GDBMIResultParser::Pars
|
|||
if (*p!=']') {
|
||||
while (*p!=0) {
|
||||
skipSpaces(p);
|
||||
ParseValue val;
|
||||
bool result = parseValue(p,val);
|
||||
if (result) {
|
||||
array.append(val);
|
||||
if (*p=='{' || *p=='"' || *p=='[') {
|
||||
ParseValue val;
|
||||
bool result = parseValue(p,val);
|
||||
if (result) {
|
||||
array.append(val);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
QByteArray name;
|
||||
ParseValue val;
|
||||
bool result = parseNameAndValue(p,name,val);
|
||||
if (result) {
|
||||
array.append(val);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
skipSpaces(p);
|
||||
if (*p==']')
|
||||
|
|
|
@ -489,5 +489,6 @@
|
|||
<file>images/editor/bookmark.png</file>
|
||||
<file>images/newlook24/091-openproblemanswer.png</file>
|
||||
<file>images/newlook24/092-runallproblemcases.png</file>
|
||||
<file>images/newlook24/093-pause.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
|
@ -1410,6 +1410,9 @@ void MainWindow::debug()
|
|||
updateEditorActions();
|
||||
return;
|
||||
}
|
||||
mDebugger->sendCommand("-gdb-set","mi-async on");
|
||||
mDebugger->sendCommand("-gdb-set","target-async on");
|
||||
mDebugger->sendCommand("-gdb-show", "mi-async");
|
||||
|
||||
updateEditorActions();
|
||||
|
||||
|
@ -3013,13 +3016,13 @@ void MainWindow::disableDebugActions()
|
|||
|
||||
void MainWindow::enableDebugActions()
|
||||
{
|
||||
ui->actionStep_Into->setEnabled(true);
|
||||
ui->actionStep_Over->setEnabled(true);
|
||||
ui->actionStep_Out->setEnabled(true);
|
||||
ui->actionRun_To_Cursor->setEnabled(true);
|
||||
ui->actionContinue->setEnabled(true);
|
||||
ui->cbEvaluate->setEnabled(true);
|
||||
ui->cbMemoryAddress->setEnabled(true);
|
||||
ui->actionStep_Into->setEnabled(!mDebugger->inferiorRunning());
|
||||
ui->actionStep_Over->setEnabled(!mDebugger->inferiorRunning());
|
||||
ui->actionStep_Out->setEnabled(!mDebugger->inferiorRunning());
|
||||
ui->actionRun_To_Cursor->setEnabled(!mDebugger->inferiorRunning());
|
||||
ui->actionContinue->setEnabled(!mDebugger->inferiorRunning());
|
||||
ui->cbEvaluate->setEnabled(!mDebugger->inferiorRunning());
|
||||
ui->cbMemoryAddress->setEnabled(!mDebugger->inferiorRunning());
|
||||
}
|
||||
|
||||
void MainWindow::onTodoParseStarted(const QString&)
|
||||
|
@ -4018,8 +4021,6 @@ void MainWindow::on_actionContinue_triggered()
|
|||
//WatchView.Items.BeginUpdate();
|
||||
mDebugger->invalidateAllVars();
|
||||
mDebugger->sendCommand("-exec-continue", "");
|
||||
mDebugger->updateDebugInfo();
|
||||
mDebugger->refreshWatchVars();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5742,3 +5743,11 @@ void MainWindow::on_actionDelete_to_BOL_triggered()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionPause_triggered()
|
||||
{
|
||||
if (mDebugger->executing()) {
|
||||
mDebugger->sendCommand("-exec-interrupt","-a");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -528,6 +528,8 @@ private slots:
|
|||
|
||||
void on_actionDelete_to_BOL_triggered();
|
||||
|
||||
void on_actionPause_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
EditorList *mEditorList;
|
||||
|
|
|
@ -1424,6 +1424,7 @@
|
|||
<addaction name="actionStep_Over"/>
|
||||
<addaction name="actionStep_Into"/>
|
||||
<addaction name="actionRun_To_Cursor"/>
|
||||
<addaction name="actionPause"/>
|
||||
<addaction name="actionContinue"/>
|
||||
<addaction name="actionStop_Execution"/>
|
||||
<addaction name="separator"/>
|
||||
|
@ -1642,6 +1643,7 @@
|
|||
<addaction name="actionStep_Over"/>
|
||||
<addaction name="actionStep_Into"/>
|
||||
<addaction name="actionStep_Out"/>
|
||||
<addaction name="actionPause"/>
|
||||
<addaction name="actionContinue"/>
|
||||
<addaction name="actionStop_Execution"/>
|
||||
<addaction name="separator"/>
|
||||
|
@ -2649,6 +2651,18 @@
|
|||
<string>Ctrl+Backspace</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPause">
|
||||
<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>Pause</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F3</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
Loading…
Reference in New Issue