forked from qt-creator/qt-creator
Debugger: Transform DebuggerRunParameters::coreFile
Make a separate setter/getter for isSnapshot. Task-number: QTCREATORBUG-29168 Change-Id: Iebcf4a4e988b0c90c46399e8799a4cf8c25ab100 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -377,7 +377,7 @@ void CdbEngine::setupEngine()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AttachToCore:
|
case AttachToCore:
|
||||||
debugger.addArgs({"-z", sp.coreFile.path()});
|
debugger.addArgs({"-z", sp.coreFile().path()});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
handleSetupFailure(QString("Internal error: Unsupported start mode %1.").arg(sp.startMode()));
|
handleSetupFailure(QString("Internal error: Unsupported start mode %1.").arg(sp.startMode()));
|
||||||
|
@@ -109,7 +109,7 @@ QDebug operator<<(QDebug str, const DebuggerRunParameters &rp)
|
|||||||
{
|
{
|
||||||
QDebug nospace = str.nospace();
|
QDebug nospace = str.nospace();
|
||||||
nospace << "executable=" << rp.inferior().command.executable()
|
nospace << "executable=" << rp.inferior().command.executable()
|
||||||
<< " coreFile=" << rp.coreFile
|
<< " coreFile=" << rp.coreFile()
|
||||||
<< " processArgs=" << rp.inferior().command.arguments()
|
<< " processArgs=" << rp.inferior().command.arguments()
|
||||||
<< " inferior environment=<" << rp.inferior().environment.toStringList().size() << " variables>"
|
<< " inferior environment=<" << rp.inferior().environment.toStringList().size() << " variables>"
|
||||||
<< " debugger environment=<" << rp.debugger.environment.toStringList().size() << " variables>"
|
<< " debugger environment=<" << rp.debugger.environment.toStringList().size() << " variables>"
|
||||||
@@ -2912,8 +2912,8 @@ QString DebuggerEngine::formatStartParameters() const
|
|||||||
}
|
}
|
||||||
if (!rp.debugger.command.isEmpty())
|
if (!rp.debugger.command.isEmpty())
|
||||||
str << "Debugger: " << rp.debugger.command.toUserOutput() << '\n';
|
str << "Debugger: " << rp.debugger.command.toUserOutput() << '\n';
|
||||||
if (!rp.coreFile.isEmpty())
|
if (!rp.coreFile().isEmpty())
|
||||||
str << "Core: " << rp.coreFile.toUserOutput() << '\n';
|
str << "Core: " << rp.coreFile().toUserOutput() << '\n';
|
||||||
if (rp.attachPid().isValid())
|
if (rp.attachPid().isValid())
|
||||||
str << "PID: " << rp.attachPid().pid() << ' ' << rp.crashParameter << '\n';
|
str << "PID: " << rp.attachPid().pid() << ' ' << rp.crashParameter << '\n';
|
||||||
if (!rp.projectSourceDirectory.isEmpty()) {
|
if (!rp.projectSourceDirectory.isEmpty()) {
|
||||||
|
@@ -170,8 +170,11 @@ public:
|
|||||||
void setDeviceUuid(const QString &uuid) { m_deviceUuid = uuid; }
|
void setDeviceUuid(const QString &uuid) { m_deviceUuid = uuid; }
|
||||||
QString deviceUuid() const { return m_deviceUuid; }
|
QString deviceUuid() const { return m_deviceUuid; }
|
||||||
|
|
||||||
// Used by general core file debugging. Public access requested in QTCREATORBUG-17158.
|
void setCoreFilePath(const Utils::FilePath &coreFile) { m_coreFile = coreFile; }
|
||||||
Utils::FilePath coreFile;
|
Utils::FilePath coreFile() const { return m_coreFile; }
|
||||||
|
|
||||||
|
void setSnapshot(bool isSnapshot) { m_isSnapshot = isSnapshot; }
|
||||||
|
bool isSnapshot() const { return m_isSnapshot; }
|
||||||
|
|
||||||
// Macro-expanded and passed to debugger startup.
|
// Macro-expanded and passed to debugger startup.
|
||||||
QString additionalStartupCommands;
|
QString additionalStartupCommands;
|
||||||
@@ -191,7 +194,6 @@ public:
|
|||||||
Utils::FilePath debugInfoLocation; // Gdb "set-debug-file-directory".
|
Utils::FilePath debugInfoLocation; // Gdb "set-debug-file-directory".
|
||||||
QStringList debugSourceLocation; // Gdb "directory"
|
QStringList debugSourceLocation; // Gdb "directory"
|
||||||
Utils::FilePath qtSourceLocation;
|
Utils::FilePath qtSourceLocation;
|
||||||
bool isSnapshot = false; // Set if created internally.
|
|
||||||
ProjectExplorer::Abi toolChainAbi;
|
ProjectExplorer::Abi toolChainAbi;
|
||||||
|
|
||||||
Utils::FilePath projectSourceDirectory;
|
Utils::FilePath projectSourceDirectory;
|
||||||
@@ -273,6 +275,10 @@ private:
|
|||||||
Utils::FilePath m_sysRoot;
|
Utils::FilePath m_sysRoot;
|
||||||
|
|
||||||
QString m_deviceUuid; // iOS 17+
|
QString m_deviceUuid; // iOS 17+
|
||||||
|
|
||||||
|
// Used by general core file debugging. Public access requested in QTCREATORBUG-17158.
|
||||||
|
Utils::FilePath m_coreFile;
|
||||||
|
bool m_isSnapshot = false; // Set if created internally.
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
@@ -1411,7 +1411,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
|
|||||||
} else if (startMode == AttachToCore) {
|
} else if (startMode == AttachToCore) {
|
||||||
rp.setStartMode(AttachToCore);
|
rp.setStartMode(AttachToCore);
|
||||||
rp.setCloseMode(DetachAtClose);
|
rp.setCloseMode(DetachAtClose);
|
||||||
debugger->setCoreFilePath(coreFile);
|
rp.setCoreFilePath(coreFile);
|
||||||
rp.setDisplayName(Tr::tr("Core file \"%1\"").arg(coreFile.toUserOutput()));
|
rp.setDisplayName(Tr::tr("Core file \"%1\"").arg(coreFile.toUserOutput()));
|
||||||
debugger->setStartMessage(Tr::tr("Attaching to core file %1.").arg(coreFile.toUserOutput()));
|
debugger->setStartMessage(Tr::tr("Attaching to core file %1.").arg(coreFile.toUserOutput()));
|
||||||
} else {
|
} else {
|
||||||
@@ -1625,7 +1625,7 @@ void DebuggerPluginPrivate::attachToLastCore()
|
|||||||
auto debugger = new DebuggerRunTool(runControl);
|
auto debugger = new DebuggerRunTool(runControl);
|
||||||
DebuggerRunParameters &rp = debugger->runParameters();
|
DebuggerRunParameters &rp = debugger->runParameters();
|
||||||
rp.setInferiorExecutable(lastCore.binary);
|
rp.setInferiorExecutable(lastCore.binary);
|
||||||
debugger->setCoreFilePath(lastCore.coreFile);
|
rp.setCoreFilePath(lastCore.coreFile);
|
||||||
rp.setStartMode(AttachToCore);
|
rp.setStartMode(AttachToCore);
|
||||||
rp.setCloseMode(DetachAtClose);
|
rp.setCloseMode(DetachAtClose);
|
||||||
|
|
||||||
|
@@ -138,12 +138,6 @@ void DebuggerRunTool::setStartMessage(const QString &msg)
|
|||||||
m_runParameters.startMessage = msg;
|
m_runParameters.startMessage = msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunTool::setCoreFilePath(const FilePath &coreFile, bool isSnapshot)
|
|
||||||
{
|
|
||||||
m_runParameters.coreFile = coreFile;
|
|
||||||
m_runParameters.isSnapshot = isSnapshot;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerRunTool::addQmlServerInferiorCommandLineArgumentIfNeeded()
|
void DebuggerRunTool::addQmlServerInferiorCommandLineArgumentIfNeeded()
|
||||||
{
|
{
|
||||||
d->addQmlServerInferiorCommandLineArgumentIfNeeded = true;
|
d->addQmlServerInferiorCommandLineArgumentIfNeeded = true;
|
||||||
@@ -166,7 +160,7 @@ void DebuggerRunTool::start()
|
|||||||
|
|
||||||
void DebuggerRunTool::startCoreFileSetupIfNeededAndContinueStartup()
|
void DebuggerRunTool::startCoreFileSetupIfNeededAndContinueStartup()
|
||||||
{
|
{
|
||||||
const FilePath coreFile = m_runParameters.coreFile;
|
const FilePath coreFile = m_runParameters.coreFile();
|
||||||
if (!coreFile.endsWith(".gz") && !coreFile.endsWith(".lzo")) {
|
if (!coreFile.endsWith(".gz") && !coreFile.endsWith(".lzo")) {
|
||||||
continueAfterCoreFileSetup();
|
continueAfterCoreFileSetup();
|
||||||
return;
|
return;
|
||||||
@@ -181,11 +175,11 @@ void DebuggerRunTool::startCoreFileSetupIfNeededAndContinueStartup()
|
|||||||
d->m_coreUnpackProcess.setWorkingDirectory(TemporaryDirectory::masterDirectoryFilePath());
|
d->m_coreUnpackProcess.setWorkingDirectory(TemporaryDirectory::masterDirectoryFilePath());
|
||||||
connect(&d->m_coreUnpackProcess, &Process::done, this, [this] {
|
connect(&d->m_coreUnpackProcess, &Process::done, this, [this] {
|
||||||
if (d->m_coreUnpackProcess.error() == QProcess::UnknownError) {
|
if (d->m_coreUnpackProcess.error() == QProcess::UnknownError) {
|
||||||
m_runParameters.coreFile = d->m_tempCoreFilePath;
|
m_runParameters.setCoreFilePath(d->m_tempCoreFilePath);
|
||||||
continueAfterCoreFileSetup();
|
continueAfterCoreFileSetup();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
reportFailure("Error unpacking " + m_runParameters.coreFile.toUserOutput());
|
reportFailure("Error unpacking " + m_runParameters.coreFile().toUserOutput());
|
||||||
});
|
});
|
||||||
|
|
||||||
const QString msg = Tr::tr("Unpacking core file to %1");
|
const QString msg = Tr::tr("Unpacking core file to %1");
|
||||||
@@ -441,7 +435,8 @@ void DebuggerRunTool::continueAfterDebugServerStart()
|
|||||||
rp.setStartMode(AttachToCore);
|
rp.setStartMode(AttachToCore);
|
||||||
rp.setCloseMode(DetachAtClose);
|
rp.setCloseMode(DetachAtClose);
|
||||||
rp.setDisplayName(name);
|
rp.setDisplayName(name);
|
||||||
debugger->setCoreFilePath(FilePath::fromString(coreFile), true);
|
rp.setCoreFilePath(FilePath::fromString(coreFile));
|
||||||
|
rp.setSnapshot(true);
|
||||||
rc->start();
|
rc->start();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -602,8 +597,8 @@ DebuggerRunTool::~DebuggerRunTool()
|
|||||||
if (d->m_tempCoreFilePath.exists())
|
if (d->m_tempCoreFilePath.exists())
|
||||||
d->m_tempCoreFilePath.removeFile();
|
d->m_tempCoreFilePath.removeFile();
|
||||||
|
|
||||||
if (m_runParameters.isSnapshot && !m_runParameters.coreFile.isEmpty())
|
if (m_runParameters.isSnapshot() && !m_runParameters.coreFile().isEmpty())
|
||||||
m_runParameters.coreFile.removeFile();
|
m_runParameters.coreFile().removeFile();
|
||||||
|
|
||||||
qDeleteAll(m_engines);
|
qDeleteAll(m_engines);
|
||||||
m_engines.clear();
|
m_engines.clear();
|
||||||
|
@@ -39,8 +39,6 @@ public:
|
|||||||
|
|
||||||
void setDebugInfoLocation(const Utils::FilePath &debugInfoLocation);
|
void setDebugInfoLocation(const Utils::FilePath &debugInfoLocation);
|
||||||
|
|
||||||
void setCoreFilePath(const Utils::FilePath &core, bool isSnapshot = false);
|
|
||||||
|
|
||||||
void setTestCase(int testCase);
|
void setTestCase(int testCase);
|
||||||
void setOverrideStartScript(const Utils::FilePath &script);
|
void setOverrideStartScript(const Utils::FilePath &script);
|
||||||
|
|
||||||
|
@@ -353,7 +353,7 @@ QVariant EngineItem::data(int column, int role) const
|
|||||||
return myName;
|
return myName;
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
return (rp.coreFile.isEmpty() ? rp.inferior().command.executable() : rp.coreFile).toUserOutput();
|
return (rp.coreFile().isEmpty() ? rp.inferior().command.executable() : rp.coreFile()).toUserOutput();
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
|
@@ -4524,7 +4524,7 @@ void GdbEngine::setupInferior()
|
|||||||
FilePath executable = rp.inferior().command.executable();
|
FilePath executable = rp.inferior().command.executable();
|
||||||
|
|
||||||
if (executable.isEmpty()) {
|
if (executable.isEmpty()) {
|
||||||
CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(rp.debugger, rp.coreFile);
|
CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(rp.debugger, rp.coreFile());
|
||||||
|
|
||||||
if (!cinfo.isCore) {
|
if (!cinfo.isCore) {
|
||||||
AsynchronousMessageBox::warning(Tr::tr("Error Loading Core File"),
|
AsynchronousMessageBox::warning(Tr::tr("Error Loading Core File"),
|
||||||
@@ -4626,7 +4626,7 @@ void GdbEngine::runEngine()
|
|||||||
} else if (isCoreEngine()) {
|
} else if (isCoreEngine()) {
|
||||||
|
|
||||||
claimInitialBreakpoints();
|
claimInitialBreakpoints();
|
||||||
runCommand({"target core " + runParameters().coreFile.path(), CB(handleTargetCore)});
|
runCommand({"target core " + runParameters().coreFile().path(), CB(handleTargetCore)});
|
||||||
|
|
||||||
} else if (isTermEngine()) {
|
} else if (isTermEngine()) {
|
||||||
|
|
||||||
@@ -4802,7 +4802,7 @@ void GdbEngine::handleFileExecAndSymbols(const DebuggerResponse &response)
|
|||||||
|
|
||||||
} else if (isCoreEngine()) {
|
} else if (isCoreEngine()) {
|
||||||
|
|
||||||
const FilePath core = runParameters().coreFile;
|
const FilePath core = runParameters().coreFile();
|
||||||
if (response.resultClass == ResultDone) {
|
if (response.resultClass == ResultDone) {
|
||||||
showMessage(Tr::tr("Symbols found."), StatusBar);
|
showMessage(Tr::tr("Symbols found."), StatusBar);
|
||||||
handleInferiorPrepared();
|
handleInferiorPrepared();
|
||||||
@@ -5128,7 +5128,7 @@ void GdbEngine::handleTargetCore(const DebuggerResponse &response)
|
|||||||
// Even without the stack, the user can find interesting stuff by exploring
|
// Even without the stack, the user can find interesting stuff by exploring
|
||||||
// the memory, globals etc.
|
// the memory, globals etc.
|
||||||
showStatusMessage(
|
showStatusMessage(
|
||||||
Tr::tr("Attach to core \"%1\" failed:").arg(runParameters().coreFile.toUserOutput())
|
Tr::tr("Attach to core \"%1\" failed:").arg(runParameters().coreFile().toUserOutput())
|
||||||
+ '\n' + response.data["msg"].data() + '\n' + Tr::tr("Continuing nevertheless."));
|
+ '\n' + response.data["msg"].data() + '\n' + Tr::tr("Continuing nevertheless."));
|
||||||
}
|
}
|
||||||
// Due to the auto-solib-add off setting, we don't have any
|
// Due to the auto-solib-add off setting, we don't have any
|
||||||
|
@@ -359,7 +359,7 @@ void LldbEngine::runEngine()
|
|||||||
showStatusMessage(Tr::tr("Running requested..."), 5000);
|
showStatusMessage(Tr::tr("Running requested..."), 5000);
|
||||||
DebuggerCommand cmd("runEngine");
|
DebuggerCommand cmd("runEngine");
|
||||||
if (rp.startMode() == AttachToCore)
|
if (rp.startMode() == AttachToCore)
|
||||||
cmd.arg("coreFile", rp.coreFile.path());
|
cmd.arg("coreFile", rp.coreFile().path());
|
||||||
runCommand(cmd);
|
runCommand(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -352,7 +352,7 @@ void runAttachToCoreDialog()
|
|||||||
auto debugger = new DebuggerRunTool(runControl);
|
auto debugger = new DebuggerRunTool(runControl);
|
||||||
DebuggerRunParameters &rp = debugger->runParameters();
|
DebuggerRunParameters &rp = debugger->runParameters();
|
||||||
rp.setInferiorExecutable(dlg.symbolFileCopy());
|
rp.setInferiorExecutable(dlg.symbolFileCopy());
|
||||||
debugger->setCoreFilePath(dlg.coreFileCopy());
|
rp.setCoreFilePath(dlg.coreFileCopy());
|
||||||
rp.setStartMode(AttachToCore);
|
rp.setStartMode(AttachToCore);
|
||||||
rp.setCloseMode(DetachAtClose);
|
rp.setCloseMode(DetachAtClose);
|
||||||
debugger->setOverrideStartScript(dlg.overrideStartScript());
|
debugger->setOverrideStartScript(dlg.overrideStartScript());
|
||||||
|
Reference in New Issue
Block a user