forked from qt-creator/qt-creator
Debugger: Transform DebuggerRunParameters::debugger
Task-number: QTCREATORBUG-29168 Change-Id: I2b2463c08c18c4e7c05168738addb7d80b062b9e Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -295,14 +295,14 @@ void CdbEngine::setupEngine()
|
||||
// Determine binary (force MSVC), extension lib name and path to use
|
||||
// The extension is passed as relative name with the path variable set
|
||||
//(does not work with absolute path names)
|
||||
if (sp.debugger.command.isEmpty()) {
|
||||
if (sp.debugger().command.isEmpty()) {
|
||||
handleSetupFailure(Tr::tr("There is no CDB executable specified."));
|
||||
return;
|
||||
}
|
||||
|
||||
bool cdbIs64Bit = true;
|
||||
bool cdbIsArm = false;
|
||||
Abis abisOfCdb = Abi::abisOfBinary(sp.debugger.command.executable());
|
||||
Abis abisOfCdb = Abi::abisOfBinary(sp.debugger().command.executable());
|
||||
if (abisOfCdb.size() == 1) {
|
||||
Abi abi = abisOfCdb.at(0);
|
||||
cdbIs64Bit = abi.wordWidth() == 64;
|
||||
@@ -327,7 +327,7 @@ void CdbEngine::setupEngine()
|
||||
}
|
||||
|
||||
// Prepare command line.
|
||||
CommandLine debugger{sp.debugger.command};
|
||||
CommandLine debugger{sp.debugger().command};
|
||||
|
||||
m_extensionFileName = extensionFi.fileName();
|
||||
const bool isRemote = sp.startMode() == AttachToRemoteServer;
|
||||
@@ -421,7 +421,7 @@ void CdbEngine::setupEngine()
|
||||
void CdbEngine::processStarted()
|
||||
{
|
||||
const qint64 pid = m_process.processId();
|
||||
const FilePath execPath = runParameters().debugger.command.executable();
|
||||
const FilePath execPath = runParameters().debugger().command.executable();
|
||||
showMessage(QString("%1 running as %2").arg(execPath.toUserOutput()).arg(pid), LogMisc);
|
||||
m_hasDebuggee = true;
|
||||
m_initialSessionIdleHandled = false;
|
||||
|
@@ -57,9 +57,9 @@ public:
|
||||
void start() override
|
||||
{
|
||||
m_proc.setProcessMode(ProcessMode::Writer);
|
||||
if (m_runParameters.debugger.workingDirectory.isDir())
|
||||
m_proc.setWorkingDirectory(m_runParameters.debugger.workingDirectory);
|
||||
m_proc.setEnvironment(m_runParameters.debugger.environment);
|
||||
if (m_runParameters.debugger().workingDirectory.isDir())
|
||||
m_proc.setWorkingDirectory(m_runParameters.debugger().workingDirectory);
|
||||
m_proc.setEnvironment(m_runParameters.debugger().environment);
|
||||
m_proc.setCommand(m_cmd);
|
||||
m_proc.start();
|
||||
}
|
||||
@@ -138,7 +138,7 @@ void GdbDapEngine::setupEngine()
|
||||
QTC_ASSERT(state() == EngineSetupRequested, qCDebug(logCategory()) << state());
|
||||
|
||||
const DebuggerRunParameters &rp = runParameters();
|
||||
CommandLine cmd{rp.debugger.command.executable(), {"-i", "dap"}};
|
||||
CommandLine cmd{rp.debugger().command.executable(), {"-i", "dap"}};
|
||||
|
||||
if (runParameters().isLocalAttachEngine())
|
||||
cmd.addArgs({"-p", QString::number(rp.attachPid().pid())});
|
||||
|
@@ -61,9 +61,9 @@ public:
|
||||
void start() override
|
||||
{
|
||||
m_proc.setProcessMode(ProcessMode::Writer);
|
||||
if (m_runParameters.debugger.workingDirectory.isDir())
|
||||
m_proc.setWorkingDirectory(m_runParameters.debugger.workingDirectory);
|
||||
m_proc.setEnvironment(m_runParameters.debugger.environment);
|
||||
if (m_runParameters.debugger().workingDirectory.isDir())
|
||||
m_proc.setWorkingDirectory(m_runParameters.debugger().workingDirectory);
|
||||
m_proc.setEnvironment(m_runParameters.debugger().environment);
|
||||
m_proc.setCommand(m_cmd);
|
||||
m_proc.start();
|
||||
}
|
||||
@@ -207,7 +207,7 @@ void LldbDapEngine::setupEngine()
|
||||
QTC_ASSERT(state() == EngineSetupRequested, qCDebug(logCategory()) << state());
|
||||
|
||||
const DebuggerRunParameters &rp = runParameters();
|
||||
CommandLine cmd{rp.debugger.command.executable()};
|
||||
CommandLine cmd{rp.debugger().command.executable()};
|
||||
|
||||
IDataProvider *dataProvider = new ProcessDataProvider(rp, cmd, this);
|
||||
m_dapClient = new LldbDapClient(dataProvider, this);
|
||||
|
@@ -80,7 +80,7 @@ public:
|
||||
|
||||
void start() override
|
||||
{
|
||||
Environment env = m_runParameters.debugger.environment;
|
||||
Environment env = m_runParameters.debugger().environment;
|
||||
const FilePath debugPyDir = packageDir(m_cmd.executable(), "debugpy");
|
||||
if (QTC_GUARD(debugPyDir.isSameDevice(m_cmd.executable()))) {
|
||||
env.appendOrSet("PYTHONPATH", debugPyDir.path());
|
||||
|
@@ -112,7 +112,7 @@ QDebug operator<<(QDebug str, const DebuggerRunParameters &rp)
|
||||
<< " coreFile=" << rp.coreFile()
|
||||
<< " processArgs=" << rp.inferior().command.arguments()
|
||||
<< " inferior environment=<" << rp.inferior().environment.toStringList().size() << " variables>"
|
||||
<< " debugger environment=<" << rp.debugger.environment.toStringList().size() << " variables>"
|
||||
<< " debugger environment=<" << rp.debugger().environment.toStringList().size() << " variables>"
|
||||
<< " workingDir=" << rp.inferior().workingDirectory
|
||||
<< " attachPID=" << rp.attachPid().pid()
|
||||
<< " remoteChannel=" << rp.remoteChannel()
|
||||
@@ -138,7 +138,7 @@ DebuggerRunParameters DebuggerRunParameters::fromRunControl(ProjectExplorer::Run
|
||||
|
||||
params.setSysRoot(SysRootKitAspect::sysRoot(kit));
|
||||
params.macroExpander = runControl->macroExpander();
|
||||
params.debugger = DebuggerKitAspect::runnable(kit);
|
||||
params.m_debugger = DebuggerKitAspect::runnable(kit);
|
||||
params.m_cppEngineType = DebuggerKitAspect::engineType(kit);
|
||||
params.m_version = DebuggerKitAspect::version(kit);
|
||||
|
||||
@@ -173,13 +173,13 @@ DebuggerRunParameters DebuggerRunParameters::fromRunControl(ProjectExplorer::Run
|
||||
|
||||
const QString envBinary = qtcEnvironmentVariable("QTC_DEBUGGER_PATH");
|
||||
if (!envBinary.isEmpty())
|
||||
params.debugger.command.setExecutable(FilePath::fromString(envBinary));
|
||||
params.m_debugger.command.setExecutable(FilePath::fromString(envBinary));
|
||||
|
||||
if (Project *project = runControl->project()) {
|
||||
params.projectSourceDirectory = project->projectDirectory();
|
||||
params.projectSourceFiles = project->files(Project::SourceFiles);
|
||||
} else {
|
||||
params.projectSourceDirectory = params.debugger.command.executable().parentDir();
|
||||
params.projectSourceDirectory = params.debugger().command.executable().parentDir();
|
||||
params.projectSourceFiles.clear();
|
||||
}
|
||||
|
||||
@@ -214,13 +214,13 @@ Result DebuggerRunParameters::fixupParameters(ProjectExplorer::RunControl *runCo
|
||||
|
||||
// Set a Qt Creator-specific environment variable, to able to check for it in debugger
|
||||
// scripts.
|
||||
debugger.environment.set("QTC_DEBUGGER_PROCESS", "1");
|
||||
m_debugger.environment.set("QTC_DEBUGGER_PROCESS", "1");
|
||||
|
||||
// Copy over DYLD_IMAGE_SUFFIX etc
|
||||
for (const auto &var :
|
||||
QStringList({"DYLD_IMAGE_SUFFIX", "DYLD_LIBRARY_PATH", "DYLD_FRAMEWORK_PATH"}))
|
||||
if (m_inferior.environment.hasKey(var))
|
||||
debugger.environment.set(var, m_inferior.environment.expandedValueForKey(var));
|
||||
m_debugger.environment.set(var, m_inferior.environment.expandedValueForKey(var));
|
||||
|
||||
// validate debugger if C++ debugging is enabled
|
||||
if (!validationErrors.isEmpty())
|
||||
@@ -2905,8 +2905,8 @@ QString DebuggerEngine::formatStartParameters() const
|
||||
if (!rp.inferior().workingDirectory.isEmpty())
|
||||
str << "Directory: " << rp.inferior().workingDirectory.toUserOutput() << '\n';
|
||||
}
|
||||
if (!rp.debugger.command.isEmpty())
|
||||
str << "Debugger: " << rp.debugger.command.toUserOutput() << '\n';
|
||||
if (!rp.debugger().command.isEmpty())
|
||||
str << "Debugger: " << rp.debugger().command.toUserOutput() << '\n';
|
||||
if (!rp.coreFile().isEmpty())
|
||||
str << "Core: " << rp.coreFile().toUserOutput() << '\n';
|
||||
if (rp.attachPid().isValid())
|
||||
|
@@ -194,7 +194,8 @@ public:
|
||||
|
||||
bool runAsRoot() const { return m_runAsRoot; }
|
||||
|
||||
Utils::ProcessRunData debugger;
|
||||
Utils::ProcessRunData debugger() const { return m_debugger; };
|
||||
|
||||
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".
|
||||
@@ -298,6 +299,8 @@ private:
|
||||
bool m_multiProcess = false; // Whether to set detach-on-fork off.
|
||||
bool m_useTerminal = false;
|
||||
bool m_runAsRoot = false;
|
||||
|
||||
Utils::ProcessRunData m_debugger;
|
||||
};
|
||||
|
||||
namespace Internal {
|
||||
|
@@ -135,7 +135,7 @@ void DebuggerRunTool::addQmlServerInferiorCommandLineArgumentIfNeeded()
|
||||
|
||||
void DebuggerRunTool::modifyDebuggerEnvironment(const EnvironmentItems &items)
|
||||
{
|
||||
m_runParameters.debugger.environment.modify(items);
|
||||
m_runParameters.debugger().environment.modify(items);
|
||||
}
|
||||
|
||||
void DebuggerRunTool::setCrashParameter(const QString &event)
|
||||
@@ -302,7 +302,7 @@ void DebuggerRunTool::continueAfterTerminalStart()
|
||||
|
||||
if (m_runParameters.cppEngineType() == CdbEngineType
|
||||
&& Utils::is64BitWindowsBinary(m_runParameters.inferior().command.executable())
|
||||
&& !Utils::is64BitWindowsBinary(m_runParameters.debugger.command.executable())) {
|
||||
&& !Utils::is64BitWindowsBinary(m_runParameters.debugger().command.executable())) {
|
||||
reportFailure(
|
||||
Tr::tr(
|
||||
"%1 is a 64 bit executable which can not be debugged by a 32 bit Debugger.\n"
|
||||
|
@@ -693,7 +693,7 @@ void GdbEngine::interruptInferior()
|
||||
notifyInferiorStopFailed();
|
||||
}
|
||||
});
|
||||
signalOperation->setDebuggerCommand(runParameters().debugger.command.executable());
|
||||
signalOperation->setDebuggerCommand(runParameters().debugger().command.executable());
|
||||
signalOperation->interruptProcess(inferiorPid());
|
||||
} else {
|
||||
interruptInferior2();
|
||||
@@ -3831,7 +3831,7 @@ void GdbEngine::setupEngine()
|
||||
if (isRemoteEngine())
|
||||
m_gdbProc.setUseCtrlCStub(rp.useCtrlCStub()); // This is only set for QNX
|
||||
|
||||
CommandLine gdbCommand = rp.debugger.command;
|
||||
CommandLine gdbCommand = rp.debugger().command;
|
||||
if (usesOutputCollector()) {
|
||||
if (!m_outputCollector.listen()) {
|
||||
handleAdapterStartFailed(Tr::tr("Cannot set up communication with child process: %1")
|
||||
@@ -3849,7 +3849,7 @@ void GdbEngine::setupEngine()
|
||||
|
||||
m_expectTerminalTrap = usesTerminal();
|
||||
|
||||
if (rp.debugger.command.isEmpty()) {
|
||||
if (rp.debugger().command.isEmpty()) {
|
||||
handleGdbStartFailed();
|
||||
handleAdapterStartFailed(
|
||||
msgNoGdbBinaryForToolchain(rp.toolChainAbi),
|
||||
@@ -3862,7 +3862,7 @@ void GdbEngine::setupEngine()
|
||||
gdbCommand.addArg("-n");
|
||||
|
||||
// This is filled in DebuggerKitAspect::runnable
|
||||
Environment gdbEnv = rp.debugger.environment;
|
||||
Environment gdbEnv = rp.debugger().environment;
|
||||
gdbEnv.setupEnglishOutput();
|
||||
if (rp.runAsRoot())
|
||||
RunControl::provideAskPassEntry(gdbEnv);
|
||||
@@ -3871,8 +3871,8 @@ void GdbEngine::setupEngine()
|
||||
showMessage("STARTING " + gdbCommand.toUserOutput());
|
||||
|
||||
m_gdbProc.setCommand(gdbCommand);
|
||||
if (rp.debugger.workingDirectory.isDir())
|
||||
m_gdbProc.setWorkingDirectory(rp.debugger.workingDirectory);
|
||||
if (rp.debugger().workingDirectory.isDir())
|
||||
m_gdbProc.setWorkingDirectory(rp.debugger().workingDirectory);
|
||||
m_gdbProc.setEnvironment(gdbEnv);
|
||||
m_gdbProc.start();
|
||||
}
|
||||
@@ -3996,7 +3996,7 @@ void GdbEngine::handleGdbStarted()
|
||||
// runCommand({"set inferior-tty " + QString::fromUtf8(terminal()->slaveDevice())});
|
||||
|
||||
const FilePath dumperPath = ICore::resourcePath("debugger");
|
||||
if (!rp.debugger.command.executable().isLocal()) {
|
||||
if (!rp.debugger().command.executable().isLocal()) {
|
||||
// Gdb itself running remotely.
|
||||
const FilePath loadOrderFile = dumperPath / "loadorder.txt";
|
||||
const expected_str<QByteArray> toLoad = loadOrderFile.fileContents();
|
||||
@@ -4043,7 +4043,7 @@ void GdbEngine::handleGdbStarted()
|
||||
} else {
|
||||
// Gdb on local host
|
||||
// This is useful (only) in custom gdb builds that did not run 'make install'
|
||||
const FilePath uninstalledData = rp.debugger.command.executable().parentDir()
|
||||
const FilePath uninstalledData = rp.debugger().command.executable().parentDir()
|
||||
/ "data-directory/python";
|
||||
if (uninstalledData.exists())
|
||||
runCommand({"python sys.path.append('" + uninstalledData.path() + "')"});
|
||||
@@ -4104,7 +4104,7 @@ void GdbEngine::setEnvironmentVariables()
|
||||
&& str.compare("path", Qt::CaseInsensitive) == 0;
|
||||
};
|
||||
|
||||
Environment baseEnv = runParameters().debugger.environment;
|
||||
Environment baseEnv = runParameters().debugger().environment;
|
||||
Environment runEnv = runParameters().inferior().environment;
|
||||
const EnvironmentItems items = baseEnv.diff(runEnv);
|
||||
for (const EnvironmentItem &item : items) {
|
||||
@@ -4139,7 +4139,7 @@ void GdbEngine::handleGdbDone()
|
||||
.arg(wd.toUserOutput());
|
||||
} else {
|
||||
msg = RunWorker::userMessageForProcessError(QProcess::FailedToStart,
|
||||
runParameters().debugger.command.executable());
|
||||
runParameters().debugger().command.executable());
|
||||
}
|
||||
handleAdapterStartFailed(msg);
|
||||
return;
|
||||
@@ -4148,7 +4148,7 @@ void GdbEngine::handleGdbDone()
|
||||
const QProcess::ProcessError error = m_gdbProc.error();
|
||||
if (error != QProcess::UnknownError) {
|
||||
QString msg = RunWorker::userMessageForProcessError(error,
|
||||
runParameters().debugger.command.executable());
|
||||
runParameters().debugger().command.executable());
|
||||
const QString errorString = m_gdbProc.errorString();
|
||||
if (!errorString.isEmpty())
|
||||
msg += '\n' + errorString;
|
||||
@@ -4404,7 +4404,7 @@ bool GdbEngine::isTermEngine() const
|
||||
|
||||
bool GdbEngine::usesOutputCollector() const
|
||||
{
|
||||
return isPlainEngine() && runParameters().debugger.command.executable().isLocal();
|
||||
return isPlainEngine() && runParameters().debugger().command.executable().isLocal();
|
||||
}
|
||||
|
||||
void GdbEngine::claimInitialBreakpoints()
|
||||
@@ -4524,7 +4524,7 @@ void GdbEngine::setupInferior()
|
||||
FilePath executable = rp.inferior().command.executable();
|
||||
|
||||
if (executable.isEmpty()) {
|
||||
CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(rp.debugger, rp.coreFile());
|
||||
CoreInfo cinfo = CoreInfo::readExecutableNameFromCore(rp.debugger(), rp.coreFile());
|
||||
|
||||
if (!cinfo.isCore) {
|
||||
AsynchronousMessageBox::warning(Tr::tr("Error Loading Core File"),
|
||||
|
@@ -180,10 +180,10 @@ void LldbEngine::setupEngine()
|
||||
{
|
||||
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
||||
|
||||
const FilePath lldbCmd = runParameters().debugger.command.executable();
|
||||
const FilePath lldbCmd = runParameters().debugger().command.executable();
|
||||
|
||||
showMessage("STARTING LLDB: " + lldbCmd.toUserOutput());
|
||||
Environment environment = runParameters().debugger.environment;
|
||||
Environment environment = runParameters().debugger().environment;
|
||||
environment.set("QT_CREATOR_LLDB_PROCESS", "1");
|
||||
environment.set("PYTHONUNBUFFERED", "1"); // avoid flushing problem on macOS
|
||||
const bool ndkPythonEnvTweaked = DebuggerItem::addAndroidLldbPythonEnv(lldbCmd, environment);
|
||||
@@ -210,8 +210,8 @@ void LldbEngine::setupEngine()
|
||||
|
||||
m_lldbProc.setEnvironment(environment);
|
||||
|
||||
if (runParameters().debugger.workingDirectory.isDir())
|
||||
m_lldbProc.setWorkingDirectory(runParameters().debugger.workingDirectory);
|
||||
if (runParameters().debugger().workingDirectory.isDir())
|
||||
m_lldbProc.setWorkingDirectory(runParameters().debugger().workingDirectory);
|
||||
|
||||
m_lldbProc.setCommand(CommandLine(lldbCmd));
|
||||
|
||||
@@ -799,7 +799,7 @@ void LldbEngine::handleLldbDone()
|
||||
notifyEngineSetupFailed();
|
||||
showMessage("ADAPTER START FAILED");
|
||||
ICore::showWarningWithOptions(adapterStartFailed(), Tr::tr("Unable to start LLDB \"%1\": %2")
|
||||
.arg(runParameters().debugger.command.executable().toUserOutput(),
|
||||
.arg(runParameters().debugger().command.executable().toUserOutput(),
|
||||
m_lldbProc.errorString()));
|
||||
return;
|
||||
}
|
||||
@@ -833,7 +833,7 @@ QString LldbEngine::errorMessage(QProcess::ProcessError error) const
|
||||
return Tr::tr("The LLDB process failed to start. Either the "
|
||||
"invoked program \"%1\" is missing, or you may have insufficient "
|
||||
"permissions to invoke the program.")
|
||||
.arg(runParameters().debugger.command.executable().toUserOutput());
|
||||
.arg(runParameters().debugger().command.executable().toUserOutput());
|
||||
case QProcess::Crashed:
|
||||
return Tr::tr("The LLDB process crashed some time after starting "
|
||||
"successfully.");
|
||||
|
@@ -122,7 +122,7 @@ void PdbEngine::setupEngine()
|
||||
arguments.removeFirst(); // file added by run config
|
||||
cmd.addArgs(arguments);
|
||||
showMessage("STARTING " + cmd.toUserOutput());
|
||||
m_proc.setEnvironment(runParameters().debugger.environment);
|
||||
m_proc.setEnvironment(runParameters().debugger().environment);
|
||||
m_proc.setCommand(cmd);
|
||||
m_proc.start();
|
||||
}
|
||||
|
@@ -74,7 +74,7 @@ StackFrame StackFrame::parseFrame(const GdbMi &frameMi, const DebuggerRunParamet
|
||||
frame.level = frameMi["level"].data();
|
||||
frame.function = frameMi["function"].data();
|
||||
frame.module = frameMi["module"].data();
|
||||
const FilePath debugger = rp.debugger.command.executable();
|
||||
const FilePath debugger = rp.debugger().command.executable();
|
||||
const FilePath onDevicePath = debugger.withNewPath(frameMi["file"].data()).cleanPath();
|
||||
frame.file = onDevicePath.localSource().value_or(onDevicePath);
|
||||
frame.line = frameMi["line"].toInt();
|
||||
|
@@ -88,16 +88,16 @@ void UvscEngine::setupEngine()
|
||||
}
|
||||
|
||||
// Check for valid uVision executable.
|
||||
if (rp.debugger.command.isEmpty()) {
|
||||
if (rp.debugger().command.isEmpty()) {
|
||||
handleSetupFailure(Tr::tr("Internal error: No uVision executable specified."));
|
||||
return;
|
||||
} else if (!rp.debugger.command.executable().exists()) {
|
||||
} else if (!rp.debugger().command.executable().exists()) {
|
||||
handleSetupFailure(Tr::tr("Internal error: The specified uVision executable does not exist."));
|
||||
return;
|
||||
}
|
||||
|
||||
showMessage("UVSC: RESOLVING LIBRARY SYMBOLS...");
|
||||
m_client.reset(new UvscClient(rp.debugger.command.executable().parentDir().toUrlishString()));
|
||||
m_client.reset(new UvscClient(rp.debugger().command.executable().parentDir().toUrlishString()));
|
||||
if (m_client->error() != UvscClient::NoError) {
|
||||
handleSetupFailure(Tr::tr("Internal error: Cannot resolve the library: %1.")
|
||||
.arg(m_client->errorString()));
|
||||
|
Reference in New Issue
Block a user