forked from qt-creator/qt-creator
		
	some cleanup
This commit is contained in:
		@@ -911,7 +911,8 @@ void DebuggerPlugin::extensionsInitialized()
 | 
			
		||||
void DebuggerPlugin::attachCmdLinePid()
 | 
			
		||||
{
 | 
			
		||||
    m_manager->showStatusMessage(tr("Attaching to PID %1.").arg(m_cmdLineAttachPid));
 | 
			
		||||
    const QString crashParameter = m_cmdLineWinCrashEvent ? QString::number(m_cmdLineWinCrashEvent) : QString();
 | 
			
		||||
    const QString crashParameter =
 | 
			
		||||
        m_cmdLineWinCrashEvent ? QString::number(m_cmdLineWinCrashEvent) : QString();
 | 
			
		||||
    attachExternalApplication(m_cmdLineAttachPid, crashParameter);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1171,13 +1172,13 @@ void DebuggerPlugin::showSettingsDialog()
 | 
			
		||||
        QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_PAGE));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static QSharedPointer<RunConfiguration> activeRunConfiguration()
 | 
			
		||||
static RunConfigurationPtr activeRunConfiguration()
 | 
			
		||||
{
 | 
			
		||||
    ProjectExplorer::Project *project =
 | 
			
		||||
        ProjectExplorerPlugin::instance()->currentProject();
 | 
			
		||||
    if (project)
 | 
			
		||||
        return project->activeRunConfiguration();
 | 
			
		||||
    return QSharedPointer<RunConfiguration>();
 | 
			
		||||
    return RunConfigurationPtr();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DebuggerPlugin::startExternalApplication()
 | 
			
		||||
@@ -1203,7 +1204,7 @@ void DebuggerPlugin::startExternalApplication()
 | 
			
		||||
    if (dlg.breakAtMain())
 | 
			
		||||
        m_manager->breakByFunctionMain();
 | 
			
		||||
 | 
			
		||||
    QSharedPointer<RunConfiguration> rc = activeRunConfiguration();
 | 
			
		||||
    RunConfigurationPtr rc = activeRunConfiguration();
 | 
			
		||||
    if (rc.isNull())
 | 
			
		||||
        rc = DebuggerRunner::createDefaultRunConfiguration(sp->executable);
 | 
			
		||||
 | 
			
		||||
@@ -1229,7 +1230,7 @@ void DebuggerPlugin::attachExternalApplication(qint64 pid, const QString &crashP
 | 
			
		||||
    sp->attachPID = pid;
 | 
			
		||||
    sp->crashParameter = crashParameter;
 | 
			
		||||
    sp->startMode = crashParameter.isEmpty() ?  AttachExternal : AttachCrashedExternal;
 | 
			
		||||
    QSharedPointer<RunConfiguration> rc = activeRunConfiguration();
 | 
			
		||||
    RunConfigurationPtr rc = activeRunConfiguration();
 | 
			
		||||
    if (rc.isNull())
 | 
			
		||||
        rc = DebuggerRunner::createDefaultRunConfiguration();
 | 
			
		||||
    if (RunControl *runControl = m_debuggerRunner
 | 
			
		||||
@@ -1254,7 +1255,7 @@ void DebuggerPlugin::attachCore()
 | 
			
		||||
    sp->executable = dlg.executableFile();
 | 
			
		||||
    sp->coreFile = dlg.coreFile();
 | 
			
		||||
    sp->startMode = AttachCore;
 | 
			
		||||
    QSharedPointer<RunConfiguration> rc = activeRunConfiguration();
 | 
			
		||||
    RunConfigurationPtr rc = activeRunConfiguration();
 | 
			
		||||
    if (rc.isNull())
 | 
			
		||||
        rc = DebuggerRunner::createDefaultRunConfiguration();
 | 
			
		||||
    if (RunControl *runControl = m_debuggerRunner
 | 
			
		||||
@@ -1289,7 +1290,7 @@ void DebuggerPlugin::startRemoteApplication()
 | 
			
		||||
    if (dlg.useServerStartScript())
 | 
			
		||||
        sp->serverStartScript = dlg.serverStartScript();
 | 
			
		||||
 | 
			
		||||
    QSharedPointer<RunConfiguration> rc = activeRunConfiguration();
 | 
			
		||||
    RunConfigurationPtr rc = activeRunConfiguration();
 | 
			
		||||
    if (rc.isNull())
 | 
			
		||||
        rc = DebuggerRunner::createDefaultRunConfiguration();
 | 
			
		||||
    if (RunControl *runControl = m_debuggerRunner
 | 
			
		||||
@@ -1325,7 +1326,7 @@ void DebuggerPlugin::attachRemoteTcf()
 | 
			
		||||
    if (dlg.useServerStartScript())
 | 
			
		||||
        sp->serverStartScript = dlg.serverStartScript();
 | 
			
		||||
 | 
			
		||||
    QSharedPointer<RunConfiguration> rc = activeRunConfiguration();
 | 
			
		||||
    RunConfigurationPtr rc = activeRunConfiguration();
 | 
			
		||||
    if (rc.isNull())
 | 
			
		||||
        rc = DebuggerRunner::createDefaultRunConfiguration();
 | 
			
		||||
    if (RunControl *runControl = m_debuggerRunner
 | 
			
		||||
 
 | 
			
		||||
@@ -985,7 +985,7 @@ void GdbEngine::handleExecJumpToLine(const GdbResultRecord &record)
 | 
			
		||||
        if (idx2 > 0) {
 | 
			
		||||
            QString file = QString::fromLocal8Bit(output.mid(idx1, idx2 - idx1));
 | 
			
		||||
            int line = output.mid(idx2 + 1).toInt();
 | 
			
		||||
            m_manager->gotoLocation(file, line, true);
 | 
			
		||||
            gotoLocation(file, line, true);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1006,7 +1006,7 @@ void GdbEngine::handleExecRunToFunction(const GdbResultRecord &record, const QVa
 | 
			
		||||
    f.file = QString::fromLocal8Bit(frame.findChild("fullname").data());
 | 
			
		||||
    f.line = frame.findChild("line").data().toInt();
 | 
			
		||||
    f.address = _(frame.findChild("addr").data());
 | 
			
		||||
    m_manager->gotoLocation(f, true);
 | 
			
		||||
    gotoLocation(f, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool isExitedReason(const QByteArray &reason)
 | 
			
		||||
@@ -1269,7 +1269,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
 | 
			
		||||
    f.file = QString::fromLocal8Bit(frame.findChild("fullname").data());
 | 
			
		||||
    f.line = frame.findChild("line").data().toInt();
 | 
			
		||||
    f.address = _(frame.findChild("addr").data());
 | 
			
		||||
    m_manager->gotoLocation(f, true);
 | 
			
		||||
    gotoLocation(f, true);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1324,7 +1324,7 @@ void GdbEngine::handleAsyncOutput2(const GdbMi &data)
 | 
			
		||||
        f.file = QString::fromLocal8Bit(fullName.data());
 | 
			
		||||
        f.line = frame.findChild("line").data().toInt();
 | 
			
		||||
        f.address = _(frame.findChild("addr").data());
 | 
			
		||||
        m_manager->gotoLocation(f, true);
 | 
			
		||||
        gotoLocation(f, true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //
 | 
			
		||||
@@ -1947,11 +1947,11 @@ void GdbEngine::jumpToLineExec(const QString &fileName, int lineNumber)
 | 
			
		||||
    //  ~"run1 (argc=1, argv=0x7fffbf1f5538) at test1.cpp:242"
 | 
			
		||||
    //  ~"242\t x *= 2;"
 | 
			
		||||
    //  23^done"
 | 
			
		||||
    m_manager->gotoLocation(frame, true);
 | 
			
		||||
    gotoLocation(frame, true);
 | 
			
		||||
    //setBreakpoint();
 | 
			
		||||
    //postCommand(_("jump ") + fileName + ':' + QString::number(lineNumber));
 | 
			
		||||
#else
 | 
			
		||||
    m_manager->gotoLocation(frame,  true);
 | 
			
		||||
    gotoLocation(frame,  true);
 | 
			
		||||
    setBreakpoint(fileName, lineNumber);
 | 
			
		||||
    postCommand(_("jump ") + fileName + ':' + QString::number(lineNumber));
 | 
			
		||||
#endif
 | 
			
		||||
@@ -2595,7 +2595,7 @@ void GdbEngine::handleStackListFrames(const GdbResultRecord &record, const QVari
 | 
			
		||||
 | 
			
		||||
        if (topFrame != -1 || theDebuggerBoolSetting(StepByInstruction)) {
 | 
			
		||||
            const StackFrame &frame = qq->stackHandler()->currentFrame();
 | 
			
		||||
            m_manager->gotoLocation(frame, true);
 | 
			
		||||
            gotoLocation(frame, true);
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        qDebug() << "LISTING STACK FAILED: " << record.toString();
 | 
			
		||||
@@ -2648,7 +2648,7 @@ void GdbEngine::activateFrame(int frameIndex)
 | 
			
		||||
    const StackFrame &frame = stackHandler->currentFrame();
 | 
			
		||||
 | 
			
		||||
    if (frame.isUsable())
 | 
			
		||||
        m_manager->gotoLocation(frame, true);
 | 
			
		||||
        gotoLocation(frame, true);
 | 
			
		||||
    else
 | 
			
		||||
        qDebug() << "FULL NAME NOT USABLE:" << frame.file;
 | 
			
		||||
}
 | 
			
		||||
@@ -4285,6 +4285,11 @@ void GdbEngine::handleFetchDisassemblerByAddress0(const GdbResultRecord &record,
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GdbEngine::gotoLocation(const StackFrame &frame, bool setMarker)
 | 
			
		||||
{
 | 
			
		||||
    m_manager->gotoLocation(frame, setMarker);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
IDebuggerEngine *createGdbEngine(DebuggerManager *parent,
 | 
			
		||||
    QList<Core::IOptionsPage*> *opts)
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -194,6 +194,7 @@ private:
 | 
			
		||||
    int currentFrame() const;
 | 
			
		||||
 | 
			
		||||
    bool supportsThreads() const;
 | 
			
		||||
    void gotoLocation(const StackFrame &frame, bool setLocationMarker);
 | 
			
		||||
 | 
			
		||||
    void initializeConnections();
 | 
			
		||||
    void initializeVariables();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user