forked from qt-creator/qt-creator
Debugger: Support sysroot override
Sometimes the same toolchain can be used with different versions of sysroots. Support this in command-line and dialogs. Change-Id: Id49f8e8c50f4856e979eecbbdebc680b57dc69b2 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
b60ab85c13
commit
8951ddfd62
@@ -22,15 +22,15 @@
|
|||||||
\"Description\" : \"Attach to local process\"
|
\"Description\" : \"Attach to local process\"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
\"Name\" : \"-debug <executable>[,kit=<kit>][,terminal={0,1}]\",
|
\"Name\" : \"-debug <executable>[,kit=<kit>][,terminal={0,1}][,sysroot=<sysroot>]\",
|
||||||
\"Description\" : \"Start and debug executable\"
|
\"Description\" : \"Start and debug executable\"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
\"Name\" : \"-debug [executable,]core=<corefile>[,kit=<kit>]\",
|
\"Name\" : \"-debug [executable,]core=<corefile>[,kit=<kit>][,sysroot=<sysroot>]\",
|
||||||
\"Description\" : \"Attach to core file\"
|
\"Description\" : \"Attach to core file\"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
\"Name\" : \"-debug <executable>,server=<server:port>[,kit=<kit>]\",
|
\"Name\" : \"-debug <executable>,server=<server:port>[,kit=<kit>][,sysroot=<sysroot>]\",
|
||||||
\"Description\" : \"Attach to remote debug server\"
|
\"Description\" : \"Attach to remote debug server\"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ public:
|
|||||||
PathChooser *debuginfoPathChooser;
|
PathChooser *debuginfoPathChooser;
|
||||||
QLabel *serverStartScriptLabel;
|
QLabel *serverStartScriptLabel;
|
||||||
PathChooser *serverStartScriptPathChooser;
|
PathChooser *serverStartScriptPathChooser;
|
||||||
|
QLabel *sysRootLabel;
|
||||||
|
PathChooser *sysRootPathChooser;
|
||||||
QLabel *serverInitCommandsLabel;
|
QLabel *serverInitCommandsLabel;
|
||||||
QPlainTextEdit *serverInitCommandsTextEdit;
|
QPlainTextEdit *serverInitCommandsTextEdit;
|
||||||
QLabel *serverResetCommandsLabel;
|
QLabel *serverResetCommandsLabel;
|
||||||
@@ -126,6 +128,7 @@ public:
|
|||||||
bool breakAtMain = false;
|
bool breakAtMain = false;
|
||||||
bool runInTerminal = false;
|
bool runInTerminal = false;
|
||||||
FilePath serverStartScript;
|
FilePath serverStartScript;
|
||||||
|
FilePath sysRoot;
|
||||||
QString serverInitCommands;
|
QString serverInitCommands;
|
||||||
QString serverResetCommands;
|
QString serverResetCommands;
|
||||||
QString debugInfoLocation;
|
QString debugInfoLocation;
|
||||||
@@ -140,6 +143,7 @@ bool StartApplicationParameters::equals(const StartApplicationParameters &rhs) c
|
|||||||
&& breakAtMain == rhs.breakAtMain
|
&& breakAtMain == rhs.breakAtMain
|
||||||
&& runInTerminal == rhs.runInTerminal
|
&& runInTerminal == rhs.runInTerminal
|
||||||
&& serverStartScript == rhs.serverStartScript
|
&& serverStartScript == rhs.serverStartScript
|
||||||
|
&& sysRoot == rhs.sysRoot
|
||||||
&& serverInitCommands == rhs.serverInitCommands
|
&& serverInitCommands == rhs.serverInitCommands
|
||||||
&& serverResetCommands == rhs.serverResetCommands
|
&& serverResetCommands == rhs.serverResetCommands
|
||||||
&& kitId == rhs.kitId
|
&& kitId == rhs.kitId
|
||||||
@@ -181,6 +185,7 @@ void StartApplicationParameters::toSettings(QSettings *settings) const
|
|||||||
settings->setValue("LastServerInitCommands", serverInitCommands);
|
settings->setValue("LastServerInitCommands", serverInitCommands);
|
||||||
settings->setValue("LastServerResetCommands", serverResetCommands);
|
settings->setValue("LastServerResetCommands", serverResetCommands);
|
||||||
settings->setValue("LastDebugInfoLocation", debugInfoLocation);
|
settings->setValue("LastDebugInfoLocation", debugInfoLocation);
|
||||||
|
settings->setValue("LastSysRoot", sysRoot.toVariant());
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartApplicationParameters::fromSettings(const QSettings *settings)
|
void StartApplicationParameters::fromSettings(const QSettings *settings)
|
||||||
@@ -197,6 +202,7 @@ void StartApplicationParameters::fromSettings(const QSettings *settings)
|
|||||||
serverInitCommands = settings->value("LastServerInitCommands").toString();
|
serverInitCommands = settings->value("LastServerInitCommands").toString();
|
||||||
serverResetCommands = settings->value("LastServerResetCommands").toString();
|
serverResetCommands = settings->value("LastServerResetCommands").toString();
|
||||||
debugInfoLocation = settings->value("LastDebugInfoLocation").toString();
|
debugInfoLocation = settings->value("LastDebugInfoLocation").toString();
|
||||||
|
sysRoot = FilePath::fromVariant(settings->value("LastSysRoot"));
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
@@ -259,6 +265,16 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
|
|||||||
d->serverStartScriptLabel->setBuddy(d->serverStartScriptPathChooser);
|
d->serverStartScriptLabel->setBuddy(d->serverStartScriptPathChooser);
|
||||||
d->serverStartScriptLabel->setToolTip(d->serverStartScriptPathChooser->toolTip());
|
d->serverStartScriptLabel->setToolTip(d->serverStartScriptPathChooser->toolTip());
|
||||||
|
|
||||||
|
d->sysRootPathChooser = new PathChooser(this);
|
||||||
|
d->sysRootPathChooser->setExpectedKind(PathChooser::Directory);
|
||||||
|
d->sysRootPathChooser->setHistoryCompleter("Debugger.SysRoot.History");
|
||||||
|
d->sysRootPathChooser->setPromptDialogTitle(tr("Select SysRoot Directory"));
|
||||||
|
d->sysRootPathChooser->setToolTip(tr(
|
||||||
|
"This option can be used to override the kit's SysRoot setting."));
|
||||||
|
d->sysRootLabel = new QLabel(tr("Override S&ysRoot:"), this);
|
||||||
|
d->sysRootLabel->setBuddy(d->sysRootPathChooser);
|
||||||
|
d->sysRootLabel->setToolTip(d->sysRootPathChooser->toolTip());
|
||||||
|
|
||||||
d->serverInitCommandsTextEdit = new QPlainTextEdit(this);
|
d->serverInitCommandsTextEdit = new QPlainTextEdit(this);
|
||||||
d->serverInitCommandsTextEdit->setToolTip(tr(
|
d->serverInitCommandsTextEdit->setToolTip(tr(
|
||||||
"This option can be used to send the target init commands."));
|
"This option can be used to send the target init commands."));
|
||||||
@@ -306,6 +322,7 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
|
|||||||
formLayout->addRow(tr("Run in &terminal:"), d->runInTerminalCheckBox);
|
formLayout->addRow(tr("Run in &terminal:"), d->runInTerminalCheckBox);
|
||||||
formLayout->addRow(tr("Break at \"&main\":"), d->breakAtMainCheckBox);
|
formLayout->addRow(tr("Break at \"&main\":"), d->breakAtMainCheckBox);
|
||||||
formLayout->addRow(d->serverStartScriptLabel, d->serverStartScriptPathChooser);
|
formLayout->addRow(d->serverStartScriptLabel, d->serverStartScriptPathChooser);
|
||||||
|
formLayout->addRow(d->sysRootLabel, d->sysRootPathChooser);
|
||||||
formLayout->addRow(d->serverInitCommandsLabel, d->serverInitCommandsTextEdit);
|
formLayout->addRow(d->serverInitCommandsLabel, d->serverInitCommandsTextEdit);
|
||||||
formLayout->addRow(d->serverResetCommandsLabel, d->serverResetCommandsTextEdit);
|
formLayout->addRow(d->serverResetCommandsLabel, d->serverResetCommandsTextEdit);
|
||||||
formLayout->addRow(tr("Debug &information:"), d->debuginfoPathChooser);
|
formLayout->addRow(tr("Debug &information:"), d->debuginfoPathChooser);
|
||||||
@@ -445,6 +462,7 @@ void StartApplicationDialog::run(bool attachRemote)
|
|||||||
debugger->setCommandsAfterConnect(newParameters.serverInitCommands);
|
debugger->setCommandsAfterConnect(newParameters.serverInitCommands);
|
||||||
debugger->setCommandsForReset(newParameters.serverResetCommands);
|
debugger->setCommandsForReset(newParameters.serverResetCommands);
|
||||||
debugger->setUseTerminal(newParameters.runInTerminal);
|
debugger->setUseTerminal(newParameters.runInTerminal);
|
||||||
|
debugger->setSysRoot(newParameters.sysRoot);
|
||||||
|
|
||||||
bool isLocal = !dev || (dev->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
bool isLocal = !dev || (dev->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
||||||
if (isLocal) {
|
if (isLocal) {
|
||||||
@@ -481,6 +499,7 @@ StartApplicationParameters StartApplicationDialog::parameters() const
|
|||||||
result.serverAddress = d->channelOverrideEdit->text();
|
result.serverAddress = d->channelOverrideEdit->text();
|
||||||
result.runnable.executable = d->localExecutablePathChooser->filePath();
|
result.runnable.executable = d->localExecutablePathChooser->filePath();
|
||||||
result.serverStartScript = d->serverStartScriptPathChooser->filePath();
|
result.serverStartScript = d->serverStartScriptPathChooser->filePath();
|
||||||
|
result.sysRoot = d->sysRootPathChooser->filePath();
|
||||||
result.serverInitCommands = d->serverInitCommandsTextEdit->toPlainText();
|
result.serverInitCommands = d->serverInitCommandsTextEdit->toPlainText();
|
||||||
result.serverResetCommands = d->serverResetCommandsTextEdit->toPlainText();
|
result.serverResetCommands = d->serverResetCommandsTextEdit->toPlainText();
|
||||||
result.kitId = d->kitChooser->currentKitId();
|
result.kitId = d->kitChooser->currentKitId();
|
||||||
@@ -499,6 +518,7 @@ void StartApplicationDialog::setParameters(const StartApplicationParameters &p)
|
|||||||
d->channelOverrideEdit->setText(p.serverAddress);
|
d->channelOverrideEdit->setText(p.serverAddress);
|
||||||
d->localExecutablePathChooser->setFilePath(p.runnable.executable);
|
d->localExecutablePathChooser->setFilePath(p.runnable.executable);
|
||||||
d->serverStartScriptPathChooser->setFilePath(p.serverStartScript);
|
d->serverStartScriptPathChooser->setFilePath(p.serverStartScript);
|
||||||
|
d->sysRootPathChooser->setFilePath(p.sysRoot);
|
||||||
d->serverInitCommandsTextEdit->setPlainText(p.serverInitCommands);
|
d->serverInitCommandsTextEdit->setPlainText(p.serverInitCommands);
|
||||||
d->serverResetCommandsTextEdit->setPlainText(p.serverResetCommands);
|
d->serverResetCommandsTextEdit->setPlainText(p.serverResetCommands);
|
||||||
d->debuginfoPathChooser->setPath(p.debugInfoLocation);
|
d->debuginfoPathChooser->setPath(p.debugInfoLocation);
|
||||||
|
|||||||
@@ -1278,6 +1278,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
|
|||||||
FilePath executable;
|
FilePath executable;
|
||||||
QString remoteChannel;
|
QString remoteChannel;
|
||||||
QString coreFile;
|
QString coreFile;
|
||||||
|
QString sysRoot;
|
||||||
bool useTerminal = false;
|
bool useTerminal = false;
|
||||||
|
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
@@ -1305,6 +1306,8 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
|
|||||||
coreFile = val;
|
coreFile = val;
|
||||||
} else if (key == "terminal") {
|
} else if (key == "terminal") {
|
||||||
useTerminal = true;
|
useTerminal = true;
|
||||||
|
} else if (key == "sysroot") {
|
||||||
|
sysRoot = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1315,6 +1318,8 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
|
|||||||
runControl->setKit(kit);
|
runControl->setKit(kit);
|
||||||
auto debugger = new DebuggerRunTool(runControl);
|
auto debugger = new DebuggerRunTool(runControl);
|
||||||
debugger->setInferiorExecutable(executable);
|
debugger->setInferiorExecutable(executable);
|
||||||
|
if (!sysRoot.isEmpty())
|
||||||
|
debugger->setSysRoot(FilePath::fromUserInput(sysRoot));
|
||||||
if (pid) {
|
if (pid) {
|
||||||
debugger->setStartMode(AttachExternal);
|
debugger->setStartMode(AttachExternal);
|
||||||
debugger->setCloseMode(DetachAtClose);
|
debugger->setCloseMode(DetachAtClose);
|
||||||
@@ -1541,6 +1546,7 @@ void DebuggerPluginPrivate::attachCore()
|
|||||||
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());
|
||||||
|
dlg.setSysRoot(configValue("LastSysRoot").toString());
|
||||||
dlg.setForceLocalCoreFile(configValue("LastForceLocalCoreFile").toBool());
|
dlg.setForceLocalCoreFile(configValue("LastForceLocalCoreFile").toBool());
|
||||||
|
|
||||||
if (dlg.exec() != QDialog::Accepted)
|
if (dlg.exec() != QDialog::Accepted)
|
||||||
@@ -1551,6 +1557,7 @@ void DebuggerPluginPrivate::attachCore()
|
|||||||
setConfigValue("LastRemoteCoreFile", dlg.remoteCoreFile());
|
setConfigValue("LastRemoteCoreFile", dlg.remoteCoreFile());
|
||||||
setConfigValue("LastExternalKit", dlg.kit()->id().toSetting());
|
setConfigValue("LastExternalKit", dlg.kit()->id().toSetting());
|
||||||
setConfigValue("LastExternalStartScript", dlg.overrideStartScript());
|
setConfigValue("LastExternalStartScript", dlg.overrideStartScript());
|
||||||
|
setConfigValue("LastSysRoot", dlg.sysRoot().toString());
|
||||||
setConfigValue("LastForceLocalCoreFile", dlg.forcesLocalCoreFile());
|
setConfigValue("LastForceLocalCoreFile", dlg.forcesLocalCoreFile());
|
||||||
|
|
||||||
auto runControl = new RunControl(ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
auto runControl = new RunControl(ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||||
@@ -1563,6 +1570,9 @@ void DebuggerPluginPrivate::attachCore()
|
|||||||
debugger->setStartMode(AttachCore);
|
debugger->setStartMode(AttachCore);
|
||||||
debugger->setCloseMode(DetachAtClose);
|
debugger->setCloseMode(DetachAtClose);
|
||||||
debugger->setOverrideStartScript(dlg.overrideStartScript());
|
debugger->setOverrideStartScript(dlg.overrideStartScript());
|
||||||
|
const FilePath sysRoot = dlg.sysRoot();
|
||||||
|
if (!sysRoot.isEmpty())
|
||||||
|
debugger->setSysRoot(sysRoot);
|
||||||
debugger->startRunControl();
|
debugger->startRunControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ public:
|
|||||||
QPushButton *selectRemoteCoreButton;
|
QPushButton *selectRemoteCoreButton;
|
||||||
|
|
||||||
PathChooser *overrideStartScriptFileName;
|
PathChooser *overrideStartScriptFileName;
|
||||||
|
PathChooser *sysRootDirectory;
|
||||||
|
|
||||||
QDialogButtonBox *buttonBox;
|
QDialogButtonBox *buttonBox;
|
||||||
|
|
||||||
@@ -287,6 +288,13 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent)
|
|||||||
d->overrideStartScriptFileName->setExpectedKind(PathChooser::File);
|
d->overrideStartScriptFileName->setExpectedKind(PathChooser::File);
|
||||||
d->overrideStartScriptFileName->setPromptDialogTitle(tr("Select Startup Script"));
|
d->overrideStartScriptFileName->setPromptDialogTitle(tr("Select Startup Script"));
|
||||||
|
|
||||||
|
d->sysRootDirectory = new PathChooser(this);
|
||||||
|
d->sysRootDirectory->setHistoryCompleter("Debugger.SysRoot.History");
|
||||||
|
d->sysRootDirectory->setExpectedKind(PathChooser::Directory);
|
||||||
|
d->sysRootDirectory->setPromptDialogTitle(tr("Select SysRoot Directory"));
|
||||||
|
d->sysRootDirectory->setToolTip(tr(
|
||||||
|
"This option can be used to override the kit's SysRoot setting"));
|
||||||
|
|
||||||
auto coreLayout = new QHBoxLayout;
|
auto coreLayout = new QHBoxLayout;
|
||||||
coreLayout->addWidget(d->localCoreFileName);
|
coreLayout->addWidget(d->localCoreFileName);
|
||||||
coreLayout->addWidget(d->remoteCoreFileName);
|
coreLayout->addWidget(d->remoteCoreFileName);
|
||||||
@@ -301,6 +309,7 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent)
|
|||||||
formLayout->addRow(tr("Core file:"), coreLayout);
|
formLayout->addRow(tr("Core file:"), coreLayout);
|
||||||
formLayout->addRow(tr("&Executable or symbol file:"), d->symbolFileName);
|
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);
|
||||||
|
formLayout->addRow(tr("Override S&ysRoot:"), d->sysRootDirectory);
|
||||||
|
|
||||||
auto line = new QFrame(this);
|
auto line = new QFrame(this);
|
||||||
line->setFrameShape(QFrame::HLine);
|
line->setFrameShape(QFrame::HLine);
|
||||||
@@ -469,5 +478,15 @@ void AttachCoreDialog::setOverrideStartScript(const QString &scriptName)
|
|||||||
d->overrideStartScriptFileName->setPath(scriptName);
|
d->overrideStartScriptFileName->setPath(scriptName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FilePath AttachCoreDialog::sysRoot() const
|
||||||
|
{
|
||||||
|
return d->sysRootDirectory->filePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AttachCoreDialog::setSysRoot(const QString &sysRoot)
|
||||||
|
{
|
||||||
|
d->sysRootDirectory->setPath(sysRoot);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public:
|
|||||||
QString localCoreFile() const;
|
QString localCoreFile() const;
|
||||||
QString remoteCoreFile() const;
|
QString remoteCoreFile() const;
|
||||||
QString overrideStartScript() const;
|
QString overrideStartScript() const;
|
||||||
|
Utils::FilePath sysRoot() const;
|
||||||
bool useLocalCoreFile() const;
|
bool useLocalCoreFile() const;
|
||||||
bool forcesLocalCoreFile() const;
|
bool forcesLocalCoreFile() const;
|
||||||
bool isLocalKit() const;
|
bool isLocalKit() const;
|
||||||
@@ -61,6 +62,7 @@ public:
|
|||||||
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);
|
||||||
|
void setSysRoot(const QString &sysRoot);
|
||||||
void setKitId(Utils::Id id);
|
void setKitId(Utils::Id id);
|
||||||
void setForceLocalCoreFile(bool on);
|
void setForceLocalCoreFile(bool on);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user