forked from qt-creator/qt-creator
FileInProjectFinder/Debugger: Use Utils::FileName for sysroot
Change-Id: Id937f927ba6137fd04f742f31d1b260afbe42db4 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -102,16 +102,12 @@ void FileInProjectFinder::setProjectFiles(const FileNameList &projectFiles)
|
||||
m_cache.clear();
|
||||
}
|
||||
|
||||
void FileInProjectFinder::setSysroot(const QString &sysroot)
|
||||
void FileInProjectFinder::setSysroot(const FileName &sysroot)
|
||||
{
|
||||
QString newsys = sysroot;
|
||||
while (newsys.endsWith(QLatin1Char('/')))
|
||||
newsys.remove(newsys.length() - 1, 1);
|
||||
|
||||
if (m_sysroot == newsys)
|
||||
if (m_sysroot == sysroot)
|
||||
return;
|
||||
|
||||
m_sysroot = newsys;
|
||||
m_sysroot = sysroot;
|
||||
m_cache.clear();
|
||||
}
|
||||
|
||||
@@ -274,9 +270,10 @@ bool FileInProjectFinder::findFileOrDirectory(const QString &originalPath, FileH
|
||||
|
||||
// check if absolute path is found in sysroot
|
||||
if (!m_sysroot.isEmpty()) {
|
||||
const QString sysrootPath = m_sysroot + originalPath;
|
||||
if (checkPath(sysrootPath, fileHandler, directoryHandler))
|
||||
return handleSuccess(originalPath, sysrootPath, "in sysroot");
|
||||
FileName sysrootPath = m_sysroot;
|
||||
sysrootPath.appendPath(originalPath);
|
||||
if (checkPath(sysrootPath.toString(), fileHandler, directoryHandler))
|
||||
return handleSuccess(originalPath, sysrootPath.toString(), "in sysroot");
|
||||
}
|
||||
|
||||
qCDebug(finderLog) << "FileInProjectFinder: couldn't find file!";
|
||||
|
@@ -48,7 +48,7 @@ public:
|
||||
FileName projectDirectory() const;
|
||||
|
||||
void setProjectFiles(const FileNameList &projectFiles);
|
||||
void setSysroot(const QString &sysroot);
|
||||
void setSysroot(const FileName &sysroot);
|
||||
|
||||
void addMappedPath(const FileName &localFilePath, const QString &remoteFilePath);
|
||||
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
static QString bestMatch(const QStringList &filePaths, const QString &filePathToFind);
|
||||
|
||||
FileName m_projectDir;
|
||||
QString m_sysroot;
|
||||
FileName m_sysroot;
|
||||
FileNameList m_projectFiles;
|
||||
FileNameList m_searchDirectories;
|
||||
PathMappingNode m_pathMapRoot;
|
||||
|
@@ -147,9 +147,10 @@ void AndroidDebugSupport::start()
|
||||
gdbServer.setPort(m_runner->gdbServerPort().number());
|
||||
setRemoteChannel(gdbServer);
|
||||
|
||||
QString sysRoot = AndroidConfigurations::currentConfig().ndkLocation().appendPath("platforms")
|
||||
Utils::FileName sysRoot = AndroidConfigurations::currentConfig().ndkLocation()
|
||||
.appendPath("platforms")
|
||||
.appendPath(QString("android-%1").arg(AndroidManager::minimumSDK(target)))
|
||||
.appendPath(toNdkArch(AndroidManager::targetArch(target))).toString();
|
||||
.appendPath(toNdkArch(AndroidManager::targetArch(target)));
|
||||
setSysRoot(sysRoot);
|
||||
qCDebug(androidDebugSupportLog) << "Sysroot: " << sysRoot;
|
||||
}
|
||||
|
@@ -122,7 +122,7 @@ public:
|
||||
QString platform;
|
||||
QString deviceSymbolsRoot;
|
||||
bool continueAfterAttach = false;
|
||||
QString sysRoot;
|
||||
Utils::FileName sysRoot;
|
||||
|
||||
// Used by general core file debugging. Public access requested in QTCREATORBUG-17158.
|
||||
QString coreFile;
|
||||
|
@@ -308,7 +308,7 @@ void DebuggerRunTool::setAttachPid(qint64 pid)
|
||||
m_runParameters.attachPID = ProcessHandle(pid);
|
||||
}
|
||||
|
||||
void DebuggerRunTool::setSysRoot(const QString &sysRoot)
|
||||
void DebuggerRunTool::setSysRoot(const Utils::FileName &sysRoot)
|
||||
{
|
||||
m_runParameters.sysRoot = sysRoot;
|
||||
}
|
||||
@@ -811,7 +811,7 @@ bool DebuggerRunTool::fixupParameters()
|
||||
}
|
||||
|
||||
if (!boolSetting(AutoEnrichParameters)) {
|
||||
const QString sysroot = rp.sysRoot;
|
||||
const QString sysroot = rp.sysRoot.toString();
|
||||
if (rp.debugInfoLocation.isEmpty())
|
||||
rp.debugInfoLocation = sysroot + "/usr/lib/debug";
|
||||
if (rp.debugSourceLocation.isEmpty()) {
|
||||
@@ -905,7 +905,7 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, Kit *kit, bool allowTer
|
||||
kit = runConfig->target()->kit();
|
||||
QTC_ASSERT(kit, return);
|
||||
|
||||
m_runParameters.sysRoot = SysRootKitInformation::sysRoot(kit).toString();
|
||||
m_runParameters.sysRoot = SysRootKitInformation::sysRoot(kit);
|
||||
m_runParameters.macroExpander = kit->macroExpander();
|
||||
m_runParameters.debugger = DebuggerKitInformation::runnable(kit);
|
||||
m_runParameters.cppEngineType = DebuggerKitInformation::engineType(kit);
|
||||
@@ -976,7 +976,7 @@ void DebuggerRunTool::startRunControl()
|
||||
void DebuggerRunTool::addSolibSearchDir(const QString &str)
|
||||
{
|
||||
QString path = str;
|
||||
path.replace("%{sysroot}", m_runParameters.sysRoot);
|
||||
path.replace("%{sysroot}", m_runParameters.sysRoot.toString());
|
||||
m_runParameters.solibSearchPath.append(path);
|
||||
}
|
||||
|
||||
|
@@ -94,7 +94,7 @@ public:
|
||||
void setAttachPid(Utils::ProcessHandle pid);
|
||||
void setAttachPid(qint64 pid);
|
||||
|
||||
void setSysRoot(const QString &sysRoot);
|
||||
void setSysRoot(const Utils::FileName &sysRoot);
|
||||
void setSymbolFile(const QString &symbolFile);
|
||||
void setRemoteChannel(const QString &channel);
|
||||
void setRemoteChannel(const QString &host, int port);
|
||||
|
@@ -1615,7 +1615,7 @@ QString GdbEngine::cleanupFullName(const QString &fileName)
|
||||
if (!boolSetting(AutoEnrichParameters))
|
||||
return cleanFilePath;
|
||||
|
||||
const QString sysroot = runParameters().sysRoot;
|
||||
const QString sysroot = runParameters().sysRoot.toString();
|
||||
if (QFileInfo(cleanFilePath).isReadable())
|
||||
return cleanFilePath;
|
||||
if (!sysroot.isEmpty() && fileName.startsWith('/')) {
|
||||
@@ -3701,10 +3701,10 @@ void GdbEngine::setupEngine()
|
||||
}
|
||||
|
||||
if (!rp.sysRoot.isEmpty()) {
|
||||
runCommand({"set sysroot " + rp.sysRoot});
|
||||
runCommand({"set sysroot " + rp.sysRoot.toString()});
|
||||
// sysroot is not enough to correctly locate the sources, so explicitly
|
||||
// relocate the most likely place for the debug source
|
||||
runCommand({"set substitute-path /usr/src " + rp.sysRoot + "/usr/src"});
|
||||
runCommand({"set substitute-path /usr/src " + rp.sysRoot.toString() + "/usr/src"});
|
||||
}
|
||||
|
||||
//QByteArray ba = QFileInfo(sp.dumperLibrary).path().toLocal8Bit();
|
||||
|
@@ -284,7 +284,8 @@ void LldbEngine::setupEngine()
|
||||
QTC_CHECK(!rp.attachPID.isValid() || (rp.startMode == AttachCrashedExternal
|
||||
|| rp.startMode == AttachExternal));
|
||||
cmd2.arg("attachpid", rp.attachPID.pid());
|
||||
cmd2.arg("sysroot", rp.deviceSymbolsRoot.isEmpty() ? rp.sysRoot : rp.deviceSymbolsRoot);
|
||||
cmd2.arg("sysroot", rp.deviceSymbolsRoot.isEmpty() ? rp.sysRoot.toString()
|
||||
: rp.deviceSymbolsRoot);
|
||||
cmd2.arg("remotechannel", ((rp.startMode == AttachToRemoteProcess
|
||||
|| rp.startMode == AttachToRemoteServer)
|
||||
? rp.remoteChannel : QString()));
|
||||
|
@@ -85,8 +85,10 @@ static QStringList searchPaths(Kit *kit)
|
||||
searchPaths << qtVersion->qmakeProperty("QT_INSTALL_PLUGINS") + '/' + dir;
|
||||
|
||||
searchPaths << qtVersion->qmakeProperty("QT_INSTALL_LIBS");
|
||||
searchPaths << qtVersion->qnxTarget() + '/' + qtVersion->cpuDir() + "/lib";
|
||||
searchPaths << qtVersion->qnxTarget() + '/' + qtVersion->cpuDir() + "/usr/lib";
|
||||
searchPaths << qtVersion->qnxTarget().appendPath(qtVersion->cpuDir()).appendPath("lib")
|
||||
.toString();
|
||||
searchPaths << qtVersion->qnxTarget().appendPath(qtVersion->cpuDir()).appendPath("usr/lib")
|
||||
.toString();
|
||||
|
||||
return searchPaths;
|
||||
}
|
||||
|
@@ -98,17 +98,17 @@ QString QnxQtVersion::qnxHost() const
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString QnxQtVersion::qnxTarget() const
|
||||
Utils::FileName QnxQtVersion::qnxTarget() const
|
||||
{
|
||||
if (!m_environmentUpToDate)
|
||||
updateEnvironment();
|
||||
|
||||
foreach (const Utils::EnvironmentItem &item, m_qnxEnv) {
|
||||
if (item.name == QLatin1String(Constants::QNX_TARGET_KEY))
|
||||
return item.value;
|
||||
return Utils::FileName::fromUserInput(item.value);
|
||||
}
|
||||
|
||||
return QString();
|
||||
return Utils::FileName();
|
||||
}
|
||||
|
||||
QString QnxQtVersion::cpuDir() const
|
||||
|
@@ -52,7 +52,7 @@ public:
|
||||
QSet<Core::Id> targetDeviceTypes() const override;
|
||||
|
||||
QString qnxHost() const;
|
||||
QString qnxTarget() const;
|
||||
Utils::FileName qnxTarget() const;
|
||||
|
||||
QString cpuDir() const;
|
||||
|
||||
|
@@ -1354,7 +1354,7 @@ void BaseQtVersion::populateQmlFileFinder(FileInProjectFinder *finder, const Tar
|
||||
|
||||
// ... and find the sysroot and qml directory if we have any target at all.
|
||||
const ProjectExplorer::Kit *kit = target ? target->kit() : nullptr;
|
||||
QString activeSysroot = ProjectExplorer::SysRootKitInformation::sysRoot(kit).toString();
|
||||
const Utils::FileName activeSysroot = ProjectExplorer::SysRootKitInformation::sysRoot(kit);
|
||||
const QtSupport::BaseQtVersion *qtVersion = QtVersionManager::isLoaded()
|
||||
? QtSupport::QtKitInformation::qtVersion(kit) : nullptr;
|
||||
Utils::FileNameList additionalSearchDirectories = qtVersion
|
||||
|
Reference in New Issue
Block a user