debugger: make "gdb startup script" directly editable

External files are still accessible using "source ..."

Change-Id: Icbf27302ef55b9061b69a9274cb7088798adf73d
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2011-11-01 17:56:32 +01:00
committed by hjk
parent 477476303e
commit ffd0571549
5 changed files with 56 additions and 83 deletions

View File

@@ -4666,12 +4666,10 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &settingsIdHint)
loadPythonDumpers();
QString scriptFileName = sp.overrideStartScript;
if (scriptFileName.isEmpty())
scriptFileName = debuggerCore()->stringSetting(GdbScriptFile);
if (!scriptFileName.isEmpty()) {
if (QFileInfo(scriptFileName).isReadable()) {
postCommand("source " + scriptFileName.toLocal8Bit());
const QString script = sp.overrideStartScript;
if (!script.isEmpty()) {
if (QFileInfo(script).isReadable()) {
postCommand("source " + script.toLocal8Bit());
// Re-do the setup, as the "source" might have changed something.
postCommand("bbsetup", ConsoleCommand, CB(handleHasPython));
} else {
@@ -4680,7 +4678,14 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &settingsIdHint)
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));
).arg(script));
}
} else {
const QString commands = debuggerCore()->stringSetting(GdbStartupCommands);
if (!commands.isEmpty()) {
postCommand(commands.toLocal8Bit());
// Re-do the setup, as the "source" might have changed something.
postCommand("bbsetup", ConsoleCommand, CB(handleHasPython));
}
}