forked from qt-creator/qt-creator
Debugger: Use FilePath for core files and surroundings
Change-Id: Icd648147ee907a2c5ba75042f003229bbd9226fe Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -419,7 +419,7 @@ void CdbEngine::setupEngine()
|
||||
}
|
||||
break;
|
||||
case AttachToCore:
|
||||
debugger.addArgs({"-z", sp.coreFile});
|
||||
debugger.addArgs({"-z", sp.coreFile.path()});
|
||||
break;
|
||||
default:
|
||||
handleSetupFailure(QString("Internal error: Unsupported start mode %1.").arg(sp.startMode));
|
||||
|
@@ -2632,7 +2632,7 @@ QString DebuggerEngine::formatStartParameters() const
|
||||
if (!sp.debugger.command.isEmpty())
|
||||
str << "Debugger: " << sp.debugger.command.toUserOutput() << '\n';
|
||||
if (!sp.coreFile.isEmpty())
|
||||
str << "Core: " << QDir::toNativeSeparators(sp.coreFile) << '\n';
|
||||
str << "Core: " << sp.coreFile.toUserOutput() << '\n';
|
||||
if (sp.attachPID.isValid())
|
||||
str << "PID: " << sp.attachPID.pid() << ' ' << sp.crashParameter << '\n';
|
||||
if (!sp.projectSourceDirectory.isEmpty()) {
|
||||
|
@@ -158,7 +158,7 @@ public:
|
||||
Utils::FilePath sysRoot;
|
||||
|
||||
// Used by general core file debugging. Public access requested in QTCREATORBUG-17158.
|
||||
QString coreFile;
|
||||
Utils::FilePath coreFile;
|
||||
|
||||
// Macro-expanded and passed to debugger startup.
|
||||
QString additionalStartupCommands;
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
bool runAsRoot = false;
|
||||
|
||||
ProjectExplorer::Runnable debugger;
|
||||
QString overrideStartScript; // Used in attach to core and remote debugging
|
||||
Utils::FilePath overrideStartScript; // Used in attach to core and remote debugging
|
||||
QString startMessage; // First status message shown.
|
||||
Utils::FilePath debugInfoLocation; // Gdb "set-debug-file-directory".
|
||||
QStringList debugSourceLocation; // Gdb "directory"
|
||||
|
@@ -1255,7 +1255,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
|
||||
DebuggerStartMode startMode = StartExternal;
|
||||
FilePath executable;
|
||||
QString remoteChannel;
|
||||
QString coreFile;
|
||||
FilePath coreFile;
|
||||
QString sysRoot;
|
||||
bool useTerminal = false;
|
||||
|
||||
@@ -1281,7 +1281,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
|
||||
remoteChannel = val;
|
||||
} else if (key == "core") {
|
||||
startMode = AttachToCore;
|
||||
coreFile = val;
|
||||
coreFile = FilePath::fromUserInput(val);
|
||||
} else if (key == "terminal") {
|
||||
useTerminal = true;
|
||||
} else if (key == "sysroot") {
|
||||
@@ -1312,9 +1312,9 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
|
||||
} else if (startMode == AttachToCore) {
|
||||
debugger->setStartMode(AttachToCore);
|
||||
debugger->setCloseMode(DetachAtClose);
|
||||
debugger->setCoreFileName(coreFile);
|
||||
debugger->setRunControlName(tr("Core file \"%1\"").arg(coreFile));
|
||||
debugger->setStartMessage(tr("Attaching to core file %1.").arg(coreFile));
|
||||
debugger->setCoreFilePath(coreFile);
|
||||
debugger->setRunControlName(tr("Core file \"%1\"").arg(coreFile.toUserOutput()));
|
||||
debugger->setStartMessage(tr("Attaching to core file %1.").arg(coreFile.toUserOutput()));
|
||||
} else {
|
||||
debugger->setStartMode(StartExternal);
|
||||
debugger->setRunControlName(tr("Executable file \"%1\"").arg(executable.toUserOutput()));
|
||||
@@ -1521,31 +1521,32 @@ void DebuggerPluginPrivate::attachCore()
|
||||
const QString lastExternalKit = configValue("LastExternalKit").toString();
|
||||
if (!lastExternalKit.isEmpty())
|
||||
dlg.setKitId(Id::fromString(lastExternalKit));
|
||||
dlg.setSymbolFile(configValue("LastExternalExecutableFile").toString());
|
||||
dlg.setLocalCoreFile(configValue("LastLocalCoreFile").toString());
|
||||
dlg.setRemoteCoreFile(configValue("LastRemoteCoreFile").toString());
|
||||
dlg.setOverrideStartScript(configValue("LastExternalStartScript").toString());
|
||||
dlg.setSysRoot(configValue("LastSysRoot").toString());
|
||||
dlg.setSymbolFile(FilePath::fromVariant(configValue("LastExternalExecutableFile")));
|
||||
dlg.setLocalCoreFile(FilePath::fromVariant(configValue("LastLocalCoreFile")));
|
||||
dlg.setRemoteCoreFile(FilePath::fromVariant(configValue("LastRemoteCoreFile")));
|
||||
dlg.setOverrideStartScript(FilePath::fromVariant(configValue("LastExternalStartScript")));
|
||||
dlg.setSysRoot(FilePath::fromVariant(configValue("LastSysRoot")));
|
||||
dlg.setForceLocalCoreFile(configValue("LastForceLocalCoreFile").toBool());
|
||||
|
||||
if (dlg.exec() != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
setConfigValue("LastExternalExecutableFile", dlg.symbolFile().toVariant());
|
||||
setConfigValue("LastLocalCoreFile", dlg.localCoreFile());
|
||||
setConfigValue("LastRemoteCoreFile", dlg.remoteCoreFile());
|
||||
setConfigValue("LastLocalCoreFile", dlg.localCoreFile().toVariant());
|
||||
setConfigValue("LastRemoteCoreFile", dlg.remoteCoreFile().toVariant());
|
||||
setConfigValue("LastExternalKit", dlg.kit()->id().toSetting());
|
||||
setConfigValue("LastExternalStartScript", dlg.overrideStartScript());
|
||||
setConfigValue("LastSysRoot", dlg.sysRoot().toString());
|
||||
setConfigValue("LastExternalStartScript", dlg.overrideStartScript().toVariant());
|
||||
setConfigValue("LastSysRoot", dlg.sysRoot().toVariant());
|
||||
setConfigValue("LastForceLocalCoreFile", dlg.forcesLocalCoreFile());
|
||||
|
||||
auto runControl = new RunControl(ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||
runControl->setKit(dlg.kit());
|
||||
runControl->setDisplayName(tr("Core file \"%1\"")
|
||||
.arg(dlg.useLocalCoreFile() ? dlg.localCoreFile() : dlg.remoteCoreFile()));
|
||||
.arg(dlg.useLocalCoreFile() ? dlg.localCoreFile().toUserOutput()
|
||||
: dlg.remoteCoreFile().toUserOutput()));
|
||||
auto debugger = new DebuggerRunTool(runControl);
|
||||
debugger->setInferiorExecutable(dlg.symbolFile());
|
||||
debugger->setCoreFileName(dlg.localCoreFile());
|
||||
debugger->setCoreFilePath(dlg.localCoreFile());
|
||||
debugger->setStartMode(AttachToCore);
|
||||
debugger->setCloseMode(DetachAtClose);
|
||||
debugger->setOverrideStartScript(dlg.overrideStartScript());
|
||||
|
@@ -108,11 +108,11 @@ static QString noDebuggerInKitMessage()
|
||||
class CoreUnpacker final : public RunWorker
|
||||
{
|
||||
public:
|
||||
CoreUnpacker(RunControl *runControl, const QString &coreFileName)
|
||||
: RunWorker(runControl), m_coreFileName(coreFileName)
|
||||
CoreUnpacker(RunControl *runControl, const FilePath &coreFilePath)
|
||||
: RunWorker(runControl), m_coreFilePath(coreFilePath)
|
||||
{}
|
||||
|
||||
QString coreFileName() const { return m_tempCoreFileName; }
|
||||
FilePath coreFileName() const { return m_tempCoreFilePath; }
|
||||
|
||||
private:
|
||||
~CoreUnpacker() final
|
||||
@@ -123,7 +123,7 @@ private:
|
||||
if (m_tempCoreFile.isOpen())
|
||||
m_tempCoreFile.close();
|
||||
|
||||
QFile::remove(m_tempCoreFileName);
|
||||
m_tempCoreFilePath.removeFile();
|
||||
}
|
||||
|
||||
void start() final
|
||||
@@ -131,40 +131,41 @@ private:
|
||||
{
|
||||
Utils::TemporaryFile tmp("tmpcore-XXXXXX");
|
||||
tmp.open();
|
||||
m_tempCoreFileName = tmp.fileName();
|
||||
m_tempCoreFilePath = FilePath::fromString(tmp.fileName());
|
||||
}
|
||||
|
||||
m_coreUnpackProcess.setWorkingDirectory(FilePath::fromString(TemporaryDirectory::masterDirectoryPath()));
|
||||
connect(&m_coreUnpackProcess, &QtcProcess::finished, this, &CoreUnpacker::reportStarted);
|
||||
|
||||
const QString msg = DebuggerRunTool::tr("Unpacking core file to %1");
|
||||
appendMessage(msg.arg(m_tempCoreFileName), LogMessageFormat);
|
||||
appendMessage(msg.arg(m_tempCoreFilePath.toUserOutput()), LogMessageFormat);
|
||||
|
||||
if (m_coreFileName.endsWith(".lzo")) {
|
||||
m_coreUnpackProcess.setCommand({"lzop", {"-o", m_tempCoreFileName, "-x", m_coreFileName}});
|
||||
if (m_coreFilePath.endsWith(".lzo")) {
|
||||
m_coreUnpackProcess.setCommand({"lzop", {"-o", m_tempCoreFilePath.path(),
|
||||
"-x", m_coreFilePath.path()}});
|
||||
m_coreUnpackProcess.start();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_coreFileName.endsWith(".gz")) {
|
||||
appendMessage(msg.arg(m_tempCoreFileName), LogMessageFormat);
|
||||
m_tempCoreFile.setFileName(m_tempCoreFileName);
|
||||
if (m_coreFilePath.endsWith(".gz")) {
|
||||
appendMessage(msg.arg(m_tempCoreFilePath.toUserOutput()), LogMessageFormat);
|
||||
m_tempCoreFile.setFileName(m_tempCoreFilePath.path());
|
||||
m_tempCoreFile.open(QFile::WriteOnly);
|
||||
connect(&m_coreUnpackProcess, &QtcProcess::readyReadStandardOutput, this, [this] {
|
||||
m_tempCoreFile.write(m_coreUnpackProcess.readAllStandardOutput());
|
||||
});
|
||||
m_coreUnpackProcess.setCommand({"gzip", {"-c", "-d", m_coreFileName}});
|
||||
m_coreUnpackProcess.setCommand({"gzip", {"-c", "-d", m_coreFilePath.path()}});
|
||||
m_coreUnpackProcess.start();
|
||||
return;
|
||||
}
|
||||
|
||||
QTC_CHECK(false);
|
||||
reportFailure("Unknown file extension in " + m_coreFileName);
|
||||
reportFailure("Unknown file extension in " + m_coreFilePath.toUserOutput());
|
||||
}
|
||||
|
||||
QFile m_tempCoreFile;
|
||||
QString m_coreFileName;
|
||||
QString m_tempCoreFileName;
|
||||
FilePath m_coreFilePath;
|
||||
FilePath m_tempCoreFilePath;
|
||||
QtcProcess m_coreUnpackProcess;
|
||||
};
|
||||
|
||||
@@ -369,7 +370,7 @@ void DebuggerRunTool::setTestCase(int testCase)
|
||||
m_runParameters.testCase = testCase;
|
||||
}
|
||||
|
||||
void DebuggerRunTool::setOverrideStartScript(const QString &script)
|
||||
void DebuggerRunTool::setOverrideStartScript(const FilePath &script)
|
||||
{
|
||||
m_runParameters.overrideStartScript = script;
|
||||
}
|
||||
@@ -409,7 +410,7 @@ void DebuggerRunTool::setStartMessage(const QString &msg)
|
||||
m_runParameters.startMessage = msg;
|
||||
}
|
||||
|
||||
void DebuggerRunTool::setCoreFileName(const QString &coreFile, bool isSnapshot)
|
||||
void DebuggerRunTool::setCoreFilePath(const FilePath &coreFile, bool isSnapshot)
|
||||
{
|
||||
if (coreFile.endsWith(".gz") || coreFile.endsWith(".lzo")) {
|
||||
d->coreUnpacker = new CoreUnpacker(runControl(), coreFile);
|
||||
@@ -588,7 +589,7 @@ void DebuggerRunTool::start()
|
||||
auto debugger = new DebuggerRunTool(rc);
|
||||
debugger->setStartMode(AttachToCore);
|
||||
debugger->setRunControlName(name);
|
||||
debugger->setCoreFileName(coreFile, true);
|
||||
debugger->setCoreFilePath(FilePath::fromString(coreFile), true);
|
||||
debugger->startRunControl();
|
||||
});
|
||||
|
||||
@@ -962,7 +963,7 @@ void DebuggerRunTool::addSolibSearchDir(const QString &str)
|
||||
DebuggerRunTool::~DebuggerRunTool()
|
||||
{
|
||||
if (m_runParameters.isSnapshot && !m_runParameters.coreFile.isEmpty())
|
||||
QFile::remove(m_runParameters.coreFile);
|
||||
m_runParameters.coreFile.removeFile();
|
||||
|
||||
delete m_engine2;
|
||||
m_engine2 = nullptr;
|
||||
|
@@ -119,13 +119,13 @@ public:
|
||||
void setQmlServer(const QUrl &qmlServer);
|
||||
QUrl qmlServer() const; // Used in GammaRay integration.
|
||||
|
||||
void setCoreFileName(const QString &core, bool isSnapshot = false);
|
||||
void setCoreFilePath(const Utils::FilePath &core, bool isSnapshot = false);
|
||||
|
||||
void setIosPlatform(const QString &platform);
|
||||
void setDeviceSymbolsRoot(const QString &deviceSymbolsRoot);
|
||||
|
||||
void setTestCase(int testCase);
|
||||
void setOverrideStartScript(const QString &script);
|
||||
void setOverrideStartScript(const Utils::FilePath &script);
|
||||
|
||||
void setAbi(const ProjectExplorer::Abi &abi);
|
||||
|
||||
|
@@ -245,7 +245,7 @@ QVariant EngineItem::data(int column, int role) const
|
||||
return myName;
|
||||
}
|
||||
case 1:
|
||||
return rp.coreFile.isEmpty() ? rp.inferior.command.executable().toUserOutput() : rp.coreFile;
|
||||
return (rp.coreFile.isEmpty() ? rp.inferior.command.executable() : rp.coreFile).toUserOutput();
|
||||
}
|
||||
return QVariant();
|
||||
|
||||
|
@@ -4018,17 +4018,17 @@ void GdbEngine::handleGdbStartFailed()
|
||||
|
||||
void GdbEngine::loadInitScript()
|
||||
{
|
||||
const QString script = runParameters().overrideStartScript;
|
||||
const FilePath script = runParameters().overrideStartScript;
|
||||
if (!script.isEmpty()) {
|
||||
if (QFileInfo(script).isReadable()) {
|
||||
runCommand({"source " + script});
|
||||
if (script.isReadableFile()) {
|
||||
runCommand({"source " + script.path()});
|
||||
} else {
|
||||
AsynchronousMessageBox::warning(
|
||||
tr("Cannot Find Debugger Initialization Script"),
|
||||
tr("The debugger settings point to a script file at \"%1\", "
|
||||
"which is not accessible. If a script file is not needed, "
|
||||
"consider clearing that entry to avoid this warning."
|
||||
).arg(script));
|
||||
).arg(script.toUserOutput()));
|
||||
}
|
||||
} else {
|
||||
const QString commands = nativeStartupCommands().trimmed();
|
||||
@@ -4537,7 +4537,7 @@ void GdbEngine::runEngine()
|
||||
} else if (isCoreEngine()) {
|
||||
|
||||
claimInitialBreakpoints();
|
||||
runCommand({"target core " + runParameters().coreFile, CB(handleTargetCore)});
|
||||
runCommand({"target core " + runParameters().coreFile.path(), CB(handleTargetCore)});
|
||||
|
||||
} else if (isTermEngine()) {
|
||||
|
||||
@@ -4714,12 +4714,12 @@ void GdbEngine::handleFileExecAndSymbols(const DebuggerResponse &response)
|
||||
|
||||
} else if (isCoreEngine()) {
|
||||
|
||||
QString core = runParameters().coreFile;
|
||||
const FilePath core = runParameters().coreFile;
|
||||
if (response.resultClass == ResultDone) {
|
||||
showMessage(tr("Symbols found."), StatusBar);
|
||||
handleInferiorPrepared();
|
||||
} else {
|
||||
QString msg = tr("No symbols found in the core file \"%1\".").arg(core)
|
||||
QString msg = tr("No symbols found in the core file \"%1\".").arg(core.toUserOutput())
|
||||
+ ' ' + tr("This can be caused by a path length limitation "
|
||||
"in the core file.")
|
||||
+ ' ' + tr("Try to specify the binary in "
|
||||
@@ -4956,41 +4956,35 @@ void GdbEngine::handleStubAttached(const DebuggerResponse &response, qint64 main
|
||||
}
|
||||
}
|
||||
|
||||
static QString findExecutableFromName(const QString &fileNameFromCore, const QString &coreFile)
|
||||
static FilePath findExecutableFromName(const QString &fileNameFromCore, const FilePath &coreFile)
|
||||
{
|
||||
if (fileNameFromCore.isEmpty())
|
||||
return fileNameFromCore;
|
||||
QFileInfo fi(fileNameFromCore);
|
||||
if (fi.isFile())
|
||||
return fileNameFromCore;
|
||||
return {};
|
||||
|
||||
FilePath filePathFromCore = FilePath::fromUserInput(fileNameFromCore);
|
||||
if (filePathFromCore.isFile())
|
||||
return filePathFromCore;
|
||||
|
||||
// turn the filename into an absolute path, using the location of the core as a hint
|
||||
QString absPath;
|
||||
if (fi.isAbsolute()) {
|
||||
absPath = fileNameFromCore;
|
||||
} else {
|
||||
QFileInfo coreInfo(coreFile);
|
||||
FilePath coreDir = FilePath::fromString(coreInfo.dir().absolutePath());
|
||||
absPath = coreDir.resolvePath(fileNameFromCore).toString();
|
||||
}
|
||||
if (QFileInfo(absPath).isFile() || absPath.isEmpty())
|
||||
const FilePath coreDir = coreFile.absoluteFilePath().parentDir();
|
||||
const FilePath absPath = coreDir.resolvePath(fileNameFromCore);
|
||||
|
||||
if (absPath.isFile() || absPath.isEmpty())
|
||||
return absPath;
|
||||
|
||||
// remove possible trailing arguments
|
||||
QChar sep(' ');
|
||||
QStringList pathFragments = absPath.split(sep);
|
||||
QStringList pathFragments = absPath.path().split(' ');
|
||||
while (pathFragments.size() > 0) {
|
||||
QString joined_path = pathFragments.join(sep);
|
||||
if (QFileInfo(joined_path).isFile()) {
|
||||
const FilePath joined_path = FilePath::fromString(pathFragments.join(' '));
|
||||
if (joined_path.isFile())
|
||||
return joined_path;
|
||||
}
|
||||
pathFragments.pop_back();
|
||||
}
|
||||
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
CoreInfo CoreInfo::readExecutableNameFromCore(const Runnable &debugger, const QString &coreFile)
|
||||
CoreInfo CoreInfo::readExecutableNameFromCore(const Runnable &debugger, const FilePath &coreFile)
|
||||
{
|
||||
CoreInfo cinfo;
|
||||
#if 0
|
||||
@@ -5002,7 +4996,7 @@ CoreInfo CoreInfo::readExecutableNameFromCore(const Runnable &debugger, const QS
|
||||
// Multiarch GDB on Windows crashes if osabi is cygwin (the default) when opening a core dump.
|
||||
if (HostOsInfo::isWindowsHost())
|
||||
args += {"-ex", "set osabi GNU/Linux"};
|
||||
args += {"-ex", "core " + coreFile};
|
||||
args += {"-ex", "core " + coreFile.toUserOutput()};
|
||||
|
||||
QtcProcess proc;
|
||||
Environment envLang(Environment::systemEnvironment());
|
||||
@@ -5022,8 +5016,7 @@ CoreInfo CoreInfo::readExecutableNameFromCore(const Runnable &debugger, const QS
|
||||
if (pos2 != -1) {
|
||||
cinfo.isCore = true;
|
||||
cinfo.rawStringFromCore = output.mid(pos1, pos2 - pos1);
|
||||
cinfo.foundExecutableName =
|
||||
FilePath::fromString(findExecutableFromName(cinfo.rawStringFromCore, coreFile));
|
||||
cinfo.foundExecutableName = findExecutableFromName(cinfo.rawStringFromCore, coreFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5040,7 +5033,7 @@ void GdbEngine::handleTargetCore(const DebuggerResponse &response)
|
||||
// We'll accept any kind of error e.g. &"Cannot access memory at address 0x2abc2a24\n"
|
||||
// Even without the stack, the user can find interesting stuff by exploring
|
||||
// the memory, globals etc.
|
||||
showStatusMessage(tr("Attach to core \"%1\" failed:").arg(runParameters().coreFile)
|
||||
showStatusMessage(tr("Attach to core \"%1\" failed:").arg(runParameters().coreFile.toUserOutput())
|
||||
+ '\n' + response.data["msg"].data()
|
||||
+ '\n' + tr("Continuing nevertheless."));
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ struct CoreInfo
|
||||
bool isCore = false;
|
||||
|
||||
static CoreInfo readExecutableNameFromCore(const ProjectExplorer::Runnable &debugger,
|
||||
const QString &coreFile);
|
||||
const Utils::FilePath &coreFile);
|
||||
};
|
||||
|
||||
class GdbEngine final : public CppDebuggerEngine
|
||||
|
@@ -73,8 +73,8 @@ public:
|
||||
explicit SelectRemoteFileDialog(QWidget *parent);
|
||||
|
||||
void attachToDevice(Kit *k);
|
||||
QString localFile() const { return m_localFile; }
|
||||
QString remoteFile() const { return m_remoteFile; }
|
||||
FilePath localFile() const { return m_localFile; }
|
||||
FilePath remoteFile() const { return m_remoteFile; }
|
||||
|
||||
private:
|
||||
void handleSftpOperationFinished(SftpJobId, const QString &error);
|
||||
@@ -88,8 +88,8 @@ private:
|
||||
QTreeView *m_fileSystemView;
|
||||
QTextBrowser *m_textBrowser;
|
||||
QDialogButtonBox *m_buttonBox;
|
||||
QString m_localFile;
|
||||
QString m_remoteFile;
|
||||
FilePath m_localFile;
|
||||
FilePath m_remoteFile;
|
||||
SftpJobId m_sftpJobId;
|
||||
};
|
||||
|
||||
@@ -185,12 +185,12 @@ void SelectRemoteFileDialog::selectFile()
|
||||
{
|
||||
Utils::TemporaryFile localFile("remotecore-XXXXXX");
|
||||
localFile.open();
|
||||
m_localFile = localFile.fileName();
|
||||
m_localFile = FilePath::fromString(localFile.fileName());
|
||||
}
|
||||
|
||||
idx = idx.sibling(idx.row(), 1);
|
||||
m_remoteFile = m_fileSystemModel.data(idx, SftpFileSystemModel::PathRole).toString();
|
||||
m_sftpJobId = m_fileSystemModel.downloadFile(idx, m_localFile);
|
||||
m_remoteFile = FilePath::fromVariant(m_fileSystemModel.data(idx, SftpFileSystemModel::PathRole));
|
||||
m_sftpJobId = m_fileSystemModel.downloadFile(idx, m_localFile.toString());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
@@ -372,11 +372,12 @@ bool AttachCoreDialog::useLocalCoreFile() const
|
||||
|
||||
void AttachCoreDialog::coreFileChanged(const QString &core)
|
||||
{
|
||||
if (!HostOsInfo::isWindowsHost() && QFile::exists(core)) {
|
||||
const FilePath coreFile = FilePath::fromUserInput(core);
|
||||
if (coreFile.osType() != OsType::OsTypeWindows && coreFile.exists()) {
|
||||
Kit *k = d->kitChooser->currentKit();
|
||||
QTC_ASSERT(k, return);
|
||||
Runnable debugger = DebuggerKitAspect::runnable(k);
|
||||
CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(debugger, core);
|
||||
CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(debugger, coreFile);
|
||||
if (!cinfo.foundExecutableName.isEmpty())
|
||||
d->symbolFileName->setFilePath(cinfo.foundExecutableName);
|
||||
else if (!d->symbolFileName->isValid() && !cinfo.rawStringFromCore.isEmpty())
|
||||
@@ -413,14 +414,14 @@ void AttachCoreDialog::selectRemoteCoreFile()
|
||||
dlg.attachToDevice(d->kitChooser->currentKit());
|
||||
if (dlg.exec() == QDialog::Rejected)
|
||||
return;
|
||||
d->localCoreFileName->setPath(dlg.localFile());
|
||||
d->remoteCoreFileName->setText(dlg.remoteFile());
|
||||
d->localCoreFileName->setFilePath(dlg.localFile());
|
||||
d->remoteCoreFileName->setText(dlg.remoteFile().toUserOutput());
|
||||
changed();
|
||||
}
|
||||
|
||||
QString AttachCoreDialog::localCoreFile() const
|
||||
FilePath AttachCoreDialog::localCoreFile() const
|
||||
{
|
||||
return d->localCoreFileName->filePath().toString();
|
||||
return d->localCoreFileName->filePath();
|
||||
}
|
||||
|
||||
FilePath AttachCoreDialog::symbolFile() const
|
||||
@@ -428,24 +429,24 @@ FilePath AttachCoreDialog::symbolFile() const
|
||||
return d->symbolFileName->filePath();
|
||||
}
|
||||
|
||||
void AttachCoreDialog::setSymbolFile(const QString &symbolFileName)
|
||||
void AttachCoreDialog::setSymbolFile(const FilePath &symbolFilePath)
|
||||
{
|
||||
d->symbolFileName->setPath(symbolFileName);
|
||||
d->symbolFileName->setFilePath(symbolFilePath);
|
||||
}
|
||||
|
||||
void AttachCoreDialog::setLocalCoreFile(const QString &fileName)
|
||||
void AttachCoreDialog::setLocalCoreFile(const FilePath &coreFilePath)
|
||||
{
|
||||
d->localCoreFileName->setPath(fileName);
|
||||
d->localCoreFileName->setFilePath(coreFilePath);
|
||||
}
|
||||
|
||||
void AttachCoreDialog::setRemoteCoreFile(const QString &fileName)
|
||||
void AttachCoreDialog::setRemoteCoreFile(const FilePath &coreFilePath)
|
||||
{
|
||||
d->remoteCoreFileName->setText(fileName);
|
||||
d->remoteCoreFileName->setText(coreFilePath.toUserOutput());
|
||||
}
|
||||
|
||||
QString AttachCoreDialog::remoteCoreFile() const
|
||||
FilePath AttachCoreDialog::remoteCoreFile() const
|
||||
{
|
||||
return d->remoteCoreFileName->text();
|
||||
return FilePath::fromUserInput(d->remoteCoreFileName->text());
|
||||
}
|
||||
|
||||
void AttachCoreDialog::setKitId(Id id)
|
||||
@@ -468,14 +469,14 @@ Kit *AttachCoreDialog::kit() const
|
||||
return d->kitChooser->currentKit();
|
||||
}
|
||||
|
||||
QString AttachCoreDialog::overrideStartScript() const
|
||||
FilePath AttachCoreDialog::overrideStartScript() const
|
||||
{
|
||||
return d->overrideStartScriptFileName->filePath().toString();
|
||||
return d->overrideStartScriptFileName->filePath();
|
||||
}
|
||||
|
||||
void AttachCoreDialog::setOverrideStartScript(const QString &scriptName)
|
||||
void AttachCoreDialog::setOverrideStartScript(const FilePath &scriptName)
|
||||
{
|
||||
d->overrideStartScriptFileName->setPath(scriptName);
|
||||
d->overrideStartScriptFileName->setFilePath(scriptName);
|
||||
}
|
||||
|
||||
FilePath AttachCoreDialog::sysRoot() const
|
||||
@@ -483,9 +484,9 @@ FilePath AttachCoreDialog::sysRoot() const
|
||||
return d->sysRootDirectory->filePath();
|
||||
}
|
||||
|
||||
void AttachCoreDialog::setSysRoot(const QString &sysRoot)
|
||||
void AttachCoreDialog::setSysRoot(const FilePath &sysRoot)
|
||||
{
|
||||
d->sysRootDirectory->setPath(sysRoot);
|
||||
d->sysRootDirectory->setFilePath(sysRoot);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -48,9 +48,9 @@ public:
|
||||
int exec() override;
|
||||
|
||||
Utils::FilePath symbolFile() const;
|
||||
QString localCoreFile() const;
|
||||
QString remoteCoreFile() const;
|
||||
QString overrideStartScript() const;
|
||||
Utils::FilePath localCoreFile() const;
|
||||
Utils::FilePath remoteCoreFile() const;
|
||||
Utils::FilePath overrideStartScript() const;
|
||||
Utils::FilePath sysRoot() const;
|
||||
bool useLocalCoreFile() const;
|
||||
bool forcesLocalCoreFile() const;
|
||||
@@ -58,11 +58,11 @@ public:
|
||||
|
||||
// For persistance.
|
||||
ProjectExplorer::Kit *kit() const;
|
||||
void setSymbolFile(const QString &symbolFileName);
|
||||
void setLocalCoreFile(const QString &core);
|
||||
void setRemoteCoreFile(const QString &core);
|
||||
void setOverrideStartScript(const QString &scriptName);
|
||||
void setSysRoot(const QString &sysRoot);
|
||||
void setSymbolFile(const Utils::FilePath &symbolFilePath);
|
||||
void setLocalCoreFile(const Utils::FilePath &coreFilePath);
|
||||
void setRemoteCoreFile(const Utils::FilePath &coreFilePath);
|
||||
void setOverrideStartScript(const Utils::FilePath &scriptName);
|
||||
void setSysRoot(const Utils::FilePath &sysRoot);
|
||||
void setKitId(Utils::Id id);
|
||||
void setForceLocalCoreFile(bool on);
|
||||
|
||||
|
Reference in New Issue
Block a user