From b93f21d87a9b834a7f7cf21534fff99d66c64c75 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 31 Jan 2019 09:28:10 +0100 Subject: [PATCH] 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 Reviewed-by: Leena Miettinen --- src/plugins/debugger/debuggerplugin.cpp | 6 ++-- src/plugins/debugger/loadcoredialog.cpp | 42 ++++++++++++++----------- src/plugins/debugger/loadcoredialog.h | 4 +-- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 661400cb515..e52cb723141 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1561,7 +1561,7 @@ void DebuggerPluginPrivate::attachCore() const QString lastExternalKit = configValue("LastExternalKit").toString(); if (!lastExternalKit.isEmpty()) dlg.setKitId(Id::fromString(lastExternalKit)); - dlg.setLocalExecutableFile(configValue("LastExternalExecutableFile").toString()); + dlg.setSymbolFile(configValue("LastExternalExecutableFile").toString()); dlg.setLocalCoreFile(configValue("LastLocalCoreFile").toString()); dlg.setRemoteCoreFile(configValue("LastRemoteCoreFile").toString()); dlg.setOverrideStartScript(configValue("LastExternalStartScript").toString()); @@ -1570,7 +1570,7 @@ void DebuggerPluginPrivate::attachCore() if (dlg.exec() != QDialog::Accepted) return; - setConfigValue("LastExternalExecutableFile", dlg.localExecutableFile()); + setConfigValue("LastExternalExecutableFile", dlg.symbolFile()); setConfigValue("LastLocalCoreFile", dlg.localCoreFile()); setConfigValue("LastRemoteCoreFile", dlg.remoteCoreFile()); setConfigValue("LastExternalKit", dlg.kit()->id().toSetting()); @@ -1580,7 +1580,7 @@ void DebuggerPluginPrivate::attachCore() IDevice::ConstPtr device = DeviceKitInformation::device(dlg.kit()); auto runControl = new RunControl(device, ProjectExplorer::Constants::DEBUG_RUN_MODE); auto debugger = new DebuggerRunTool(runControl, dlg.kit()); - debugger->setInferiorExecutable(dlg.localExecutableFile()); + debugger->setInferiorExecutable(dlg.symbolFile()); debugger->setCoreFileName(dlg.localCoreFile()); debugger->setRunControlName(tr("Core file \"%1\"") .arg(dlg.useLocalCoreFile() ? dlg.localCoreFile() : dlg.remoteCoreFile())); diff --git a/src/plugins/debugger/loadcoredialog.cpp b/src/plugins/debugger/loadcoredialog.cpp index 9221b9b5b63..8bd68aa791d 100644 --- a/src/plugins/debugger/loadcoredialog.cpp +++ b/src/plugins/debugger/loadcoredialog.cpp @@ -207,7 +207,7 @@ public: QCheckBox *forceLocalCheckBox; QLabel *forceLocalLabel; - PathChooser *localExecFileName; + PathChooser *symbolFileName; PathChooser *localCoreFileName; QLineEdit *remoteCoreFileName; QPushButton *selectRemoteCoreButton; @@ -220,11 +220,11 @@ public: { bool isValid() const { - return validKit && validLocalExecFilename && validCoreFilename; + return validKit && validSymbolFilename && validCoreFilename; } bool validKit; - bool validLocalExecFilename; + bool validSymbolFilename; bool validCoreFilename; bool localCoreFile; bool localKit; @@ -235,7 +235,7 @@ public: State st; st.localCoreFile = p.useLocalCoreFile(); st.validKit = (kitChooser->currentKit() != nullptr); - st.validLocalExecFilename = localExecFileName->isValid(); + st.validSymbolFilename = symbolFileName->isValid(); if (st.localCoreFile) st.validCoreFilename = localCoreFileName->isValid(); @@ -274,10 +274,14 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent) d->localCoreFileName->setExpectedKind(PathChooser::File); d->localCoreFileName->setPromptDialogTitle(tr("Select Core File")); - d->localExecFileName = new PathChooser(this); - d->localExecFileName->setHistoryCompleter("LocalExecutable"); - d->localExecFileName->setExpectedKind(PathChooser::File); - d->localExecFileName->setPromptDialogTitle(tr("Select Executable")); + d->symbolFileName = new PathChooser(this); + d->symbolFileName->setHistoryCompleter("LocalExecutable"); + d->symbolFileName->setExpectedKind(PathChooser::File); + 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->setHistoryCompleter("Debugger.StartupScript.History"); @@ -296,7 +300,7 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent) formLayout->addRow(tr("Kit:"), d->kitChooser); formLayout->addRow(d->forceLocalLabel, d->forceLocalCheckBox); 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); auto line = new QFrame(this); @@ -321,7 +325,7 @@ int AttachCoreDialog::exec() { connect(d->selectRemoteCoreButton, &QAbstractButton::clicked, this, &AttachCoreDialog::selectRemoteCoreFile); 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->forceLocalCheckBox, &QCheckBox::stateChanged, this, &AttachCoreDialog::changed); connect(d->kitChooser, &KitChooser::currentIndexChanged, this, &AttachCoreDialog::changed); @@ -337,8 +341,8 @@ int AttachCoreDialog::exec() d->localCoreFileName->setFocus(); else d->remoteCoreFileName->setFocus(); - } else if (!st.validLocalExecFilename) { - d->localExecFileName->setFocus(); + } else if (!st.validSymbolFilename) { + d->symbolFileName->setFocus(); } return QDialog::exec(); @@ -366,9 +370,9 @@ void AttachCoreDialog::coreFileChanged(const QString &core) Runnable debugger = DebuggerKitInformation::runnable(k); CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(debugger, core); if (!cinfo.foundExecutableName.isEmpty()) - d->localExecFileName->setFileName(FileName::fromString(cinfo.foundExecutableName)); - else if (!d->localExecFileName->isValid() && !cinfo.rawStringFromCore.isEmpty()) - d->localExecFileName->setFileName(FileName::fromString(cinfo.rawStringFromCore)); + d->symbolFileName->setFileName(FileName::fromString(cinfo.foundExecutableName)); + else if (!d->symbolFileName->isValid() && !cinfo.rawStringFromCore.isEmpty()) + d->symbolFileName->setFileName(FileName::fromString(cinfo.rawStringFromCore)); } changed(); } @@ -411,14 +415,14 @@ QString AttachCoreDialog::localCoreFile() const 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) diff --git a/src/plugins/debugger/loadcoredialog.h b/src/plugins/debugger/loadcoredialog.h index 84cfaf677e9..84ba46a4fd7 100644 --- a/src/plugins/debugger/loadcoredialog.h +++ b/src/plugins/debugger/loadcoredialog.h @@ -45,7 +45,7 @@ public: int exec() override; - QString localExecutableFile() const; + QString symbolFile() const; QString localCoreFile() const; QString remoteCoreFile() const; QString overrideStartScript() const; @@ -55,7 +55,7 @@ public: // For persistance. ProjectExplorer::Kit *kit() const; - void setLocalExecutableFile(const QString &executable); + void setSymbolFile(const QString &symbolFileName); void setLocalCoreFile(const QString &core); void setRemoteCoreFile(const QString &core); void setOverrideStartScript(const QString &scriptName);