forked from qt-creator/qt-creator
Docker: Add option to enable flags needed for lldb
Change-Id: Ic0ae6d2b8dcfee3df21c22124c7fc2bddbdb61a2 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -595,6 +595,9 @@ bool DockerDevicePrivate::createContainer()
|
|||||||
if (!m_data.keepEntryPoint)
|
if (!m_data.keepEntryPoint)
|
||||||
dockerCreate.addArgs({"--entrypoint", "/bin/sh"});
|
dockerCreate.addArgs({"--entrypoint", "/bin/sh"});
|
||||||
|
|
||||||
|
if (m_data.enableLldbFlags)
|
||||||
|
dockerCreate.addArgs({"--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"});
|
||||||
|
|
||||||
dockerCreate.addArg(m_data.repoAndTag());
|
dockerCreate.addArg(m_data.repoAndTag());
|
||||||
|
|
||||||
qCDebug(dockerDeviceLog).noquote() << "RUNNING: " << dockerCreate.toUserOutput();
|
qCDebug(dockerDeviceLog).noquote() << "RUNNING: " << dockerCreate.toUserOutput();
|
||||||
@@ -674,6 +677,7 @@ const char DockerDeviceDataSizeKey[] = "DockerDeviceDataSize";
|
|||||||
const char DockerDeviceUseOutsideUser[] = "DockerDeviceUseUidGid";
|
const char DockerDeviceUseOutsideUser[] = "DockerDeviceUseUidGid";
|
||||||
const char DockerDeviceMappedPaths[] = "DockerDeviceMappedPaths";
|
const char DockerDeviceMappedPaths[] = "DockerDeviceMappedPaths";
|
||||||
const char DockerDeviceKeepEntryPoint[] = "DockerDeviceKeepEntryPoint";
|
const char DockerDeviceKeepEntryPoint[] = "DockerDeviceKeepEntryPoint";
|
||||||
|
const char DockerDeviceEnableLldbFlags[] = "DockerDeviceEnableLldbFlags";
|
||||||
|
|
||||||
void DockerDevice::fromMap(const QVariantMap &map)
|
void DockerDevice::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
@@ -687,6 +691,7 @@ void DockerDevice::fromMap(const QVariantMap &map)
|
|||||||
data.useLocalUidGid = map.value(DockerDeviceUseOutsideUser, HostOsInfo::isLinuxHost()).toBool();
|
data.useLocalUidGid = map.value(DockerDeviceUseOutsideUser, HostOsInfo::isLinuxHost()).toBool();
|
||||||
data.mounts = map.value(DockerDeviceMappedPaths).toStringList();
|
data.mounts = map.value(DockerDeviceMappedPaths).toStringList();
|
||||||
data.keepEntryPoint = map.value(DockerDeviceKeepEntryPoint).toBool();
|
data.keepEntryPoint = map.value(DockerDeviceKeepEntryPoint).toBool();
|
||||||
|
data.enableLldbFlags = map.value(DockerDeviceEnableLldbFlags).toBool();
|
||||||
d->setData(data);
|
d->setData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -702,6 +707,7 @@ QVariantMap DockerDevice::toMap() const
|
|||||||
map.insert(DockerDeviceUseOutsideUser, data.useLocalUidGid);
|
map.insert(DockerDeviceUseOutsideUser, data.useLocalUidGid);
|
||||||
map.insert(DockerDeviceMappedPaths, data.mounts);
|
map.insert(DockerDeviceMappedPaths, data.mounts);
|
||||||
map.insert(DockerDeviceKeepEntryPoint, data.keepEntryPoint);
|
map.insert(DockerDeviceKeepEntryPoint, data.keepEntryPoint);
|
||||||
|
map.insert(DockerDeviceEnableLldbFlags, data.enableLldbFlags);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,7 +21,8 @@ public:
|
|||||||
{
|
{
|
||||||
return imageId == other.imageId && repo == other.repo && tag == other.tag
|
return imageId == other.imageId && repo == other.repo && tag == other.tag
|
||||||
&& useLocalUidGid == other.useLocalUidGid && mounts == other.mounts
|
&& useLocalUidGid == other.useLocalUidGid && mounts == other.mounts
|
||||||
&& keepEntryPoint == other.keepEntryPoint;
|
&& keepEntryPoint == other.keepEntryPoint
|
||||||
|
&& enableLldbFlags == other.enableLldbFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const DockerDeviceData &other) const { return !(*this == other); }
|
bool operator!=(const DockerDeviceData &other) const { return !(*this == other); }
|
||||||
@@ -45,6 +46,7 @@ public:
|
|||||||
bool useLocalUidGid = true;
|
bool useLocalUidGid = true;
|
||||||
QStringList mounts = {Core::DocumentManager::projectsDirectory().toString()};
|
QStringList mounts = {Core::DocumentManager::projectsDirectory().toString()};
|
||||||
bool keepEntryPoint = false;
|
bool keepEntryPoint = false;
|
||||||
|
bool enableLldbFlags = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DockerDevice : public ProjectExplorer::IDevice
|
class DockerDevice : public ProjectExplorer::IDevice
|
||||||
|
@@ -77,6 +77,18 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
|
|||||||
dockerDevice->setData(m_data);
|
dockerDevice->setData(m_data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
m_enableLldbFlags = new QCheckBox(Tr::tr("Enable flags needed for LLDB"));
|
||||||
|
m_enableLldbFlags->setToolTip(Tr::tr("Adds the following flags to the container: "
|
||||||
|
"--cap-add=SYS_PTRACE --security-opt seccomp=unconfined, "
|
||||||
|
"this is necessary to allow lldb to run"));
|
||||||
|
m_enableLldbFlags->setChecked(m_data.enableLldbFlags);
|
||||||
|
m_enableLldbFlags->setEnabled(true);
|
||||||
|
|
||||||
|
connect(m_enableLldbFlags, &QCheckBox::toggled, this, [this, dockerDevice](bool on) {
|
||||||
|
m_data.enableLldbFlags = on;
|
||||||
|
dockerDevice->setData(m_data);
|
||||||
|
});
|
||||||
|
|
||||||
m_runAsOutsideUser = new QCheckBox(Tr::tr("Run as outside user"));
|
m_runAsOutsideUser = new QCheckBox(Tr::tr("Run as outside user"));
|
||||||
m_runAsOutsideUser->setToolTip(Tr::tr("Uses user ID and group ID of the user running Qt Creator "
|
m_runAsOutsideUser->setToolTip(Tr::tr("Uses user ID and group ID of the user running Qt Creator "
|
||||||
"in the docker container."));
|
"in the docker container."));
|
||||||
@@ -172,6 +184,7 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
|
|||||||
|
|
||||||
using namespace Layouting;
|
using namespace Layouting;
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
Form {
|
Form {
|
||||||
repoLabel, m_repoLineEdit, br,
|
repoLabel, m_repoLineEdit, br,
|
||||||
tagLabel, m_tagLineEdit, br,
|
tagLabel, m_tagLineEdit, br,
|
||||||
@@ -179,6 +192,7 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
|
|||||||
daemonStateLabel, m_daemonReset, m_daemonState, br,
|
daemonStateLabel, m_daemonReset, m_daemonState, br,
|
||||||
m_runAsOutsideUser, br,
|
m_runAsOutsideUser, br,
|
||||||
m_keepEntryPoint, br,
|
m_keepEntryPoint, br,
|
||||||
|
m_enableLldbFlags, br,
|
||||||
Column {
|
Column {
|
||||||
pathListLabel,
|
pathListLabel,
|
||||||
m_pathsListEdit,
|
m_pathsListEdit,
|
||||||
@@ -200,6 +214,7 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
|
|||||||
logView
|
logView
|
||||||
}
|
}
|
||||||
}.attachTo(this, WithoutMargins);
|
}.attachTo(this, WithoutMargins);
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
searchDirsLineEdit->setVisible(false);
|
searchDirsLineEdit->setVisible(false);
|
||||||
auto updateDirectoriesLineEdit = [searchDirsLineEdit](int index) {
|
auto updateDirectoriesLineEdit = [searchDirsLineEdit](int index) {
|
||||||
|
@@ -37,6 +37,8 @@ private:
|
|||||||
QLabel *m_daemonState;
|
QLabel *m_daemonState;
|
||||||
QCheckBox *m_runAsOutsideUser;
|
QCheckBox *m_runAsOutsideUser;
|
||||||
QCheckBox *m_keepEntryPoint;
|
QCheckBox *m_keepEntryPoint;
|
||||||
|
QCheckBox *m_enableLldbFlags;
|
||||||
|
|
||||||
Utils::PathListEditor *m_pathsListEdit;
|
Utils::PathListEditor *m_pathsListEdit;
|
||||||
KitDetector m_kitItemDetector;
|
KitDetector m_kitItemDetector;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user