forked from qt-creator/qt-creator
Debugger: Transform a few fields of DebuggerRunParameters
Transform multiProcess, useTerminal and runAsRoot. Task-number: QTCREATORBUG-29168 Change-Id: I18fdd1f0637cf7b367f488128559627096bb39e0 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -285,7 +285,7 @@ void CdbEngine::setupEngine()
|
|||||||
sp.setInferior({{}, sp.inferior().workingDirectory, sp.inferior().environment});
|
sp.setInferior({{}, sp.inferior().workingDirectory, sp.inferior().environment});
|
||||||
sp.setAttachPid(applicationPid());
|
sp.setAttachPid(applicationPid());
|
||||||
sp.setStartMode(AttachToLocalProcess);
|
sp.setStartMode(AttachToLocalProcess);
|
||||||
sp.useTerminal = false; // Force no terminal.
|
sp.setUseTerminal(false); // Force no terminal.
|
||||||
showMessage(Tr::tr("Attaching to %1...").arg(sp.attachPid().pid()), LogMisc);
|
showMessage(Tr::tr("Attaching to %1...").arg(sp.attachPid().pid()), LogMisc);
|
||||||
} else {
|
} else {
|
||||||
m_effectiveStartMode = sp.startMode();
|
m_effectiveStartMode = sp.startMode();
|
||||||
@@ -341,7 +341,7 @@ void CdbEngine::setupEngine()
|
|||||||
// register idle (debuggee stop) notification
|
// register idle (debuggee stop) notification
|
||||||
"-c", ".idle_cmd " + m_extensionCommandPrefix + "idle"});
|
"-c", ".idle_cmd " + m_extensionCommandPrefix + "idle"});
|
||||||
|
|
||||||
if (sp.useTerminal) // Separate console
|
if (sp.useTerminal()) // Separate console
|
||||||
debugger.addArg("-2");
|
debugger.addArg("-2");
|
||||||
|
|
||||||
const DebuggerSettings &s = settings();
|
const DebuggerSettings &s = settings();
|
||||||
@@ -397,7 +397,7 @@ void CdbEngine::setupEngine()
|
|||||||
|
|
||||||
// Make sure that QTestLib uses OutputDebugString for logging.
|
// Make sure that QTestLib uses OutputDebugString for logging.
|
||||||
const QString qtLoggingToConsoleKey = QStringLiteral("QT_LOGGING_TO_CONSOLE");
|
const QString qtLoggingToConsoleKey = QStringLiteral("QT_LOGGING_TO_CONSOLE");
|
||||||
if (!sp.useTerminal && !inferiorEnvironment.hasKey(qtLoggingToConsoleKey))
|
if (!sp.useTerminal() && !inferiorEnvironment.hasKey(qtLoggingToConsoleKey))
|
||||||
inferiorEnvironment.set(qtLoggingToConsoleKey, "0");
|
inferiorEnvironment.set(qtLoggingToConsoleKey, "0");
|
||||||
|
|
||||||
static const char cdbExtensionPathVariableC[] = "_NT_DEBUGGER_EXTENSION_PATH";
|
static const char cdbExtensionPathVariableC[] = "_NT_DEBUGGER_EXTENSION_PATH";
|
||||||
|
@@ -419,7 +419,7 @@ void StartApplicationDialog::run(bool attachRemote)
|
|||||||
rp.setInferior(newParameters.runnable);
|
rp.setInferior(newParameters.runnable);
|
||||||
rp.setCommandsAfterConnect(newParameters.serverInitCommands);
|
rp.setCommandsAfterConnect(newParameters.serverInitCommands);
|
||||||
rp.setCommandsForReset(newParameters.serverResetCommands);
|
rp.setCommandsForReset(newParameters.serverResetCommands);
|
||||||
debugger->setUseTerminal(newParameters.runInTerminal);
|
rp.setUseTerminal(newParameters.runInTerminal);
|
||||||
rp.setUseExtendedRemote(newParameters.useTargetExtendedRemote);
|
rp.setUseExtendedRemote(newParameters.useTargetExtendedRemote);
|
||||||
if (!newParameters.sysRoot.isEmpty())
|
if (!newParameters.sysRoot.isEmpty())
|
||||||
rp.setSysRoot(newParameters.sysRoot);
|
rp.setSysRoot(newParameters.sysRoot);
|
||||||
|
@@ -132,9 +132,9 @@ DebuggerRunParameters DebuggerRunParameters::fromRunControl(ProjectExplorer::Run
|
|||||||
if (auto symbolsAspect = runControl->aspectData<SymbolFileAspect>())
|
if (auto symbolsAspect = runControl->aspectData<SymbolFileAspect>())
|
||||||
params.setSymbolFile(symbolsAspect->filePath);
|
params.setSymbolFile(symbolsAspect->filePath);
|
||||||
if (auto terminalAspect = runControl->aspectData<TerminalAspect>())
|
if (auto terminalAspect = runControl->aspectData<TerminalAspect>())
|
||||||
params.useTerminal = terminalAspect->useTerminal;
|
params.m_useTerminal = terminalAspect->useTerminal;
|
||||||
if (auto runAsRootAspect = runControl->aspectData<RunAsRootAspect>())
|
if (auto runAsRootAspect = runControl->aspectData<RunAsRootAspect>())
|
||||||
params.runAsRoot = runAsRootAspect->value;
|
params.m_runAsRoot = runAsRootAspect->value;
|
||||||
|
|
||||||
params.setSysRoot(SysRootKitAspect::sysRoot(kit));
|
params.setSysRoot(SysRootKitAspect::sysRoot(kit));
|
||||||
params.macroExpander = runControl->macroExpander();
|
params.macroExpander = runControl->macroExpander();
|
||||||
@@ -150,7 +150,7 @@ DebuggerRunParameters DebuggerRunParameters::fromRunControl(ProjectExplorer::Run
|
|||||||
params.m_cppEngineType = NoEngineType;
|
params.m_cppEngineType = NoEngineType;
|
||||||
params.m_isQmlDebugging = aspect->useQmlDebugger;
|
params.m_isQmlDebugging = aspect->useQmlDebugger;
|
||||||
params.m_isPythonDebugging = aspect->usePythonDebugger;
|
params.m_isPythonDebugging = aspect->usePythonDebugger;
|
||||||
params.multiProcess = aspect->useMultiProcess;
|
params.m_multiProcess = aspect->useMultiProcess;
|
||||||
params.m_additionalStartupCommands = aspect->overrideStartup;
|
params.m_additionalStartupCommands = aspect->overrideStartup;
|
||||||
|
|
||||||
if (aspect->useCppDebugger) {
|
if (aspect->useCppDebugger) {
|
||||||
@@ -2307,7 +2307,7 @@ void DebuggerEngine::setSecondaryEngine()
|
|||||||
|
|
||||||
bool DebuggerEngine::usesTerminal() const
|
bool DebuggerEngine::usesTerminal() const
|
||||||
{
|
{
|
||||||
return d->m_runParameters.useTerminal;
|
return d->m_runParameters.useTerminal();
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 DebuggerEngine::applicationPid() const
|
qint64 DebuggerEngine::applicationPid() const
|
||||||
|
@@ -187,9 +187,12 @@ public:
|
|||||||
void setBreakOnMain(bool on) { m_breakOnMain = on; }
|
void setBreakOnMain(bool on) { m_breakOnMain = on; }
|
||||||
bool breakOnMain() const { return m_breakOnMain; }
|
bool breakOnMain() const { return m_breakOnMain; }
|
||||||
|
|
||||||
bool multiProcess = false; // Whether to set detach-on-fork off.
|
bool multiProcess() const { return m_multiProcess; }
|
||||||
bool useTerminal = false;
|
|
||||||
bool runAsRoot = false;
|
void setUseTerminal(bool on) { m_useTerminal = on; }
|
||||||
|
bool useTerminal() const { return m_useTerminal; }
|
||||||
|
|
||||||
|
bool runAsRoot() const { return m_runAsRoot; }
|
||||||
|
|
||||||
Utils::ProcessRunData debugger;
|
Utils::ProcessRunData debugger;
|
||||||
Utils::FilePath overrideStartScript; // Used in attach to core and remote debugging
|
Utils::FilePath overrideStartScript; // Used in attach to core and remote debugging
|
||||||
@@ -292,6 +295,9 @@ private:
|
|||||||
|
|
||||||
bool m_isPythonDebugging = false;
|
bool m_isPythonDebugging = false;
|
||||||
bool m_breakOnMain = false;
|
bool m_breakOnMain = false;
|
||||||
|
bool m_multiProcess = false; // Whether to set detach-on-fork off.
|
||||||
|
bool m_useTerminal = false;
|
||||||
|
bool m_runAsRoot = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
@@ -1419,7 +1419,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
|
|||||||
rp.setDisplayName(Tr::tr("Executable file \"%1\"").arg(executable.toUserOutput()));
|
rp.setDisplayName(Tr::tr("Executable file \"%1\"").arg(executable.toUserOutput()));
|
||||||
debugger->setStartMessage(Tr::tr("Debugging file %1.").arg(executable.toUserOutput()));
|
debugger->setStartMessage(Tr::tr("Debugging file %1.").arg(executable.toUserOutput()));
|
||||||
}
|
}
|
||||||
debugger->setUseTerminal(useTerminal);
|
rp.setUseTerminal(useTerminal);
|
||||||
|
|
||||||
m_scheduledStarts.append(runControl);
|
m_scheduledStarts.append(runControl);
|
||||||
return true;
|
return true;
|
||||||
|
@@ -103,11 +103,6 @@ public:
|
|||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
void DebuggerRunTool::setUseTerminal(bool on)
|
|
||||||
{
|
|
||||||
m_runParameters.useTerminal = on;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerRunTool::setDebugInfoLocation(const FilePath &debugInfoLocation)
|
void DebuggerRunTool::setDebugInfoLocation(const FilePath &debugInfoLocation)
|
||||||
{
|
{
|
||||||
m_runParameters.debugInfoLocation = debugInfoLocation;
|
m_runParameters.debugInfoLocation = debugInfoLocation;
|
||||||
@@ -213,7 +208,7 @@ void DebuggerRunTool::continueAfterCoreFileSetup()
|
|||||||
void DebuggerRunTool::startTerminalIfNeededAndContinueStartup()
|
void DebuggerRunTool::startTerminalIfNeededAndContinueStartup()
|
||||||
{
|
{
|
||||||
if (d->allowTerminal == DoNotAllowTerminal)
|
if (d->allowTerminal == DoNotAllowTerminal)
|
||||||
m_runParameters.useTerminal = false;
|
m_runParameters.setUseTerminal(false);
|
||||||
|
|
||||||
// CDB has a built-in console that might be preferred by some.
|
// CDB has a built-in console that might be preferred by some.
|
||||||
const bool useCdbConsole = m_runParameters.cppEngineType() == CdbEngineType
|
const bool useCdbConsole = m_runParameters.cppEngineType() == CdbEngineType
|
||||||
@@ -221,9 +216,9 @@ void DebuggerRunTool::startTerminalIfNeededAndContinueStartup()
|
|||||||
|| m_runParameters.startMode() == StartExternal)
|
|| m_runParameters.startMode() == StartExternal)
|
||||||
&& settings().useCdbConsole();
|
&& settings().useCdbConsole();
|
||||||
if (useCdbConsole)
|
if (useCdbConsole)
|
||||||
m_runParameters.useTerminal = false;
|
m_runParameters.setUseTerminal(false);
|
||||||
|
|
||||||
if (!m_runParameters.useTerminal) {
|
if (!m_runParameters.useTerminal()) {
|
||||||
continueAfterTerminalStart();
|
continueAfterTerminalStart();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -231,7 +226,7 @@ void DebuggerRunTool::startTerminalIfNeededAndContinueStartup()
|
|||||||
// Actually start the terminal.
|
// Actually start the terminal.
|
||||||
ProcessRunData stub = m_runParameters.inferior();
|
ProcessRunData stub = m_runParameters.inferior();
|
||||||
|
|
||||||
if (m_runParameters.runAsRoot) {
|
if (m_runParameters.runAsRoot()) {
|
||||||
d->terminalProc.setRunAsRoot(true);
|
d->terminalProc.setRunAsRoot(true);
|
||||||
RunControl::provideAskPassEntry(stub.environment);
|
RunControl::provideAskPassEntry(stub.environment);
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,6 @@ public:
|
|||||||
void setStartMessage(const QString &msg);
|
void setStartMessage(const QString &msg);
|
||||||
void setCrashParameter(const QString &event);
|
void setCrashParameter(const QString &event);
|
||||||
|
|
||||||
void setUseTerminal(bool on);
|
|
||||||
void setUseDebugServer(Utils::ProcessHandle attachPid, bool essential, bool useMulti);
|
void setUseDebugServer(Utils::ProcessHandle attachPid, bool essential, bool useMulti);
|
||||||
|
|
||||||
void setDebugInfoLocation(const Utils::FilePath &debugInfoLocation);
|
void setDebugInfoLocation(const Utils::FilePath &debugInfoLocation);
|
||||||
|
@@ -3864,9 +3864,9 @@ void GdbEngine::setupEngine()
|
|||||||
// This is filled in DebuggerKitAspect::runnable
|
// This is filled in DebuggerKitAspect::runnable
|
||||||
Environment gdbEnv = rp.debugger.environment;
|
Environment gdbEnv = rp.debugger.environment;
|
||||||
gdbEnv.setupEnglishOutput();
|
gdbEnv.setupEnglishOutput();
|
||||||
if (rp.runAsRoot)
|
if (rp.runAsRoot())
|
||||||
RunControl::provideAskPassEntry(gdbEnv);
|
RunControl::provideAskPassEntry(gdbEnv);
|
||||||
m_gdbProc.setRunAsRoot(rp.runAsRoot);
|
m_gdbProc.setRunAsRoot(rp.runAsRoot());
|
||||||
|
|
||||||
showMessage("STARTING " + gdbCommand.toUserOutput());
|
showMessage("STARTING " + gdbCommand.toUserOutput());
|
||||||
|
|
||||||
@@ -3982,7 +3982,7 @@ void GdbEngine::handleGdbStarted()
|
|||||||
//if (!ba.isEmpty())
|
//if (!ba.isEmpty())
|
||||||
// runCommand("set solib-search-path " + ba);
|
// runCommand("set solib-search-path " + ba);
|
||||||
|
|
||||||
if (settings().multiInferior() || runParameters().multiProcess) {
|
if (settings().multiInferior() || runParameters().multiProcess()) {
|
||||||
//runCommand("set follow-exec-mode new");
|
//runCommand("set follow-exec-mode new");
|
||||||
runCommand({"set detach-on-fork off"});
|
runCommand({"set detach-on-fork off"});
|
||||||
}
|
}
|
||||||
@@ -4355,7 +4355,7 @@ void GdbEngine::interruptLocalInferior(qint64 pid)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
if (runParameters().runAsRoot) {
|
if (runParameters().runAsRoot()) {
|
||||||
Environment env = Environment::systemEnvironment();
|
Environment env = Environment::systemEnvironment();
|
||||||
RunControl::provideAskPassEntry(env);
|
RunControl::provideAskPassEntry(env);
|
||||||
Process proc;
|
Process proc;
|
||||||
|
@@ -203,7 +203,7 @@ void LldbEngine::setupEngine()
|
|||||||
environment.appendOrSet("PYTHONPATH", "/usr/lib/llvm-14/lib/python3.10/dist-packages");
|
environment.appendOrSet("PYTHONPATH", "/usr/lib/llvm-14/lib/python3.10/dist-packages");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runParameters().runAsRoot) {
|
if (runParameters().runAsRoot()) {
|
||||||
ProjectExplorer::RunControl::provideAskPassEntry(environment);
|
ProjectExplorer::RunControl::provideAskPassEntry(environment);
|
||||||
m_lldbProc.setRunAsRoot(true);
|
m_lldbProc.setRunAsRoot(true);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user