2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2012-07-24 17:02:42 +02:00
|
|
|
|
|
|
|
|
#include "loadcoredialog.h"
|
|
|
|
|
|
2014-02-10 13:53:24 +01:00
|
|
|
#include "debuggerkitinformation.h"
|
2022-07-05 15:37:08 +02:00
|
|
|
#include "debuggertr.h"
|
2017-09-08 08:53:15 +02:00
|
|
|
#include "gdb/gdbengine.h"
|
2012-07-24 17:02:42 +02:00
|
|
|
|
2022-04-12 21:01:45 +02:00
|
|
|
#include <projectexplorer/devicesupport/devicefilesystemmodel.h>
|
2022-05-24 07:12:02 +02:00
|
|
|
#include <projectexplorer/devicesupport/filetransfer.h>
|
2022-04-12 21:01:45 +02:00
|
|
|
#include <projectexplorer/devicesupport/idevice.h>
|
2022-05-24 07:12:02 +02:00
|
|
|
#include <projectexplorer/kitchooser.h>
|
2022-06-22 15:43:33 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
|
2022-08-26 23:18:00 +02:00
|
|
|
#include <utils/layoutbuilder.h>
|
2012-07-24 17:02:42 +02:00
|
|
|
#include <utils/pathchooser.h>
|
2022-05-24 07:12:02 +02:00
|
|
|
#include <utils/processinterface.h>
|
2012-07-24 17:02:42 +02:00
|
|
|
#include <utils/qtcassert.h>
|
2017-01-19 16:44:22 +01:00
|
|
|
#include <utils/temporaryfile.h>
|
2012-07-24 17:02:42 +02:00
|
|
|
|
2012-10-22 11:14:18 +02:00
|
|
|
#include <QCheckBox>
|
2012-07-24 17:02:42 +02:00
|
|
|
#include <QDialogButtonBox>
|
|
|
|
|
#include <QFormLayout>
|
|
|
|
|
#include <QHeaderView>
|
2012-10-22 11:14:18 +02:00
|
|
|
#include <QLabel>
|
2012-07-24 17:02:42 +02:00
|
|
|
#include <QLineEdit>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
|
#include <QTextBrowser>
|
|
|
|
|
#include <QTreeView>
|
|
|
|
|
|
|
|
|
|
using namespace Core;
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
|
2022-07-05 15:37:08 +02:00
|
|
|
namespace Debugger::Internal {
|
2012-07-24 17:02:42 +02:00
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// SelectRemoteFileDialog
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class SelectRemoteFileDialog : public QDialog
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit SelectRemoteFileDialog(QWidget *parent);
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
void attachToDevice(Kit *k);
|
2021-09-27 15:52:05 +02:00
|
|
|
FilePath localFile() const { return m_localFile; }
|
|
|
|
|
FilePath remoteFile() const { return m_remoteFile; }
|
2012-07-24 17:02:42 +02:00
|
|
|
|
2015-02-05 12:26:16 +01:00
|
|
|
private:
|
2012-07-24 17:02:42 +02:00
|
|
|
void selectFile();
|
|
|
|
|
|
|
|
|
|
QSortFilterProxyModel m_model;
|
2022-03-25 14:31:28 +01:00
|
|
|
DeviceFileSystemModel m_fileSystemModel;
|
2012-07-24 17:02:42 +02:00
|
|
|
QTreeView *m_fileSystemView;
|
|
|
|
|
QTextBrowser *m_textBrowser;
|
|
|
|
|
QDialogButtonBox *m_buttonBox;
|
2021-09-27 15:52:05 +02:00
|
|
|
FilePath m_localFile;
|
|
|
|
|
FilePath m_remoteFile;
|
2022-05-24 07:12:02 +02:00
|
|
|
FileTransfer m_fileTransfer;
|
2012-07-24 17:02:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
SelectRemoteFileDialog::SelectRemoteFileDialog(QWidget *parent)
|
|
|
|
|
: QDialog(parent)
|
|
|
|
|
{
|
|
|
|
|
m_model.setSourceModel(&m_fileSystemModel);
|
|
|
|
|
|
|
|
|
|
m_fileSystemView = new QTreeView(this);
|
|
|
|
|
m_fileSystemView->setModel(&m_model);
|
|
|
|
|
m_fileSystemView->setSortingEnabled(true);
|
2012-10-10 20:15:27 +02:00
|
|
|
m_fileSystemView->sortByColumn(1, Qt::AscendingOrder);
|
2012-07-24 17:02:42 +02:00
|
|
|
m_fileSystemView->setUniformRowHeights(true);
|
|
|
|
|
m_fileSystemView->setSelectionMode(QAbstractItemView::SingleSelection);
|
|
|
|
|
m_fileSystemView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
|
|
|
m_fileSystemView->header()->setDefaultSectionSize(100);
|
|
|
|
|
m_fileSystemView->header()->setStretchLastSection(true);
|
|
|
|
|
|
|
|
|
|
m_textBrowser = new QTextBrowser(this);
|
2022-03-25 14:31:28 +01:00
|
|
|
m_textBrowser->setReadOnly(true);
|
2012-07-24 17:02:42 +02:00
|
|
|
|
|
|
|
|
m_buttonBox = new QDialogButtonBox(this);
|
|
|
|
|
m_buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
|
|
|
|
m_buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
|
|
|
|
m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
|
|
|
|
|
2018-07-23 22:28:49 +02:00
|
|
|
auto layout = new QVBoxLayout(this);
|
2012-07-24 17:02:42 +02:00
|
|
|
layout->addWidget(m_fileSystemView);
|
|
|
|
|
layout->addWidget(m_textBrowser);
|
|
|
|
|
layout->addWidget(m_buttonBox);
|
|
|
|
|
|
2022-03-25 14:31:28 +01:00
|
|
|
connect(m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
|
|
|
|
connect(m_buttonBox, &QDialogButtonBox::accepted, this, &SelectRemoteFileDialog::selectFile);
|
2012-07-24 17:02:42 +02:00
|
|
|
|
2022-05-24 07:12:02 +02:00
|
|
|
connect(&m_fileTransfer, &FileTransfer::done, this, [this](const ProcessResultData &result) {
|
|
|
|
|
const bool success = result.m_error == QProcess::UnknownError
|
|
|
|
|
&& result.m_exitStatus == QProcess::NormalExit
|
|
|
|
|
&& result.m_exitCode == 0;
|
|
|
|
|
if (success) {
|
2022-07-05 15:37:08 +02:00
|
|
|
m_textBrowser->append(Tr::tr("Download of remote file succeeded."));
|
2022-05-24 07:12:02 +02:00
|
|
|
accept();
|
|
|
|
|
} else {
|
2022-07-05 15:37:08 +02:00
|
|
|
m_textBrowser->append(Tr::tr("Download of remote file failed: %1")
|
2022-05-24 07:12:02 +02:00
|
|
|
.arg(result.m_errorString));
|
|
|
|
|
m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
|
|
|
|
m_fileSystemView->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
});
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
void SelectRemoteFileDialog::attachToDevice(Kit *k)
|
2012-07-24 17:02:42 +02:00
|
|
|
{
|
|
|
|
|
m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
2012-09-03 18:31:44 +02:00
|
|
|
QTC_ASSERT(k, return);
|
2019-02-06 12:50:51 +01:00
|
|
|
IDevice::ConstPtr device = DeviceKitAspect::device(k);
|
2012-07-24 17:02:42 +02:00
|
|
|
QTC_ASSERT(device, return);
|
2022-03-25 14:31:28 +01:00
|
|
|
m_fileSystemModel.setDevice(device);
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SelectRemoteFileDialog::selectFile()
|
|
|
|
|
{
|
2012-10-10 00:18:12 +02:00
|
|
|
QModelIndex idx = m_model.mapToSource(m_fileSystemView->currentIndex());
|
|
|
|
|
if (!idx.isValid())
|
2012-07-24 17:02:42 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
|
|
|
|
m_fileSystemView->setEnabled(false);
|
|
|
|
|
|
|
|
|
|
{
|
2022-05-24 07:12:02 +02:00
|
|
|
TemporaryFile localFile("remotecore-XXXXXX");
|
2012-07-24 17:02:42 +02:00
|
|
|
localFile.open();
|
2021-09-27 15:52:05 +02:00
|
|
|
m_localFile = FilePath::fromString(localFile.fileName());
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
idx = idx.sibling(idx.row(), 1);
|
2022-03-25 14:31:28 +01:00
|
|
|
m_remoteFile = FilePath::fromVariant(m_fileSystemModel.data(idx, DeviceFileSystemModel::PathRole));
|
|
|
|
|
|
2022-05-24 07:12:02 +02:00
|
|
|
m_fileTransfer.setFilesToTransfer({{m_remoteFile, m_localFile}});
|
|
|
|
|
m_fileTransfer.start();
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// AttachCoreDialog
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class AttachCoreDialogPrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
2012-09-03 18:31:44 +02:00
|
|
|
KitChooser *kitChooser;
|
2012-07-24 17:02:42 +02:00
|
|
|
|
2012-10-22 11:14:18 +02:00
|
|
|
QCheckBox *forceLocalCheckBox;
|
|
|
|
|
QLabel *forceLocalLabel;
|
2019-01-31 09:28:10 +01:00
|
|
|
PathChooser *symbolFileName;
|
2012-07-24 17:02:42 +02:00
|
|
|
PathChooser *localCoreFileName;
|
2022-06-29 15:39:04 +02:00
|
|
|
PathChooser *remoteCoreFileName;
|
2012-07-24 17:02:42 +02:00
|
|
|
QPushButton *selectRemoteCoreButton;
|
|
|
|
|
|
|
|
|
|
PathChooser *overrideStartScriptFileName;
|
2020-06-29 18:14:20 +03:00
|
|
|
PathChooser *sysRootDirectory;
|
2012-07-24 17:02:42 +02:00
|
|
|
|
|
|
|
|
QDialogButtonBox *buttonBox;
|
2014-07-21 14:39:54 +02:00
|
|
|
|
|
|
|
|
struct State
|
|
|
|
|
{
|
|
|
|
|
bool isValid() const
|
|
|
|
|
{
|
2019-01-31 09:28:10 +01:00
|
|
|
return validKit && validSymbolFilename && validCoreFilename;
|
2014-07-21 14:39:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool validKit;
|
2019-01-31 09:28:10 +01:00
|
|
|
bool validSymbolFilename;
|
2014-07-21 14:39:54 +02:00
|
|
|
bool validCoreFilename;
|
|
|
|
|
bool localCoreFile;
|
|
|
|
|
bool localKit;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
State getDialogState(const AttachCoreDialog &p) const
|
|
|
|
|
{
|
|
|
|
|
State st;
|
|
|
|
|
st.localCoreFile = p.useLocalCoreFile();
|
2018-07-23 22:28:49 +02:00
|
|
|
st.validKit = (kitChooser->currentKit() != nullptr);
|
2019-01-31 09:28:10 +01:00
|
|
|
st.validSymbolFilename = symbolFileName->isValid();
|
2014-07-21 14:39:54 +02:00
|
|
|
|
|
|
|
|
if (st.localCoreFile)
|
|
|
|
|
st.validCoreFilename = localCoreFileName->isValid();
|
|
|
|
|
else
|
|
|
|
|
st.validCoreFilename = !p.remoteCoreFile().isEmpty();
|
|
|
|
|
|
|
|
|
|
st.localKit = p.isLocalKit();
|
|
|
|
|
return st;
|
|
|
|
|
}
|
2012-07-24 17:02:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
AttachCoreDialog::AttachCoreDialog(QWidget *parent)
|
|
|
|
|
: QDialog(parent), d(new AttachCoreDialogPrivate)
|
|
|
|
|
{
|
2022-07-05 15:37:08 +02:00
|
|
|
setWindowTitle(Tr::tr("Load Core File"));
|
2012-07-24 17:02:42 +02:00
|
|
|
|
2014-07-16 13:57:22 +02:00
|
|
|
d->buttonBox = new QDialogButtonBox(this);
|
|
|
|
|
d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
|
|
|
|
d->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
|
|
|
|
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
|
|
|
|
|
2019-06-11 10:27:16 +02:00
|
|
|
d->kitChooser = new KitChooser(this);
|
|
|
|
|
d->kitChooser->setShowIcons(true);
|
2012-09-05 10:55:05 +02:00
|
|
|
d->kitChooser->populate();
|
2012-07-24 17:02:42 +02:00
|
|
|
|
2012-10-22 11:14:18 +02:00
|
|
|
d->forceLocalCheckBox = new QCheckBox(this);
|
|
|
|
|
d->forceLocalLabel = new QLabel(this);
|
2022-07-05 15:37:08 +02:00
|
|
|
d->forceLocalLabel->setText(Tr::tr("Use local core file:"));
|
2012-10-22 11:14:18 +02:00
|
|
|
d->forceLocalLabel->setBuddy(d->forceLocalCheckBox);
|
2012-07-24 17:02:42 +02:00
|
|
|
|
2022-06-29 15:39:04 +02:00
|
|
|
d->remoteCoreFileName = new PathChooser(this);
|
2015-01-14 14:58:24 +01:00
|
|
|
d->selectRemoteCoreButton = new QPushButton(PathChooser::browseButtonLabel(), this);
|
2012-07-24 17:02:42 +02:00
|
|
|
|
2013-03-18 14:19:31 +01:00
|
|
|
d->localCoreFileName = new PathChooser(this);
|
2018-10-07 22:38:47 +03:00
|
|
|
d->localCoreFileName->setHistoryCompleter("Debugger.CoreFile.History");
|
2013-03-18 14:19:31 +01:00
|
|
|
d->localCoreFileName->setExpectedKind(PathChooser::File);
|
2022-07-05 15:37:08 +02:00
|
|
|
d->localCoreFileName->setPromptDialogTitle(Tr::tr("Select Core File"));
|
2013-03-18 14:19:31 +01:00
|
|
|
|
2019-01-31 09:28:10 +01:00
|
|
|
d->symbolFileName = new PathChooser(this);
|
|
|
|
|
d->symbolFileName->setHistoryCompleter("LocalExecutable");
|
|
|
|
|
d->symbolFileName->setExpectedKind(PathChooser::File);
|
2022-07-05 15:37:08 +02:00
|
|
|
d->symbolFileName->setPromptDialogTitle(Tr::tr("Select Executable or Symbol File"));
|
2019-01-31 09:28:10 +01:00
|
|
|
d->symbolFileName->setToolTip(
|
2022-07-05 15:37:08 +02:00
|
|
|
Tr::tr("Select a file containing debug information corresponding to the core file. "
|
2019-01-31 09:28:10 +01:00
|
|
|
"Typically, this is the executable or a *.debug file if the debug "
|
|
|
|
|
"information is stored separately from the executable."));
|
2014-07-16 13:57:22 +02:00
|
|
|
|
2012-07-24 17:02:42 +02:00
|
|
|
d->overrideStartScriptFileName = new PathChooser(this);
|
2018-10-07 22:38:47 +03:00
|
|
|
d->overrideStartScriptFileName->setHistoryCompleter("Debugger.StartupScript.History");
|
2012-07-24 17:02:42 +02:00
|
|
|
d->overrideStartScriptFileName->setExpectedKind(PathChooser::File);
|
2022-07-05 15:37:08 +02:00
|
|
|
d->overrideStartScriptFileName->setPromptDialogTitle(Tr::tr("Select Startup Script"));
|
2012-07-24 17:02:42 +02:00
|
|
|
|
2020-06-29 18:14:20 +03:00
|
|
|
d->sysRootDirectory = new PathChooser(this);
|
|
|
|
|
d->sysRootDirectory->setHistoryCompleter("Debugger.SysRoot.History");
|
|
|
|
|
d->sysRootDirectory->setExpectedKind(PathChooser::Directory);
|
2022-07-05 15:37:08 +02:00
|
|
|
d->sysRootDirectory->setPromptDialogTitle(Tr::tr("Select SysRoot Directory"));
|
|
|
|
|
d->sysRootDirectory->setToolTip(Tr::tr(
|
2020-06-29 18:14:20 +03:00
|
|
|
"This option can be used to override the kit's SysRoot setting"));
|
|
|
|
|
|
2015-02-26 17:43:41 +01:00
|
|
|
auto coreLayout = new QHBoxLayout;
|
2012-07-24 17:02:42 +02:00
|
|
|
coreLayout->addWidget(d->localCoreFileName);
|
|
|
|
|
coreLayout->addWidget(d->remoteCoreFileName);
|
|
|
|
|
coreLayout->addWidget(d->selectRemoteCoreButton);
|
|
|
|
|
|
2015-02-26 17:43:41 +01:00
|
|
|
auto formLayout = new QFormLayout;
|
2012-07-24 17:02:42 +02:00
|
|
|
formLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
formLayout->setHorizontalSpacing(6);
|
|
|
|
|
formLayout->setVerticalSpacing(6);
|
2022-07-05 15:37:08 +02:00
|
|
|
formLayout->addRow(Tr::tr("Kit:"), d->kitChooser);
|
2012-10-22 11:14:18 +02:00
|
|
|
formLayout->addRow(d->forceLocalLabel, d->forceLocalCheckBox);
|
2022-07-05 15:37:08 +02:00
|
|
|
formLayout->addRow(Tr::tr("Core file:"), coreLayout);
|
|
|
|
|
formLayout->addRow(Tr::tr("&Executable or symbol file:"), d->symbolFileName);
|
|
|
|
|
formLayout->addRow(Tr::tr("Override &start script:"), d->overrideStartScriptFileName);
|
|
|
|
|
formLayout->addRow(Tr::tr("Override S&ysRoot:"), d->sysRootDirectory);
|
2012-07-24 17:02:42 +02:00
|
|
|
formLayout->addRow(d->buttonBox);
|
|
|
|
|
|
2015-02-26 17:43:41 +01:00
|
|
|
auto vboxLayout = new QVBoxLayout(this);
|
2012-07-24 17:02:42 +02:00
|
|
|
vboxLayout->addLayout(formLayout);
|
2012-08-14 10:16:53 +02:00
|
|
|
vboxLayout->addStretch();
|
2022-08-26 23:18:00 +02:00
|
|
|
vboxLayout->addWidget(Layouting::createHr());
|
2012-07-24 17:02:42 +02:00
|
|
|
vboxLayout->addWidget(d->buttonBox);
|
2012-10-22 11:14:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AttachCoreDialog::~AttachCoreDialog()
|
|
|
|
|
{
|
|
|
|
|
delete d;
|
|
|
|
|
}
|
2012-07-24 17:02:42 +02:00
|
|
|
|
2012-10-22 11:14:18 +02:00
|
|
|
int AttachCoreDialog::exec()
|
|
|
|
|
{
|
2015-02-05 12:26:16 +01:00
|
|
|
connect(d->selectRemoteCoreButton, &QAbstractButton::clicked, this, &AttachCoreDialog::selectRemoteCoreFile);
|
2022-09-02 11:49:36 +02:00
|
|
|
connect(d->remoteCoreFileName, &PathChooser::textChanged, this, [this] {
|
|
|
|
|
coreFileChanged(d->remoteCoreFileName->rawFilePath());
|
|
|
|
|
});
|
|
|
|
|
connect(d->symbolFileName, &PathChooser::textChanged, this, &AttachCoreDialog::changed);
|
|
|
|
|
connect(d->localCoreFileName, &PathChooser::textChanged, this, [this] {
|
|
|
|
|
coreFileChanged(d->localCoreFileName->rawFilePath());
|
|
|
|
|
});
|
2015-02-05 12:26:16 +01:00
|
|
|
connect(d->forceLocalCheckBox, &QCheckBox::stateChanged, this, &AttachCoreDialog::changed);
|
|
|
|
|
connect(d->kitChooser, &KitChooser::currentIndexChanged, this, &AttachCoreDialog::changed);
|
|
|
|
|
connect(d->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
|
|
|
|
connect(d->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
2012-10-10 00:08:56 +02:00
|
|
|
changed();
|
2012-07-24 17:02:42 +02:00
|
|
|
|
2014-07-21 14:39:54 +02:00
|
|
|
AttachCoreDialogPrivate::State st = d->getDialogState(*this);
|
|
|
|
|
if (!st.validKit) {
|
|
|
|
|
d->kitChooser->setFocus();
|
|
|
|
|
} else if (!st.validCoreFilename) {
|
|
|
|
|
if (st.localCoreFile)
|
|
|
|
|
d->localCoreFileName->setFocus();
|
|
|
|
|
else
|
|
|
|
|
d->remoteCoreFileName->setFocus();
|
2019-01-31 09:28:10 +01:00
|
|
|
} else if (!st.validSymbolFilename) {
|
|
|
|
|
d->symbolFileName->setFocus();
|
2014-07-21 14:39:54 +02:00
|
|
|
}
|
|
|
|
|
|
2012-10-22 11:14:18 +02:00
|
|
|
return QDialog::exec();
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
2012-10-22 11:14:18 +02:00
|
|
|
bool AttachCoreDialog::isLocalKit() const
|
2012-07-24 17:02:42 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
Kit *k = d->kitChooser->currentKit();
|
|
|
|
|
QTC_ASSERT(k, return false);
|
2019-02-06 12:50:51 +01:00
|
|
|
IDevice::ConstPtr device = DeviceKitAspect::device(k);
|
2012-07-24 17:02:42 +02:00
|
|
|
QTC_ASSERT(device, return false);
|
2012-10-22 11:14:18 +02:00
|
|
|
return device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AttachCoreDialog::useLocalCoreFile() const
|
|
|
|
|
{
|
|
|
|
|
return isLocalKit() || d->forceLocalCheckBox->isChecked();
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
2022-06-29 15:39:04 +02:00
|
|
|
void AttachCoreDialog::coreFileChanged(const FilePath &coreFile)
|
2014-02-10 13:53:24 +01:00
|
|
|
{
|
2021-09-27 15:52:05 +02:00
|
|
|
if (coreFile.osType() != OsType::OsTypeWindows && coreFile.exists()) {
|
2014-07-14 15:04:47 +03:00
|
|
|
Kit *k = d->kitChooser->currentKit();
|
|
|
|
|
QTC_ASSERT(k, return);
|
2019-02-06 12:50:51 +01:00
|
|
|
Runnable debugger = DebuggerKitAspect::runnable(k);
|
2021-09-27 15:52:05 +02:00
|
|
|
CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(debugger, coreFile);
|
2014-07-24 11:56:40 +02:00
|
|
|
if (!cinfo.foundExecutableName.isEmpty())
|
2021-08-11 08:36:15 +02:00
|
|
|
d->symbolFileName->setFilePath(cinfo.foundExecutableName);
|
2019-01-31 09:28:10 +01:00
|
|
|
else if (!d->symbolFileName->isValid() && !cinfo.rawStringFromCore.isEmpty())
|
2020-04-09 11:05:50 +02:00
|
|
|
d->symbolFileName->setFilePath(FilePath::fromString(cinfo.rawStringFromCore));
|
2014-07-14 15:04:47 +03:00
|
|
|
}
|
2014-02-10 13:53:24 +01:00
|
|
|
changed();
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-24 17:02:42 +02:00
|
|
|
void AttachCoreDialog::changed()
|
|
|
|
|
{
|
2014-07-21 14:39:54 +02:00
|
|
|
AttachCoreDialogPrivate::State st = d->getDialogState(*this);
|
2012-07-24 17:02:42 +02:00
|
|
|
|
2014-07-21 14:39:54 +02:00
|
|
|
d->forceLocalLabel->setVisible(!st.localKit);
|
|
|
|
|
d->forceLocalCheckBox->setVisible(!st.localKit);
|
|
|
|
|
if (st.localCoreFile) {
|
2012-07-24 17:02:42 +02:00
|
|
|
d->localCoreFileName->setVisible(true);
|
|
|
|
|
d->remoteCoreFileName->setVisible(false);
|
|
|
|
|
d->selectRemoteCoreButton->setVisible(false);
|
|
|
|
|
} else {
|
2012-10-22 11:14:18 +02:00
|
|
|
d->localCoreFileName->setVisible(false);
|
2012-07-24 17:02:42 +02:00
|
|
|
d->remoteCoreFileName->setVisible(true);
|
|
|
|
|
d->selectRemoteCoreButton->setVisible(true);
|
|
|
|
|
}
|
2012-10-22 11:14:18 +02:00
|
|
|
|
2014-07-21 14:39:54 +02:00
|
|
|
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(st.isValid());
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AttachCoreDialog::selectRemoteCoreFile()
|
|
|
|
|
{
|
|
|
|
|
changed();
|
2012-10-22 11:14:18 +02:00
|
|
|
QTC_ASSERT(!isLocalKit(), return);
|
2012-07-24 17:02:42 +02:00
|
|
|
SelectRemoteFileDialog dlg(this);
|
2022-07-05 15:37:08 +02:00
|
|
|
dlg.setWindowTitle(Tr::tr("Select Remote Core File"));
|
2012-09-03 18:31:44 +02:00
|
|
|
dlg.attachToDevice(d->kitChooser->currentKit());
|
2012-07-24 17:02:42 +02:00
|
|
|
if (dlg.exec() == QDialog::Rejected)
|
|
|
|
|
return;
|
2021-09-27 15:52:05 +02:00
|
|
|
d->localCoreFileName->setFilePath(dlg.localFile());
|
2022-06-29 15:39:04 +02:00
|
|
|
d->remoteCoreFileName->setFilePath(dlg.remoteFile());
|
2012-07-24 17:02:42 +02:00
|
|
|
changed();
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-27 15:52:05 +02:00
|
|
|
FilePath AttachCoreDialog::localCoreFile() const
|
2012-07-24 17:02:42 +02:00
|
|
|
{
|
2021-09-27 15:52:05 +02:00
|
|
|
return d->localCoreFileName->filePath();
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
2019-06-20 17:19:12 +02:00
|
|
|
FilePath AttachCoreDialog::symbolFile() const
|
2012-07-24 17:02:42 +02:00
|
|
|
{
|
2020-04-09 11:05:50 +02:00
|
|
|
return d->symbolFileName->filePath();
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-27 15:52:05 +02:00
|
|
|
void AttachCoreDialog::setSymbolFile(const FilePath &symbolFilePath)
|
2012-07-24 17:02:42 +02:00
|
|
|
{
|
2021-09-27 15:52:05 +02:00
|
|
|
d->symbolFileName->setFilePath(symbolFilePath);
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-27 15:52:05 +02:00
|
|
|
void AttachCoreDialog::setLocalCoreFile(const FilePath &coreFilePath)
|
2012-07-24 17:02:42 +02:00
|
|
|
{
|
2021-09-27 15:52:05 +02:00
|
|
|
d->localCoreFileName->setFilePath(coreFilePath);
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-27 15:52:05 +02:00
|
|
|
void AttachCoreDialog::setRemoteCoreFile(const FilePath &coreFilePath)
|
2012-07-24 17:02:42 +02:00
|
|
|
{
|
2022-06-29 15:39:04 +02:00
|
|
|
d->remoteCoreFileName->setFilePath(coreFilePath);
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-27 15:52:05 +02:00
|
|
|
FilePath AttachCoreDialog::remoteCoreFile() const
|
2012-07-24 17:02:42 +02:00
|
|
|
{
|
2022-06-29 15:39:04 +02:00
|
|
|
return d->remoteCoreFileName->filePath();
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
2015-02-03 23:58:49 +02:00
|
|
|
void AttachCoreDialog::setKitId(Id id)
|
2012-07-24 17:02:42 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
d->kitChooser->setCurrentKitId(id);
|
2012-10-22 11:14:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AttachCoreDialog::setForceLocalCoreFile(bool on)
|
|
|
|
|
{
|
|
|
|
|
d->forceLocalCheckBox->setChecked(on);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AttachCoreDialog::forcesLocalCoreFile() const
|
|
|
|
|
{
|
|
|
|
|
return d->forceLocalCheckBox->isChecked();
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
Kit *AttachCoreDialog::kit() const
|
2012-07-24 17:02:42 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
return d->kitChooser->currentKit();
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-27 15:52:05 +02:00
|
|
|
FilePath AttachCoreDialog::overrideStartScript() const
|
2012-07-24 17:02:42 +02:00
|
|
|
{
|
2021-09-27 15:52:05 +02:00
|
|
|
return d->overrideStartScriptFileName->filePath();
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-27 15:52:05 +02:00
|
|
|
void AttachCoreDialog::setOverrideStartScript(const FilePath &scriptName)
|
2012-07-24 17:02:42 +02:00
|
|
|
{
|
2021-09-27 15:52:05 +02:00
|
|
|
d->overrideStartScriptFileName->setFilePath(scriptName);
|
2012-07-24 17:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
2020-06-29 18:14:20 +03:00
|
|
|
FilePath AttachCoreDialog::sysRoot() const
|
|
|
|
|
{
|
|
|
|
|
return d->sysRootDirectory->filePath();
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-27 15:52:05 +02:00
|
|
|
void AttachCoreDialog::setSysRoot(const FilePath &sysRoot)
|
2020-06-29 18:14:20 +03:00
|
|
|
{
|
2021-09-27 15:52:05 +02:00
|
|
|
d->sysRootDirectory->setFilePath(sysRoot);
|
2020-06-29 18:14:20 +03:00
|
|
|
}
|
|
|
|
|
|
2022-07-05 15:37:08 +02:00
|
|
|
} // Debugger::Internal
|