Debugger: Use FilePath for debugInfoLocation

Change-Id: Id538ab4ddd1d634d0dc73a00fe42d3fd35341bea
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-09-27 11:11:18 +02:00
parent 9c97e03465
commit 4b5aeb9a74
5 changed files with 14 additions and 15 deletions

View File

@@ -130,7 +130,7 @@ public:
FilePath sysRoot; FilePath sysRoot;
QString serverInitCommands; QString serverInitCommands;
QString serverResetCommands; QString serverResetCommands;
QString debugInfoLocation; FilePath debugInfoLocation;
}; };
bool StartApplicationParameters::equals(const StartApplicationParameters &rhs) const bool StartApplicationParameters::equals(const StartApplicationParameters &rhs) const
@@ -181,7 +181,7 @@ void StartApplicationParameters::toSettings(QSettings *settings) const
settings->setValue("LastExternalUseTargetExtended", useTargetExtendedRemote); settings->setValue("LastExternalUseTargetExtended", useTargetExtendedRemote);
settings->setValue("LastServerInitCommands", serverInitCommands); settings->setValue("LastServerInitCommands", serverInitCommands);
settings->setValue("LastServerResetCommands", serverResetCommands); settings->setValue("LastServerResetCommands", serverResetCommands);
settings->setValue("LastDebugInfoLocation", debugInfoLocation); settings->setValue("LastDebugInfoLocation", debugInfoLocation.toVariant());
settings->setValue("LastSysRoot", sysRoot.toVariant()); settings->setValue("LastSysRoot", sysRoot.toVariant());
} }
@@ -198,7 +198,7 @@ void StartApplicationParameters::fromSettings(const QSettings *settings)
useTargetExtendedRemote = settings->value("LastExternalUseTargetExtended").toBool(); useTargetExtendedRemote = settings->value("LastExternalUseTargetExtended").toBool();
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 = FilePath::fromVariant(settings->value("LastDebugInfoLocation"));
sysRoot = FilePath::fromVariant(settings->value("LastSysRoot")); sysRoot = FilePath::fromVariant(settings->value("LastSysRoot"));
} }
@@ -487,7 +487,7 @@ StartApplicationParameters StartApplicationDialog::parameters() const
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();
result.debugInfoLocation = d->debuginfoPathChooser->filePath().toString(); result.debugInfoLocation = d->debuginfoPathChooser->filePath();
result.runnable.command.setArguments(d->arguments->text()); result.runnable.command.setArguments(d->arguments->text());
result.runnable.workingDirectory = d->workingDirectory->filePath(); result.runnable.workingDirectory = d->workingDirectory->filePath();
result.breakAtMain = d->breakAtMainCheckBox->isChecked(); result.breakAtMain = d->breakAtMainCheckBox->isChecked();
@@ -505,7 +505,7 @@ void StartApplicationDialog::setParameters(const StartApplicationParameters &p)
d->sysRootPathChooser->setFilePath(p.sysRoot); 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->setFilePath(p.debugInfoLocation);
d->arguments->setText(p.runnable.command.arguments()); d->arguments->setText(p.runnable.command.arguments());
d->workingDirectory->setFilePath(p.runnable.workingDirectory); d->workingDirectory->setFilePath(p.runnable.workingDirectory);
d->breakAtMainCheckBox->setChecked(p.breakAtMain); d->breakAtMainCheckBox->setChecked(p.breakAtMain);

View File

@@ -174,7 +174,7 @@ public:
ProjectExplorer::Runnable debugger; ProjectExplorer::Runnable debugger;
QString overrideStartScript; // Used in attach to core and remote debugging QString overrideStartScript; // Used in attach to core and remote debugging
QString startMessage; // First status message shown. QString startMessage; // First status message shown.
QString debugInfoLocation; // Gdb "set-debug-file-directory". Utils::FilePath debugInfoLocation; // Gdb "set-debug-file-directory".
QStringList debugSourceLocation; // Gdb "directory" QStringList debugSourceLocation; // Gdb "directory"
QString qtPackageSourceLocation; QString qtPackageSourceLocation;
bool isSnapshot = false; // Set if created internally. bool isSnapshot = false; // Set if created internally.

View File

@@ -339,8 +339,7 @@ void DebuggerRunTool::setCommandsForReset(const QString &commands)
{ {
m_runParameters.commandsForReset = commands; m_runParameters.commandsForReset = commands;
} }
void DebuggerRunTool::setDebugInfoLocation(const FilePath &debugInfoLocation)
void DebuggerRunTool::setDebugInfoLocation(const QString &debugInfoLocation)
{ {
m_runParameters.debugInfoLocation = debugInfoLocation; m_runParameters.debugInfoLocation = debugInfoLocation;
} }
@@ -776,11 +775,11 @@ bool DebuggerRunTool::fixupParameters()
} }
if (!debuggerSettings()->autoEnrichParameters.value()) { if (!debuggerSettings()->autoEnrichParameters.value()) {
const QString sysroot = rp.sysRoot.toString(); const FilePath sysroot = rp.sysRoot;
if (rp.debugInfoLocation.isEmpty()) if (rp.debugInfoLocation.isEmpty())
rp.debugInfoLocation = sysroot + "/usr/lib/debug"; rp.debugInfoLocation = sysroot / "/usr/lib/debug";
if (rp.debugSourceLocation.isEmpty()) { if (rp.debugSourceLocation.isEmpty()) {
QString base = sysroot + "/usr/src/debug/"; QString base = sysroot.toString() + "/usr/src/debug/";
rp.debugSourceLocation.append(base + "qt5base/src/corelib"); rp.debugSourceLocation.append(base + "qt5base/src/corelib");
rp.debugSourceLocation.append(base + "qt5base/src/gui"); rp.debugSourceLocation.append(base + "qt5base/src/gui");
rp.debugSourceLocation.append(base + "qt5base/src/network"); rp.debugSourceLocation.append(base + "qt5base/src/network");

View File

@@ -114,7 +114,7 @@ public:
void setCommandsForReset(const QString &commands); void setCommandsForReset(const QString &commands);
void setServerStartScript(const Utils::FilePath &serverStartScript); void setServerStartScript(const Utils::FilePath &serverStartScript);
void setDebugInfoLocation(const QString &debugInfoLocation); void setDebugInfoLocation(const Utils::FilePath &debugInfoLocation);
void setQmlServer(const QUrl &qmlServer); void setQmlServer(const QUrl &qmlServer);
QUrl qmlServer() const; // Used in GammaRay integration. QUrl qmlServer() const; // Used in GammaRay integration.

View File

@@ -4149,10 +4149,10 @@ void GdbEngine::handleInferiorPrepared()
void GdbEngine::handleDebugInfoLocation(const DebuggerResponse &response) void GdbEngine::handleDebugInfoLocation(const DebuggerResponse &response)
{ {
if (response.resultClass == ResultDone) { if (response.resultClass == ResultDone) {
const QString debugInfoLocation = runParameters().debugInfoLocation; const FilePath debugInfoLocation = runParameters().debugInfoLocation;
if (!debugInfoLocation.isEmpty() && QFile::exists(debugInfoLocation)) { if (!debugInfoLocation.isEmpty() && debugInfoLocation.exists()) {
const QString curDebugInfoLocations = response.consoleStreamOutput.split('"').value(1); const QString curDebugInfoLocations = response.consoleStreamOutput.split('"').value(1);
QString cmd = "set debug-file-directory " + debugInfoLocation; QString cmd = "set debug-file-directory " + debugInfoLocation.toString();
if (!curDebugInfoLocations.isEmpty()) if (!curDebugInfoLocations.isEmpty())
cmd += HostOsInfo::pathListSeparator() + curDebugInfoLocations; cmd += HostOsInfo::pathListSeparator() + curDebugInfoLocations;
runCommand({cmd}); runCommand({cmd});