forked from qt-creator/qt-creator
Debugger: Use qtcEnvironmentVariable* instead of qEnvironmentVariable*
And instead of qgetenv. Takes Qt Creator's setting at "Environment > System > Environment" into account, which makes it easier on some platforms to set them (e.g. macOS), can be configured differently in different settings paths, and potentially can be changed at runtime (depending on usage). Change-Id: I3ea7623fb528e13a202afa2f89b00e5ee83962d8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <projectexplorer/abi.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/stringutils.h>
|
||||
@@ -130,7 +131,7 @@ bool BreakpointParameters::isQmlFileAndLineBreakpoint() const
|
||||
if (type != BreakpointByFileAndLine)
|
||||
return false;
|
||||
|
||||
QString qmlExtensionString = QString::fromLocal8Bit(qgetenv("QTC_QMLDEBUGGER_FILEEXTENSIONS"));
|
||||
QString qmlExtensionString = Utils::qtcEnvironmentVariable("QTC_QMLDEBUGGER_FILEEXTENSIONS");
|
||||
if (qmlExtensionString.isEmpty())
|
||||
qmlExtensionString = ".qml;.js;.mjs";
|
||||
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include <texteditor/texteditor.h>
|
||||
|
||||
#include <utils/checkablemessagebox.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/processinterface.h>
|
||||
@@ -421,12 +422,9 @@ void CdbEngine::setupEngine()
|
||||
|
||||
static const char cdbExtensionPathVariableC[] = "_NT_DEBUGGER_EXTENSION_PATH";
|
||||
inferiorEnvironment.prependOrSet(cdbExtensionPathVariableC, extensionFi.absolutePath(), {";"});
|
||||
const QByteArray oldCdbExtensionPath = qgetenv(cdbExtensionPathVariableC);
|
||||
if (!oldCdbExtensionPath.isEmpty()) {
|
||||
inferiorEnvironment.appendOrSet(cdbExtensionPathVariableC,
|
||||
QString::fromLocal8Bit(oldCdbExtensionPath),
|
||||
{";"});
|
||||
}
|
||||
const QString oldCdbExtensionPath = qtcEnvironmentVariable(cdbExtensionPathVariableC);
|
||||
if (!oldCdbExtensionPath.isEmpty())
|
||||
inferiorEnvironment.appendOrSet(cdbExtensionPathVariableC, oldCdbExtensionPath, {";"});
|
||||
|
||||
m_process.setEnvironment(inferiorEnvironment);
|
||||
if (!sp.inferior.workingDirectory.isEmpty())
|
||||
@@ -1051,7 +1049,7 @@ void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters)
|
||||
watchHandler()->appendFormatRequests(&cmd);
|
||||
watchHandler()->appendWatchersAndTooltipRequests(&cmd);
|
||||
|
||||
const static bool alwaysVerbose = qEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
|
||||
const bool alwaysVerbose = qtcEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
|
||||
cmd.arg("passexceptions", alwaysVerbose);
|
||||
cmd.arg("fancy", s.useDebuggingHelpers.value());
|
||||
cmd.arg("autoderef", s.autoDerefPointers.value());
|
||||
|
@@ -592,11 +592,9 @@ void DebuggerItemManagerPrivate::autoDetectCdbDebuggers()
|
||||
{
|
||||
FilePaths cdbs;
|
||||
|
||||
const QStringList programDirs = {
|
||||
QString::fromLocal8Bit(qgetenv("ProgramFiles")),
|
||||
QString::fromLocal8Bit(qgetenv("ProgramFiles(x86)")),
|
||||
QString::fromLocal8Bit(qgetenv("ProgramW6432"))
|
||||
};
|
||||
const QStringList programDirs = {qtcEnvironmentVariable("ProgramFiles"),
|
||||
qtcEnvironmentVariable("ProgramFiles(x86)"),
|
||||
qtcEnvironmentVariable("ProgramW6432")};
|
||||
|
||||
QFileInfoList kitFolders;
|
||||
|
||||
|
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <qtsupport/qtbuildaspects.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
@@ -156,7 +157,7 @@ DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(Target *target)
|
||||
builder.addRow(m_qmlAspect);
|
||||
builder.addRow(m_overrideStartupAspect);
|
||||
|
||||
static const QByteArray env = qgetenv("QTC_DEBUGGER_MULTIPROCESS");
|
||||
static const QString env = qtcEnvironmentVariable("QTC_DEBUGGER_MULTIPROCESS");
|
||||
if (env.toInt())
|
||||
builder.addRow(m_multiProcessAspect);
|
||||
return builder.emerge(Layouting::WithoutMargins);
|
||||
|
@@ -31,6 +31,7 @@
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/checkablemessagebox.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/portlist.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -891,9 +892,9 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, AllowTerminal allowTerm
|
||||
|
||||
setUseTerminal(allowTerminal == DoAllowTerminal && m_runParameters.useTerminal);
|
||||
|
||||
const QByteArray envBinary = qgetenv("QTC_DEBUGGER_PATH");
|
||||
const QString envBinary = qtcEnvironmentVariable("QTC_DEBUGGER_PATH");
|
||||
if (!envBinary.isEmpty())
|
||||
m_runParameters.debugger.command.setExecutable(FilePath::fromString(QString::fromLocal8Bit(envBinary)));
|
||||
m_runParameters.debugger.command.setExecutable(FilePath::fromString(envBinary));
|
||||
|
||||
if (Project *project = runControl->project()) {
|
||||
m_runParameters.projectSourceDirectory = project->projectDirectory();
|
||||
@@ -903,7 +904,7 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, AllowTerminal allowTerm
|
||||
m_runParameters.toolChainAbi = ToolChainKitAspect::targetAbi(kit);
|
||||
|
||||
bool ok = false;
|
||||
const int nativeMixedOverride = qEnvironmentVariableIntValue("QTC_DEBUGGER_NATIVE_MIXED", &ok);
|
||||
const int nativeMixedOverride = qtcEnvironmentVariableIntValue("QTC_DEBUGGER_NATIVE_MIXED", &ok);
|
||||
if (ok)
|
||||
m_runParameters.nativeMixedEnabled = bool(nativeMixedOverride);
|
||||
|
||||
|
@@ -37,6 +37,7 @@
|
||||
|
||||
#include <app/app_version.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/processinterface.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -2599,7 +2600,8 @@ void GdbEngine::insertBreakpoint(const Breakpoint &bp)
|
||||
}
|
||||
|
||||
// for dumping of expressions
|
||||
const static bool alwaysVerbose = qEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
|
||||
const bool alwaysVerbose = qtcEnvironmentVariableIsSet(
|
||||
"QTC_DEBUGGER_PYTHON_VERBOSE");
|
||||
const DebuggerSettings &s = *debuggerSettings();
|
||||
cmd.arg("passexceptions", alwaysVerbose);
|
||||
cmd.arg("fancy", s.useDebuggingHelpers.value());
|
||||
@@ -3810,7 +3812,7 @@ void GdbEngine::setupEngine()
|
||||
gdbCommand.addArg("--tty=" + m_outputCollector.serverName());
|
||||
}
|
||||
|
||||
const QStringList testList = QString::fromLocal8Bit(qgetenv("QTC_DEBUGGER_TESTS")).split(',');
|
||||
const QStringList testList = qtcEnvironmentVariable("QTC_DEBUGGER_TESTS").split(',');
|
||||
for (const QString &test : testList)
|
||||
m_testCases.insert(test.toInt());
|
||||
for (int test : qAsConst(m_testCases))
|
||||
@@ -5044,7 +5046,7 @@ void GdbEngine::doUpdateLocals(const UpdateParameters ¶ms)
|
||||
watchHandler()->appendFormatRequests(&cmd);
|
||||
watchHandler()->appendWatchersAndTooltipRequests(&cmd);
|
||||
|
||||
const static bool alwaysVerbose = qEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
|
||||
const bool alwaysVerbose = qtcEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
|
||||
const DebuggerSettings &s = *debuggerSettings();
|
||||
cmd.arg("passexceptions", alwaysVerbose);
|
||||
cmd.arg("fancy", s.useDebuggingHelpers.value());
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <coreplugin/idocument.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/processinterface.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
@@ -729,7 +730,7 @@ void LldbEngine::doUpdateLocals(const UpdateParameters ¶ms)
|
||||
watchHandler()->appendFormatRequests(&cmd);
|
||||
watchHandler()->appendWatchersAndTooltipRequests(&cmd);
|
||||
|
||||
const static bool alwaysVerbose = qEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
|
||||
const bool alwaysVerbose = qtcEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
|
||||
const DebuggerSettings &s = *debuggerSettings();
|
||||
cmd.arg("passexceptions", alwaysVerbose);
|
||||
cmd.arg("fancy", s.useDebuggingHelpers.value());
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <debugger/watchutils.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
@@ -538,7 +539,7 @@ void PdbEngine::updateLocals()
|
||||
watchHandler()->appendFormatRequests(&cmd);
|
||||
watchHandler()->appendWatchersAndTooltipRequests(&cmd);
|
||||
|
||||
const static bool alwaysVerbose = qEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
|
||||
const bool alwaysVerbose = qtcEnvironmentVariableIsSet("QTC_DEBUGGER_PYTHON_VERBOSE");
|
||||
cmd.arg("passexceptions", alwaysVerbose);
|
||||
cmd.arg("fancy", debuggerSettings()->useDebuggingHelpers.value());
|
||||
|
||||
|
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
@@ -51,7 +52,7 @@ Terminal::Terminal(QObject *parent)
|
||||
void Terminal::setup()
|
||||
{
|
||||
#ifdef DEBUGGER_USE_TERMINAL
|
||||
if (!qEnvironmentVariableIsSet("QTC_USE_PTY"))
|
||||
if (!qtcEnvironmentVariableIsSet("QTC_USE_PTY"))
|
||||
return;
|
||||
|
||||
m_masterFd = ::open("/dev/ptmx", O_RDWR);
|
||||
|
Reference in New Issue
Block a user