Commit d1dac15c authored by hjk's avatar hjk
Browse files

debugger: fix "ScriptFile" option (store in preferences and source file

on gdb startup)
parent 57a091ac
......@@ -894,6 +894,7 @@ void DebuggerPlugin::writeSettings() const
s->setValue("Locked", m_toggleLockedAction->isChecked());
s->setValue("Location", m->m_gdbCmd);
s->setValue("Environment", m->m_gdbEnv);
s->setValue("ScriptFile", m->m_scriptFile);
s->setValue("AutoRun", m->m_autoRun);
s->setValue("AutoQuit", m->m_autoQuit);
......@@ -922,18 +923,18 @@ void DebuggerPlugin::readSettings()
s->beginGroup(QLatin1String("DebugMode"));
QByteArray ba = s->value("State", QByteArray()).toByteArray();
m_toggleLockedAction->setChecked(s->value("Locked", true).toBool());
m->m_gdbCmd = s->value("Location", defaultCommand).toString();
m->m_scriptFile= s->value("ScriptFile", defaultScript).toString();
m->m_gdbEnv = s->value("Environment", "").toString();
m->m_autoRun = s->value("AutoRun", true).toBool();
m->m_autoQuit = s->value("AutoQuit", true).toBool();
m->m_skipKnownFrames = s->value("SkipKnownFrames", false).toBool();
m->m_debugDumpers = s->value("DebugDumpers", false).toBool();
m->m_gdbCmd = s->value("Location", defaultCommand).toString();
m->m_scriptFile = s->value("ScriptFile", defaultScript).toString();
m->m_gdbEnv = s->value("Environment", "").toString();
m->m_autoRun = s->value("AutoRun", true).toBool();
m->m_autoQuit = s->value("AutoQuit", true).toBool();
m->m_skipKnownFrames = s->value("SkipKnownFrames", false).toBool();
m->m_debugDumpers = s->value("DebugDumpers", false).toBool();
m->m_useCustomDumpers = s->value("UseCustomDupers", false).toBool();
m->m_useFastStart = s->value("UseFastStart", false).toBool();
m->m_useToolTips = s->value("UseToolTips", false).toBool();
m->m_useTerminal = s->value("UseTerminal", false).toBool();
m->m_useFastStart = s->value("UseFastStart", false).toBool();
m->m_useToolTips = s->value("UseToolTips", false).toBool();
m->m_useTerminal = s->value("UseTerminal", false).toBool();
s->endGroup();
m_manager->mainWindow()->restoreState(ba);
......
......@@ -696,7 +696,7 @@ void GdbEngine::sendCommand(const QString &command, int type,
//qDebug() << "";
if (!command.isEmpty()) {
//qDebug() << qPrintable(currentTime()) << "RUNNING << cmd.command;
//qDebug() << qPrintable(currentTime()) << "RUNNING" << cmd.command;
m_gdbProc.write(cmd.command.toLatin1() + "\r\n");
//emit gdbInputAvailable(QString(), " " + currentTime());
emit gdbInputAvailable(QString(), "[" + currentTime() + "] " + cmd.command);
......@@ -1520,6 +1520,7 @@ bool GdbEngine::startDebugger()
#if 0
qDebug() << "Command: " << q->settings()->m_gdbCmd;
qDebug() << "WorkingDirectory: " << m_gdbProc.workingDirectory();
qDebug() << "ScriptFile: " << q->settings()->m_scriptFile;
qDebug() << "Environment: " << m_gdbProc.environment();
qDebug() << "Arguments: " << gdbArgs;
qDebug() << "BuildDir: " << q->m_buildDir;
......@@ -1599,6 +1600,22 @@ bool GdbEngine::startDebugger()
"dyld \".*libobjc.*\" all "
"dyld \".*CarbonDataFormatters.*\" all");
#endif
QString scriptFileName = q->settings()->m_scriptFile;
if (!scriptFileName.isEmpty()) {
QFile scriptFile(scriptFileName);
if (scriptFile.open(QIODevice::ReadOnly)) {
sendCommand("source " + scriptFileName);
} else {
QMessageBox::warning(q->mainWindow(),
tr("Cannot find debugger initialization script"),
tr("The debugger settings point to a script file at '%1' "
"which is not accessible. If a script file is not needed, "
"consider clearing that entry to avoid this warning. "
).arg(scriptFileName));
}
}
if (q->startMode() == q->attachExternal) {
sendCommand("attach " + QString::number(q->m_attachedPID));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment