Debugger: Clarify role of "Executable:" in Load Core File dialog

The file containing debug information is needed, this is typically
the executable, but other setups are possible.

Also make it a bit clearer in the code by using 'symbol' in a few
places that previously used 'localExecutable'.

Task-number: QTCREATORBUG-21910
Change-Id: I5c61bc03302c06baa58f82e1d5097f425f8936a8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
hjk
2019-01-31 09:28:10 +01:00
parent 4e6b284e8b
commit b93f21d87a
3 changed files with 28 additions and 24 deletions

View File

@@ -1561,7 +1561,7 @@ void DebuggerPluginPrivate::attachCore()
const QString lastExternalKit = configValue("LastExternalKit").toString(); const QString lastExternalKit = configValue("LastExternalKit").toString();
if (!lastExternalKit.isEmpty()) if (!lastExternalKit.isEmpty())
dlg.setKitId(Id::fromString(lastExternalKit)); dlg.setKitId(Id::fromString(lastExternalKit));
dlg.setLocalExecutableFile(configValue("LastExternalExecutableFile").toString()); dlg.setSymbolFile(configValue("LastExternalExecutableFile").toString());
dlg.setLocalCoreFile(configValue("LastLocalCoreFile").toString()); dlg.setLocalCoreFile(configValue("LastLocalCoreFile").toString());
dlg.setRemoteCoreFile(configValue("LastRemoteCoreFile").toString()); dlg.setRemoteCoreFile(configValue("LastRemoteCoreFile").toString());
dlg.setOverrideStartScript(configValue("LastExternalStartScript").toString()); dlg.setOverrideStartScript(configValue("LastExternalStartScript").toString());
@@ -1570,7 +1570,7 @@ void DebuggerPluginPrivate::attachCore()
if (dlg.exec() != QDialog::Accepted) if (dlg.exec() != QDialog::Accepted)
return; return;
setConfigValue("LastExternalExecutableFile", dlg.localExecutableFile()); setConfigValue("LastExternalExecutableFile", dlg.symbolFile());
setConfigValue("LastLocalCoreFile", dlg.localCoreFile()); setConfigValue("LastLocalCoreFile", dlg.localCoreFile());
setConfigValue("LastRemoteCoreFile", dlg.remoteCoreFile()); setConfigValue("LastRemoteCoreFile", dlg.remoteCoreFile());
setConfigValue("LastExternalKit", dlg.kit()->id().toSetting()); setConfigValue("LastExternalKit", dlg.kit()->id().toSetting());
@@ -1580,7 +1580,7 @@ void DebuggerPluginPrivate::attachCore()
IDevice::ConstPtr device = DeviceKitInformation::device(dlg.kit()); IDevice::ConstPtr device = DeviceKitInformation::device(dlg.kit());
auto runControl = new RunControl(device, ProjectExplorer::Constants::DEBUG_RUN_MODE); auto runControl = new RunControl(device, ProjectExplorer::Constants::DEBUG_RUN_MODE);
auto debugger = new DebuggerRunTool(runControl, dlg.kit()); auto debugger = new DebuggerRunTool(runControl, dlg.kit());
debugger->setInferiorExecutable(dlg.localExecutableFile()); debugger->setInferiorExecutable(dlg.symbolFile());
debugger->setCoreFileName(dlg.localCoreFile()); debugger->setCoreFileName(dlg.localCoreFile());
debugger->setRunControlName(tr("Core file \"%1\"") debugger->setRunControlName(tr("Core file \"%1\"")
.arg(dlg.useLocalCoreFile() ? dlg.localCoreFile() : dlg.remoteCoreFile())); .arg(dlg.useLocalCoreFile() ? dlg.localCoreFile() : dlg.remoteCoreFile()));

View File

@@ -207,7 +207,7 @@ public:
QCheckBox *forceLocalCheckBox; QCheckBox *forceLocalCheckBox;
QLabel *forceLocalLabel; QLabel *forceLocalLabel;
PathChooser *localExecFileName; PathChooser *symbolFileName;
PathChooser *localCoreFileName; PathChooser *localCoreFileName;
QLineEdit *remoteCoreFileName; QLineEdit *remoteCoreFileName;
QPushButton *selectRemoteCoreButton; QPushButton *selectRemoteCoreButton;
@@ -220,11 +220,11 @@ public:
{ {
bool isValid() const bool isValid() const
{ {
return validKit && validLocalExecFilename && validCoreFilename; return validKit && validSymbolFilename && validCoreFilename;
} }
bool validKit; bool validKit;
bool validLocalExecFilename; bool validSymbolFilename;
bool validCoreFilename; bool validCoreFilename;
bool localCoreFile; bool localCoreFile;
bool localKit; bool localKit;
@@ -235,7 +235,7 @@ public:
State st; State st;
st.localCoreFile = p.useLocalCoreFile(); st.localCoreFile = p.useLocalCoreFile();
st.validKit = (kitChooser->currentKit() != nullptr); st.validKit = (kitChooser->currentKit() != nullptr);
st.validLocalExecFilename = localExecFileName->isValid(); st.validSymbolFilename = symbolFileName->isValid();
if (st.localCoreFile) if (st.localCoreFile)
st.validCoreFilename = localCoreFileName->isValid(); st.validCoreFilename = localCoreFileName->isValid();
@@ -274,10 +274,14 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent)
d->localCoreFileName->setExpectedKind(PathChooser::File); d->localCoreFileName->setExpectedKind(PathChooser::File);
d->localCoreFileName->setPromptDialogTitle(tr("Select Core File")); d->localCoreFileName->setPromptDialogTitle(tr("Select Core File"));
d->localExecFileName = new PathChooser(this); d->symbolFileName = new PathChooser(this);
d->localExecFileName->setHistoryCompleter("LocalExecutable"); d->symbolFileName->setHistoryCompleter("LocalExecutable");
d->localExecFileName->setExpectedKind(PathChooser::File); d->symbolFileName->setExpectedKind(PathChooser::File);
d->localExecFileName->setPromptDialogTitle(tr("Select Executable")); d->symbolFileName->setPromptDialogTitle(tr("Select Executable or Symbol File"));
d->symbolFileName->setToolTip(
tr("Select a file containing debug information corresponding to the core file. "
"Typically, this is the executable or a *.debug file if the debug "
"information is stored separately from the executable."));
d->overrideStartScriptFileName = new PathChooser(this); d->overrideStartScriptFileName = new PathChooser(this);
d->overrideStartScriptFileName->setHistoryCompleter("Debugger.StartupScript.History"); d->overrideStartScriptFileName->setHistoryCompleter("Debugger.StartupScript.History");
@@ -296,7 +300,7 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent)
formLayout->addRow(tr("Kit:"), d->kitChooser); formLayout->addRow(tr("Kit:"), d->kitChooser);
formLayout->addRow(d->forceLocalLabel, d->forceLocalCheckBox); formLayout->addRow(d->forceLocalLabel, d->forceLocalCheckBox);
formLayout->addRow(tr("Core file:"), coreLayout); formLayout->addRow(tr("Core file:"), coreLayout);
formLayout->addRow(tr("&Executable:"), d->localExecFileName); formLayout->addRow(tr("&Executable or symbol file:"), d->symbolFileName);
formLayout->addRow(tr("Override &start script:"), d->overrideStartScriptFileName); formLayout->addRow(tr("Override &start script:"), d->overrideStartScriptFileName);
auto line = new QFrame(this); auto line = new QFrame(this);
@@ -321,7 +325,7 @@ int AttachCoreDialog::exec()
{ {
connect(d->selectRemoteCoreButton, &QAbstractButton::clicked, this, &AttachCoreDialog::selectRemoteCoreFile); connect(d->selectRemoteCoreButton, &QAbstractButton::clicked, this, &AttachCoreDialog::selectRemoteCoreFile);
connect(d->remoteCoreFileName, &QLineEdit::textChanged, this, &AttachCoreDialog::coreFileChanged); connect(d->remoteCoreFileName, &QLineEdit::textChanged, this, &AttachCoreDialog::coreFileChanged);
connect(d->localExecFileName, &PathChooser::rawPathChanged, this, &AttachCoreDialog::changed); connect(d->symbolFileName, &PathChooser::rawPathChanged, this, &AttachCoreDialog::changed);
connect(d->localCoreFileName, &PathChooser::rawPathChanged, this, &AttachCoreDialog::coreFileChanged); connect(d->localCoreFileName, &PathChooser::rawPathChanged, this, &AttachCoreDialog::coreFileChanged);
connect(d->forceLocalCheckBox, &QCheckBox::stateChanged, this, &AttachCoreDialog::changed); connect(d->forceLocalCheckBox, &QCheckBox::stateChanged, this, &AttachCoreDialog::changed);
connect(d->kitChooser, &KitChooser::currentIndexChanged, this, &AttachCoreDialog::changed); connect(d->kitChooser, &KitChooser::currentIndexChanged, this, &AttachCoreDialog::changed);
@@ -337,8 +341,8 @@ int AttachCoreDialog::exec()
d->localCoreFileName->setFocus(); d->localCoreFileName->setFocus();
else else
d->remoteCoreFileName->setFocus(); d->remoteCoreFileName->setFocus();
} else if (!st.validLocalExecFilename) { } else if (!st.validSymbolFilename) {
d->localExecFileName->setFocus(); d->symbolFileName->setFocus();
} }
return QDialog::exec(); return QDialog::exec();
@@ -366,9 +370,9 @@ void AttachCoreDialog::coreFileChanged(const QString &core)
Runnable debugger = DebuggerKitInformation::runnable(k); Runnable debugger = DebuggerKitInformation::runnable(k);
CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(debugger, core); CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(debugger, core);
if (!cinfo.foundExecutableName.isEmpty()) if (!cinfo.foundExecutableName.isEmpty())
d->localExecFileName->setFileName(FileName::fromString(cinfo.foundExecutableName)); d->symbolFileName->setFileName(FileName::fromString(cinfo.foundExecutableName));
else if (!d->localExecFileName->isValid() && !cinfo.rawStringFromCore.isEmpty()) else if (!d->symbolFileName->isValid() && !cinfo.rawStringFromCore.isEmpty())
d->localExecFileName->setFileName(FileName::fromString(cinfo.rawStringFromCore)); d->symbolFileName->setFileName(FileName::fromString(cinfo.rawStringFromCore));
} }
changed(); changed();
} }
@@ -411,14 +415,14 @@ QString AttachCoreDialog::localCoreFile() const
return d->localCoreFileName->path(); return d->localCoreFileName->path();
} }
QString AttachCoreDialog::localExecutableFile() const QString AttachCoreDialog::symbolFile() const
{ {
return d->localExecFileName->path(); return d->symbolFileName->path();
} }
void AttachCoreDialog::setLocalExecutableFile(const QString &fileName) void AttachCoreDialog::setSymbolFile(const QString &symbolFileName)
{ {
d->localExecFileName->setPath(fileName); d->symbolFileName->setPath(symbolFileName);
} }
void AttachCoreDialog::setLocalCoreFile(const QString &fileName) void AttachCoreDialog::setLocalCoreFile(const QString &fileName)

View File

@@ -45,7 +45,7 @@ public:
int exec() override; int exec() override;
QString localExecutableFile() const; QString symbolFile() const;
QString localCoreFile() const; QString localCoreFile() const;
QString remoteCoreFile() const; QString remoteCoreFile() const;
QString overrideStartScript() const; QString overrideStartScript() const;
@@ -55,7 +55,7 @@ public:
// For persistance. // For persistance.
ProjectExplorer::Kit *kit() const; ProjectExplorer::Kit *kit() const;
void setLocalExecutableFile(const QString &executable); void setSymbolFile(const QString &symbolFileName);
void setLocalCoreFile(const QString &core); void setLocalCoreFile(const QString &core);
void setRemoteCoreFile(const QString &core); void setRemoteCoreFile(const QString &core);
void setOverrideStartScript(const QString &scriptName); void setOverrideStartScript(const QString &scriptName);