forked from qt-creator/qt-creator
Debugger: Use a StandardRunnable for the debugger process
One step further to separate the debugger environment from the inferior environment and to make it possible to configure a working directory. Guessing one from the inferior's working directory is not always a good idea. Change-Id: I33d139c0f228ec0870556b82bc6aecca0a8e62d6 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1268,7 +1268,7 @@ void AndroidConfigurations::updateAutomaticKitList()
|
|||||||
|
|
||||||
// Update code for 3.0 beta, which shipped with a bug for the debugger settings
|
// Update code for 3.0 beta, which shipped with a bug for the debugger settings
|
||||||
ToolChain *tc = ToolChainKitInformation::toolChain(k, ToolChain::Language::Cxx);
|
ToolChain *tc = ToolChainKitInformation::toolChain(k, ToolChain::Language::Cxx);
|
||||||
if (tc && Debugger::DebuggerKitInformation::debuggerCommand(k) != tc->suggestedDebugger()) {
|
if (tc && Debugger::DebuggerKitInformation::runnable(k).executable != tc->suggestedDebugger().toString()) {
|
||||||
Debugger::DebuggerItem debugger;
|
Debugger::DebuggerItem debugger;
|
||||||
debugger.setCommand(tc->suggestedDebugger());
|
debugger.setCommand(tc->suggestedDebugger());
|
||||||
debugger.setEngineType(Debugger::GdbEngineType);
|
debugger.setEngineType(Debugger::GdbEngineType);
|
||||||
|
|||||||
@@ -506,7 +506,7 @@ bool CdbEngine::launchCDB(const DebuggerRunParameters &sp, QString *errorMessage
|
|||||||
// Determine binary (force MSVC), extension lib name and path to use
|
// Determine binary (force MSVC), extension lib name and path to use
|
||||||
// The extension is passed as relative name with the path variable set
|
// The extension is passed as relative name with the path variable set
|
||||||
//(does not work with absolute path names)
|
//(does not work with absolute path names)
|
||||||
const QString executable = sp.debuggerCommand;
|
const QString executable = sp.debugger.executable;
|
||||||
if (executable.isEmpty()) {
|
if (executable.isEmpty()) {
|
||||||
*errorMessage = tr("There is no CDB executable specified.");
|
*errorMessage = tr("There is no CDB executable specified.");
|
||||||
return false;
|
return false;
|
||||||
@@ -975,7 +975,7 @@ void CdbEngine::doInterruptInferior(SpecialStopMode sm)
|
|||||||
connect(m_signalOperation.data(), &DeviceProcessSignalOperation::finished,
|
connect(m_signalOperation.data(), &DeviceProcessSignalOperation::finished,
|
||||||
this, &CdbEngine::handleDoInterruptInferior);
|
this, &CdbEngine::handleDoInterruptInferior);
|
||||||
|
|
||||||
m_signalOperation->setDebuggerCommand(runParameters().debuggerCommand);
|
m_signalOperation->setDebuggerCommand(runParameters().debugger.executable);
|
||||||
m_signalOperation->interruptProcess(inferiorPid());
|
m_signalOperation->interruptProcess(inferiorPid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ QDebug operator<<(QDebug str, const DebuggerRunParameters &sp)
|
|||||||
<< " coreFile=" << sp.coreFile
|
<< " coreFile=" << sp.coreFile
|
||||||
<< " processArgs=" << sp.inferior.commandLineArguments
|
<< " processArgs=" << sp.inferior.commandLineArguments
|
||||||
<< " inferior environment=<" << sp.inferior.environment.size() << " variables>"
|
<< " inferior environment=<" << sp.inferior.environment.size() << " variables>"
|
||||||
<< " debugger environment=<" << sp.debuggerEnvironment.size() << " variables>"
|
<< " debugger environment=<" << sp.debugger.environment.size() << " variables>"
|
||||||
<< " workingDir=" << sp.inferior.workingDirectory
|
<< " workingDir=" << sp.inferior.workingDirectory
|
||||||
<< " attachPID=" << sp.attachPID
|
<< " attachPID=" << sp.attachPID
|
||||||
<< " useTerminal=" << sp.useTerminal
|
<< " useTerminal=" << sp.useTerminal
|
||||||
|
|||||||
@@ -27,10 +27,12 @@
|
|||||||
|
|
||||||
#include "debugger_global.h"
|
#include "debugger_global.h"
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
|
#include "debuggeritem.h"
|
||||||
#include "debuggerprotocol.h"
|
#include "debuggerprotocol.h"
|
||||||
#include "debuggerstartparameters.h"
|
#include "debuggerstartparameters.h"
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/idevice.h>
|
#include <projectexplorer/devicesupport/idevice.h>
|
||||||
|
#include <projectexplorer/runnables.h>
|
||||||
#include <texteditor/textmark.h>
|
#include <texteditor/textmark.h>
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -89,7 +91,7 @@ public:
|
|||||||
bool breakOnMain = false;
|
bool breakOnMain = false;
|
||||||
bool multiProcess = false; // Whether to set detach-on-fork off.
|
bool multiProcess = false; // Whether to set detach-on-fork off.
|
||||||
|
|
||||||
QString debuggerCommand;
|
ProjectExplorer::StandardRunnable debugger;
|
||||||
QString coreFile;
|
QString coreFile;
|
||||||
QString overrideStartScript; // Used in attach to core and remote debugging
|
QString overrideStartScript; // Used in attach to core and remote debugging
|
||||||
QString startMessage; // First status message shown.
|
QString startMessage; // First status message shown.
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include "debuggeroptionspage.h"
|
#include "debuggeroptionspage.h"
|
||||||
#include "debuggerprotocol.h"
|
#include "debuggerprotocol.h"
|
||||||
|
|
||||||
|
#include <coreplugin/coreicons.h>
|
||||||
#include <projectexplorer/abi.h>
|
#include <projectexplorer/abi.h>
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
@@ -59,6 +60,7 @@ const char DEBUGGER_INFORMATION_AUTODETECTION_SOURCE[] = "AutoDetectionSource";
|
|||||||
const char DEBUGGER_INFORMATION_VERSION[] = "Version";
|
const char DEBUGGER_INFORMATION_VERSION[] = "Version";
|
||||||
const char DEBUGGER_INFORMATION_ABIS[] = "Abis";
|
const char DEBUGGER_INFORMATION_ABIS[] = "Abis";
|
||||||
const char DEBUGGER_INFORMATION_LASTMODIFIED[] = "LastModified";
|
const char DEBUGGER_INFORMATION_LASTMODIFIED[] = "LastModified";
|
||||||
|
const char DEBUGGER_INFORMATION_WORKINGDIRECTORY[] = "WorkingDirectory";
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
|
|
||||||
@@ -81,8 +83,9 @@ DebuggerItem::DebuggerItem(const QVariant &id)
|
|||||||
|
|
||||||
DebuggerItem::DebuggerItem(const QVariantMap &data)
|
DebuggerItem::DebuggerItem(const QVariantMap &data)
|
||||||
{
|
{
|
||||||
m_command = FileName::fromUserInput(data.value(QLatin1String(DEBUGGER_INFORMATION_COMMAND)).toString());
|
|
||||||
m_id = data.value(QLatin1String(DEBUGGER_INFORMATION_ID)).toString();
|
m_id = data.value(QLatin1String(DEBUGGER_INFORMATION_ID)).toString();
|
||||||
|
m_command = FileName::fromUserInput(data.value(QLatin1String(DEBUGGER_INFORMATION_COMMAND)).toString());
|
||||||
|
m_workingDirectory = FileName::fromUserInput(data.value(DEBUGGER_INFORMATION_WORKINGDIRECTORY).toString());
|
||||||
m_unexpandedDisplayName = data.value(QLatin1String(DEBUGGER_INFORMATION_DISPLAYNAME)).toString();
|
m_unexpandedDisplayName = data.value(QLatin1String(DEBUGGER_INFORMATION_DISPLAYNAME)).toString();
|
||||||
m_isAutoDetected = data.value(QLatin1String(DEBUGGER_INFORMATION_AUTODETECTED), false).toBool();
|
m_isAutoDetected = data.value(QLatin1String(DEBUGGER_INFORMATION_AUTODETECTED), false).toBool();
|
||||||
m_autoDetectionSource = data.value(QLatin1String(DEBUGGER_INFORMATION_AUTODETECTION_SOURCE)).toString();
|
m_autoDetectionSource = data.value(QLatin1String(DEBUGGER_INFORMATION_AUTODETECTION_SOURCE)).toString();
|
||||||
@@ -213,9 +216,15 @@ QDateTime DebuggerItem::lastModified() const
|
|||||||
return m_lastModified;
|
return m_lastModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DebuggerItem::isGood() const
|
QIcon DebuggerItem::decoration() const
|
||||||
{
|
{
|
||||||
return m_engineType != NoEngineType;
|
if (m_engineType == NoEngineType)
|
||||||
|
return Core::Icons::ERROR.icon();
|
||||||
|
if (!m_command.toFileInfo().isExecutable())
|
||||||
|
return Core::Icons::WARNING.icon();
|
||||||
|
if (!m_workingDirectory.isEmpty() && !m_workingDirectory.toFileInfo().isDir())
|
||||||
|
return Core::Icons::WARNING.icon();
|
||||||
|
return QIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DebuggerItem::validityMessage() const
|
QString DebuggerItem::validityMessage() const
|
||||||
@@ -230,7 +239,8 @@ bool DebuggerItem::operator==(const DebuggerItem &other) const
|
|||||||
return m_id == other.m_id
|
return m_id == other.m_id
|
||||||
&& m_unexpandedDisplayName == other.m_unexpandedDisplayName
|
&& m_unexpandedDisplayName == other.m_unexpandedDisplayName
|
||||||
&& m_isAutoDetected == other.m_isAutoDetected
|
&& m_isAutoDetected == other.m_isAutoDetected
|
||||||
&& m_command == other.m_command;
|
&& m_command == other.m_command
|
||||||
|
&& m_workingDirectory == other.m_workingDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap DebuggerItem::toMap() const
|
QVariantMap DebuggerItem::toMap() const
|
||||||
@@ -239,6 +249,7 @@ QVariantMap DebuggerItem::toMap() const
|
|||||||
data.insert(QLatin1String(DEBUGGER_INFORMATION_DISPLAYNAME), m_unexpandedDisplayName);
|
data.insert(QLatin1String(DEBUGGER_INFORMATION_DISPLAYNAME), m_unexpandedDisplayName);
|
||||||
data.insert(QLatin1String(DEBUGGER_INFORMATION_ID), m_id);
|
data.insert(QLatin1String(DEBUGGER_INFORMATION_ID), m_id);
|
||||||
data.insert(QLatin1String(DEBUGGER_INFORMATION_COMMAND), m_command.toString());
|
data.insert(QLatin1String(DEBUGGER_INFORMATION_COMMAND), m_command.toString());
|
||||||
|
data.insert(QLatin1String(DEBUGGER_INFORMATION_WORKINGDIRECTORY), m_workingDirectory.toString());
|
||||||
data.insert(QLatin1String(DEBUGGER_INFORMATION_ENGINETYPE), int(m_engineType));
|
data.insert(QLatin1String(DEBUGGER_INFORMATION_ENGINETYPE), int(m_engineType));
|
||||||
data.insert(QLatin1String(DEBUGGER_INFORMATION_AUTODETECTED), m_isAutoDetected);
|
data.insert(QLatin1String(DEBUGGER_INFORMATION_AUTODETECTED), m_isAutoDetected);
|
||||||
data.insert(QLatin1String(DEBUGGER_INFORMATION_AUTODETECTION_SOURCE), m_autoDetectionSource);
|
data.insert(QLatin1String(DEBUGGER_INFORMATION_AUTODETECTION_SOURCE), m_autoDetectionSource);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public:
|
|||||||
QStringList abiNames() const;
|
QStringList abiNames() const;
|
||||||
QDateTime lastModified() const;
|
QDateTime lastModified() const;
|
||||||
|
|
||||||
bool isGood() const;
|
QIcon decoration() const;
|
||||||
QString validityMessage() const;
|
QString validityMessage() const;
|
||||||
|
|
||||||
bool operator==(const DebuggerItem &other) const;
|
bool operator==(const DebuggerItem &other) const;
|
||||||
@@ -102,6 +102,9 @@ public:
|
|||||||
|
|
||||||
void reinitializeFromFile();
|
void reinitializeFromFile();
|
||||||
|
|
||||||
|
Utils::FileName workingDirectory() const { return m_workingDirectory; }
|
||||||
|
void setWorkingDirectory(const Utils::FileName &workingPath) { m_workingDirectory = workingPath; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DebuggerItem(const QVariant &id);
|
DebuggerItem(const QVariant &id);
|
||||||
void initMacroExpander();
|
void initMacroExpander();
|
||||||
@@ -110,6 +113,7 @@ private:
|
|||||||
QString m_unexpandedDisplayName;
|
QString m_unexpandedDisplayName;
|
||||||
DebuggerEngineType m_engineType;
|
DebuggerEngineType m_engineType;
|
||||||
Utils::FileName m_command;
|
Utils::FileName m_command;
|
||||||
|
Utils::FileName m_workingDirectory;
|
||||||
bool m_isAutoDetected;
|
bool m_isAutoDetected;
|
||||||
QString m_autoDetectionSource;
|
QString m_autoDetectionSource;
|
||||||
QString m_version;
|
QString m_version;
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
|
||||||
|
#include <utils/environment.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/macroexpander.h>
|
#include <utils/macroexpander.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -244,6 +245,18 @@ const DebuggerItem *DebuggerKitInformation::debugger(const Kit *kit)
|
|||||||
return DebuggerItemManager::findById(id);
|
return DebuggerItemManager::findById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StandardRunnable DebuggerKitInformation::runnable(const Kit *kit)
|
||||||
|
{
|
||||||
|
StandardRunnable runnable;
|
||||||
|
if (const DebuggerItem *item = debugger(kit)) {
|
||||||
|
runnable.executable = item->command().toString();
|
||||||
|
runnable.workingDirectory = item->workingDirectory().toString();
|
||||||
|
runnable.environment = Utils::Environment::systemEnvironment();
|
||||||
|
runnable.environment.set("LC_NUMERIC", "C");
|
||||||
|
}
|
||||||
|
return runnable;
|
||||||
|
}
|
||||||
|
|
||||||
bool DebuggerKitInformation::isValidDebugger(const Kit *k)
|
bool DebuggerKitInformation::isValidDebugger(const Kit *k)
|
||||||
{
|
{
|
||||||
return debuggerConfigurationErrors(k) == 0;
|
return debuggerConfigurationErrors(k) == 0;
|
||||||
@@ -326,14 +339,6 @@ KitInformation::ItemList DebuggerKitInformation::toUserOutput(const Kit *k) cons
|
|||||||
return ItemList() << qMakePair(tr("Debugger"), displayString(k));
|
return ItemList() << qMakePair(tr("Debugger"), displayString(k));
|
||||||
}
|
}
|
||||||
|
|
||||||
FileName DebuggerKitInformation::debuggerCommand(const Kit *k)
|
|
||||||
{
|
|
||||||
const DebuggerItem *item = debugger(k);
|
|
||||||
if (item)
|
|
||||||
return item->command();
|
|
||||||
return FileName();
|
|
||||||
}
|
|
||||||
|
|
||||||
DebuggerEngineType DebuggerKitInformation::engineType(const Kit *k)
|
DebuggerEngineType DebuggerKitInformation::engineType(const Kit *k)
|
||||||
{
|
{
|
||||||
const DebuggerItem *item = debugger(k);
|
const DebuggerItem *item = debugger(k);
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
|
|
||||||
#include <projectexplorer/kitinformation.h>
|
#include <projectexplorer/kitinformation.h>
|
||||||
|
#include <projectexplorer/runnables.h>
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
class DebuggerItem;
|
class DebuggerItem;
|
||||||
@@ -49,6 +50,7 @@ public:
|
|||||||
void fix(ProjectExplorer::Kit *k) override;
|
void fix(ProjectExplorer::Kit *k) override;
|
||||||
|
|
||||||
static const DebuggerItem *debugger(const ProjectExplorer::Kit *kit);
|
static const DebuggerItem *debugger(const ProjectExplorer::Kit *kit);
|
||||||
|
static ProjectExplorer::StandardRunnable runnable(const ProjectExplorer::Kit *kit);
|
||||||
|
|
||||||
static QList<ProjectExplorer::Task> validateDebugger(const ProjectExplorer::Kit *k);
|
static QList<ProjectExplorer::Task> validateDebugger(const ProjectExplorer::Kit *k);
|
||||||
static bool isValidDebugger(const ProjectExplorer::Kit *k);
|
static bool isValidDebugger(const ProjectExplorer::Kit *k);
|
||||||
@@ -61,7 +63,6 @@ public:
|
|||||||
static void setDebugger(ProjectExplorer::Kit *k, const QVariant &id);
|
static void setDebugger(ProjectExplorer::Kit *k, const QVariant &id);
|
||||||
|
|
||||||
static Core::Id id();
|
static Core::Id id();
|
||||||
static Utils::FileName debuggerCommand(const ProjectExplorer::Kit *k);
|
|
||||||
static DebuggerEngineType engineType(const ProjectExplorer::Kit *k);
|
static DebuggerEngineType engineType(const ProjectExplorer::Kit *k);
|
||||||
static QString displayString(const ProjectExplorer::Kit *k);
|
static QString displayString(const ProjectExplorer::Kit *k);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ public:
|
|||||||
|
|
||||||
QVariant data(int column, int role) const
|
QVariant data(int column, int role) const
|
||||||
{
|
{
|
||||||
static const QIcon errorIcon = Core::Icons::ERROR.icon();
|
|
||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
switch (column) {
|
switch (column) {
|
||||||
@@ -74,19 +72,23 @@ public:
|
|||||||
case 1: return m_item.command().toUserOutput();
|
case 1: return m_item.command().toUserOutput();
|
||||||
case 2: return m_item.engineTypeName();
|
case 2: return m_item.engineTypeName();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case Qt::FontRole: {
|
case Qt::FontRole:
|
||||||
QFont font;
|
if (m_changed) {
|
||||||
font.setBold(m_changed);
|
QFont font;
|
||||||
return font;
|
font.setBold(true);
|
||||||
}
|
return font;
|
||||||
case Qt::DecorationRole: {
|
}
|
||||||
if (column == 0 && !m_item.isGood())
|
break;
|
||||||
return errorIcon;
|
|
||||||
}
|
case Qt::DecorationRole:
|
||||||
case Qt::ToolTipRole: {
|
if (column == 0)
|
||||||
|
return m_item.decoration();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Qt::ToolTipRole:
|
||||||
return m_item.validityMessage();
|
return m_item.validityMessage();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@@ -214,6 +216,7 @@ private:
|
|||||||
QLabel *m_cdbLabel;
|
QLabel *m_cdbLabel;
|
||||||
QLineEdit *m_versionLabel;
|
QLineEdit *m_versionLabel;
|
||||||
PathChooser *m_binaryChooser;
|
PathChooser *m_binaryChooser;
|
||||||
|
PathChooser *m_workingDirectoryChooser;
|
||||||
QLineEdit *m_abis;
|
QLineEdit *m_abis;
|
||||||
bool m_autodetected;
|
bool m_autodetected;
|
||||||
DebuggerEngineType m_engineType;
|
DebuggerEngineType m_engineType;
|
||||||
@@ -231,7 +234,12 @@ DebuggerItemConfigWidget::DebuggerItemConfigWidget(DebuggerItemModel *model)
|
|||||||
m_binaryChooser = new PathChooser(this);
|
m_binaryChooser = new PathChooser(this);
|
||||||
m_binaryChooser->setExpectedKind(PathChooser::ExistingCommand);
|
m_binaryChooser->setExpectedKind(PathChooser::ExistingCommand);
|
||||||
m_binaryChooser->setMinimumWidth(400);
|
m_binaryChooser->setMinimumWidth(400);
|
||||||
m_binaryChooser->setHistoryCompleter(QLatin1String("DebuggerPaths"));
|
m_binaryChooser->setHistoryCompleter("DebuggerPaths");
|
||||||
|
|
||||||
|
m_workingDirectoryChooser = new PathChooser(this);
|
||||||
|
m_workingDirectoryChooser->setExpectedKind(PathChooser::Directory);
|
||||||
|
m_workingDirectoryChooser->setMinimumWidth(400);
|
||||||
|
m_workingDirectoryChooser->setHistoryCompleter("DebuggerPaths");
|
||||||
|
|
||||||
m_cdbLabel = new QLabel(this);
|
m_cdbLabel = new QLabel(this);
|
||||||
m_cdbLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
m_cdbLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||||
@@ -252,9 +260,12 @@ DebuggerItemConfigWidget::DebuggerItemConfigWidget(DebuggerItemModel *model)
|
|||||||
formLayout->addRow(new QLabel(tr("Type:")), m_typeLineEdit);
|
formLayout->addRow(new QLabel(tr("Type:")), m_typeLineEdit);
|
||||||
formLayout->addRow(new QLabel(tr("ABIs:")), m_abis);
|
formLayout->addRow(new QLabel(tr("ABIs:")), m_abis);
|
||||||
formLayout->addRow(new QLabel(tr("Version:")), m_versionLabel);
|
formLayout->addRow(new QLabel(tr("Version:")), m_versionLabel);
|
||||||
|
formLayout->addRow(new QLabel(tr("Working directory:")), m_workingDirectoryChooser);
|
||||||
|
|
||||||
connect(m_binaryChooser, &PathChooser::pathChanged,
|
connect(m_binaryChooser, &PathChooser::pathChanged,
|
||||||
this, &DebuggerItemConfigWidget::binaryPathHasChanged);
|
this, &DebuggerItemConfigWidget::binaryPathHasChanged);
|
||||||
|
connect(m_workingDirectoryChooser, &PathChooser::pathChanged,
|
||||||
|
this, &DebuggerItemConfigWidget::store);
|
||||||
connect(m_displayNameLineEdit, &QLineEdit::textChanged,
|
connect(m_displayNameLineEdit, &QLineEdit::textChanged,
|
||||||
this, &DebuggerItemConfigWidget::store);
|
this, &DebuggerItemConfigWidget::store);
|
||||||
}
|
}
|
||||||
@@ -264,6 +275,7 @@ DebuggerItem DebuggerItemConfigWidget::item() const
|
|||||||
DebuggerItem item(m_id);
|
DebuggerItem item(m_id);
|
||||||
item.setUnexpandedDisplayName(m_displayNameLineEdit->text());
|
item.setUnexpandedDisplayName(m_displayNameLineEdit->text());
|
||||||
item.setCommand(m_binaryChooser->fileName());
|
item.setCommand(m_binaryChooser->fileName());
|
||||||
|
item.setWorkingDirectory(m_workingDirectoryChooser->fileName());
|
||||||
item.setAutoDetected(m_autodetected);
|
item.setAutoDetected(m_autodetected);
|
||||||
QList<ProjectExplorer::Abi> abiList;
|
QList<ProjectExplorer::Abi> abiList;
|
||||||
foreach (const QString &a, m_abis->text().split(QRegExp(QLatin1String("[^A-Za-z0-9-_]+")))) {
|
foreach (const QString &a, m_abis->text().split(QRegExp(QLatin1String("[^A-Za-z0-9-_]+")))) {
|
||||||
@@ -305,6 +317,9 @@ void DebuggerItemConfigWidget::load(const DebuggerItem *item)
|
|||||||
m_binaryChooser->setReadOnly(item->isAutoDetected());
|
m_binaryChooser->setReadOnly(item->isAutoDetected());
|
||||||
m_binaryChooser->setFileName(item->command());
|
m_binaryChooser->setFileName(item->command());
|
||||||
|
|
||||||
|
m_workingDirectoryChooser->setReadOnly(item->isAutoDetected());
|
||||||
|
m_workingDirectoryChooser->setFileName(item->workingDirectory());
|
||||||
|
|
||||||
QString text;
|
QString text;
|
||||||
QString versionCommand;
|
QString versionCommand;
|
||||||
if (item->engineType() == CdbEngineType) {
|
if (item->engineType() == CdbEngineType) {
|
||||||
|
|||||||
@@ -1204,7 +1204,7 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
|
|||||||
}
|
}
|
||||||
rp.inferior.environment = Utils::Environment::systemEnvironment();
|
rp.inferior.environment = Utils::Environment::systemEnvironment();
|
||||||
rp.stubEnvironment = Utils::Environment::systemEnvironment();
|
rp.stubEnvironment = Utils::Environment::systemEnvironment();
|
||||||
rp.debuggerEnvironment = Utils::Environment::systemEnvironment();
|
rp.debugger.environment = Utils::Environment::systemEnvironment();
|
||||||
|
|
||||||
if (!kit)
|
if (!kit)
|
||||||
kit = guessKitFromParameters(rp);
|
kit = guessKitFromParameters(rp);
|
||||||
@@ -2912,7 +2912,7 @@ static QString formatStartParameters(DebuggerRunParameters &sp)
|
|||||||
str << "Directory: " << QDir::toNativeSeparators(sp.inferior.workingDirectory)
|
str << "Directory: " << QDir::toNativeSeparators(sp.inferior.workingDirectory)
|
||||||
<< '\n';
|
<< '\n';
|
||||||
}
|
}
|
||||||
QString cmd = sp.debuggerCommand;
|
QString cmd = sp.debugger.executable;
|
||||||
if (!cmd.isEmpty())
|
if (!cmd.isEmpty())
|
||||||
str << "Debugger: " << QDir::toNativeSeparators(cmd) << '\n';
|
str << "Debugger: " << QDir::toNativeSeparators(cmd) << '\n';
|
||||||
if (!sp.coreFile.isEmpty())
|
if (!sp.coreFile.isEmpty())
|
||||||
|
|||||||
@@ -354,11 +354,20 @@ static DebuggerRunControl *doCreate(DebuggerRunParameters rp, RunConfiguration *
|
|||||||
if (rp.symbolFile.isEmpty())
|
if (rp.symbolFile.isEmpty())
|
||||||
rp.symbolFile = rp.inferior.executable;
|
rp.symbolFile = rp.inferior.executable;
|
||||||
|
|
||||||
|
rp.debugger = DebuggerKitInformation::runnable(kit);
|
||||||
|
const QByteArray envBinary = qgetenv("QTC_DEBUGGER_PATH");
|
||||||
|
if (!envBinary.isEmpty())
|
||||||
|
rp.debugger.executable = QString::fromLocal8Bit(envBinary);
|
||||||
|
|
||||||
if (runConfig) {
|
if (runConfig) {
|
||||||
if (auto envAspect = runConfig->extraAspect<EnvironmentAspect>()) {
|
if (auto envAspect = runConfig->extraAspect<EnvironmentAspect>()) {
|
||||||
rp.inferior.environment = envAspect->environment(); // Correct.
|
rp.inferior.environment = envAspect->environment(); // Correct.
|
||||||
rp.stubEnvironment = rp.inferior.environment; // FIXME: Wrong, but contains DYLD_IMAGE_SUFFIX
|
rp.stubEnvironment = rp.inferior.environment; // FIXME: Wrong, but contains DYLD_IMAGE_SUFFIX
|
||||||
rp.debuggerEnvironment = rp.inferior.environment; // FIXME: Wrong, but contains DYLD_IMAGE_SUFFIX
|
|
||||||
|
// Copy over DYLD_IMAGE_SUFFIX etc
|
||||||
|
for (auto var : QStringList({"DYLD_IMAGE_SUFFIX", "DYLD_LIBRARY_PATH", "DYLD_FRAMEWORK_PATH"}))
|
||||||
|
if (rp.inferior.environment.hasKey(var))
|
||||||
|
rp.debugger.environment.set(var, rp.inferior.environment.value(var));
|
||||||
}
|
}
|
||||||
if (Project *project = runConfig->target()->project()) {
|
if (Project *project = runConfig->target()->project()) {
|
||||||
rp.projectSourceDirectory = project->projectDirectory().toString();
|
rp.projectSourceDirectory = project->projectDirectory().toString();
|
||||||
@@ -380,7 +389,6 @@ static DebuggerRunControl *doCreate(DebuggerRunParameters rp, RunConfiguration *
|
|||||||
|
|
||||||
rp.cppEngineType = DebuggerKitInformation::engineType(kit);
|
rp.cppEngineType = DebuggerKitInformation::engineType(kit);
|
||||||
rp.sysRoot = SysRootKitInformation::sysRoot(kit).toString();
|
rp.sysRoot = SysRootKitInformation::sysRoot(kit).toString();
|
||||||
rp.debuggerCommand = DebuggerKitInformation::debuggerCommand(kit).toString();
|
|
||||||
rp.device = DeviceKitInformation::device(kit);
|
rp.device = DeviceKitInformation::device(kit);
|
||||||
|
|
||||||
if (rp.displayName.isEmpty() && runConfig)
|
if (rp.displayName.isEmpty() && runConfig)
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ public:
|
|||||||
|
|
||||||
ProjectExplorer::StandardRunnable inferior;
|
ProjectExplorer::StandardRunnable inferior;
|
||||||
QString displayName; // Used in the Snapshots view.
|
QString displayName; // Used in the Snapshots view.
|
||||||
Utils::Environment debuggerEnvironment;
|
|
||||||
Utils::Environment stubEnvironment;
|
Utils::Environment stubEnvironment;
|
||||||
qint64 attachPID = InvalidPid;
|
qint64 attachPID = InvalidPid;
|
||||||
QStringList solibSearchPath;
|
QStringList solibSearchPath;
|
||||||
|
|||||||
@@ -45,10 +45,6 @@ void GdbAttachEngine::setupEngine()
|
|||||||
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
||||||
showMessage("TRYING TO START ADAPTER");
|
showMessage("TRYING TO START ADAPTER");
|
||||||
|
|
||||||
if (!runParameters().inferior.workingDirectory.isEmpty())
|
|
||||||
m_gdbProc.setWorkingDirectory(runParameters().inferior.workingDirectory);
|
|
||||||
m_gdbProc.setEnvironment(runParameters().debuggerEnvironment);
|
|
||||||
|
|
||||||
startGdb();
|
startGdb();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -121,7 +122,7 @@ static QString findExecutableFromName(const QString &fileNameFromCore, const QSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
GdbCoreEngine::CoreInfo
|
GdbCoreEngine::CoreInfo
|
||||||
GdbCoreEngine::readExecutableNameFromCore(const QString &debuggerCommand, const QString &coreFile)
|
GdbCoreEngine::readExecutableNameFromCore(const StandardRunnable &debugger, const QString &coreFile)
|
||||||
{
|
{
|
||||||
CoreInfo cinfo;
|
CoreInfo cinfo;
|
||||||
#if 0
|
#if 0
|
||||||
@@ -139,7 +140,7 @@ GdbCoreEngine::readExecutableNameFromCore(const QString &debuggerCommand, const
|
|||||||
QStringList envLang = QProcess::systemEnvironment();
|
QStringList envLang = QProcess::systemEnvironment();
|
||||||
Utils::Environment::setupEnglishOutput(&envLang);
|
Utils::Environment::setupEnglishOutput(&envLang);
|
||||||
proc.setEnvironment(envLang);
|
proc.setEnvironment(envLang);
|
||||||
SynchronousProcessResponse response = proc.runBlocking(debuggerCommand, args);
|
SynchronousProcessResponse response = proc.runBlocking(debugger.executable, args);
|
||||||
|
|
||||||
if (response.result == SynchronousProcessResponse::Finished) {
|
if (response.result == SynchronousProcessResponse::Finished) {
|
||||||
QString output = response.stdOut();
|
QString output = response.stdOut();
|
||||||
@@ -171,9 +172,8 @@ void GdbCoreEngine::continueSetupEngine()
|
|||||||
m_tempCoreFile.close();
|
m_tempCoreFile.close();
|
||||||
}
|
}
|
||||||
if (isCore && m_executable.isEmpty()) {
|
if (isCore && m_executable.isEmpty()) {
|
||||||
GdbCoreEngine::CoreInfo cinfo = readExecutableNameFromCore(
|
GdbCoreEngine::CoreInfo cinfo =
|
||||||
runParameters().debuggerCommand,
|
readExecutableNameFromCore(runParameters().debugger, coreFileName());
|
||||||
coreFileName());
|
|
||||||
|
|
||||||
if (cinfo.isCore) {
|
if (cinfo.isCore) {
|
||||||
m_executable = cinfo.foundExecutableName;
|
m_executable = cinfo.foundExecutableName;
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ public:
|
|||||||
QString foundExecutableName; // empty if no corresponding exec could be found
|
QString foundExecutableName; // empty if no corresponding exec could be found
|
||||||
bool isCore = false;
|
bool isCore = false;
|
||||||
};
|
};
|
||||||
static CoreInfo readExecutableNameFromCore(const QString &debuggerCmd, const QString &coreFile);
|
static CoreInfo readExecutableNameFromCore(const ProjectExplorer::StandardRunnable &debugger,
|
||||||
|
const QString &coreFile);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupEngine() override;
|
void setupEngine() override;
|
||||||
|
|||||||
@@ -267,14 +267,19 @@ DebuggerStartMode GdbEngine::startMode() const
|
|||||||
return runParameters().startMode;
|
return runParameters().startMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString GdbEngine::failedToStartMessage()
|
||||||
|
{
|
||||||
|
return tr("The gdb process failed to start.");
|
||||||
|
}
|
||||||
|
|
||||||
QString GdbEngine::errorMessage(QProcess::ProcessError error)
|
QString GdbEngine::errorMessage(QProcess::ProcessError error)
|
||||||
{
|
{
|
||||||
switch (error) {
|
switch (error) {
|
||||||
case QProcess::FailedToStart:
|
case QProcess::FailedToStart:
|
||||||
return tr("The gdb process failed to start. Either the "
|
return failedToStartMessage() + ' ' + tr("Either the "
|
||||||
"invoked program \"%1\" is missing, or you may have insufficient "
|
"invoked program \"%1\" is missing, or you may have insufficient "
|
||||||
"permissions to invoke the program.\n%2")
|
"permissions to invoke the program.\n%2")
|
||||||
.arg(m_gdb, m_gdbProc.errorString());
|
.arg(runParameters().debugger.executable, m_gdbProc.errorString());
|
||||||
case QProcess::Crashed:
|
case QProcess::Crashed:
|
||||||
if (targetState() == DebuggerFinished)
|
if (targetState() == DebuggerFinished)
|
||||||
return tr("The gdb process crashed some time after starting "
|
return tr("The gdb process crashed some time after starting "
|
||||||
@@ -860,7 +865,7 @@ void GdbEngine::interruptInferior()
|
|||||||
connect(m_signalOperation.data(), &DeviceProcessSignalOperation::finished,
|
connect(m_signalOperation.data(), &DeviceProcessSignalOperation::finished,
|
||||||
this, &GdbEngine::handleInterruptDeviceInferior);
|
this, &GdbEngine::handleInterruptDeviceInferior);
|
||||||
|
|
||||||
m_signalOperation->setDebuggerCommand(runParameters().debuggerCommand);
|
m_signalOperation->setDebuggerCommand(runParameters().debugger.executable);
|
||||||
m_signalOperation->interruptProcess(inferiorPid());
|
m_signalOperation->interruptProcess(inferiorPid());
|
||||||
} else {
|
} else {
|
||||||
interruptInferior2();
|
interruptInferior2();
|
||||||
@@ -3945,18 +3950,6 @@ bool GdbEngine::handleCliDisassemblerResult(const QString &output, DisassemblerA
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Binary/configuration check logic.
|
|
||||||
|
|
||||||
static QString gdbBinary(const DebuggerRunParameters &sp)
|
|
||||||
{
|
|
||||||
// 1) Environment.
|
|
||||||
const QByteArray envBinary = qgetenv("QTC_DEBUGGER_PATH");
|
|
||||||
if (!envBinary.isEmpty())
|
|
||||||
return QString::fromLocal8Bit(envBinary);
|
|
||||||
// 2) Command from profile.
|
|
||||||
return sp.debuggerCommand;
|
|
||||||
}
|
|
||||||
|
|
||||||
static SourcePathMap mergeStartParametersSourcePathMap(const DebuggerRunParameters &sp,
|
static SourcePathMap mergeStartParametersSourcePathMap(const DebuggerRunParameters &sp,
|
||||||
const SourcePathMap &in)
|
const SourcePathMap &in)
|
||||||
{
|
{
|
||||||
@@ -3982,14 +3975,14 @@ void GdbEngine::startGdb(const QStringList &args)
|
|||||||
m_gdbProc.disconnect(); // From any previous runs
|
m_gdbProc.disconnect(); // From any previous runs
|
||||||
|
|
||||||
const DebuggerRunParameters &rp = runParameters();
|
const DebuggerRunParameters &rp = runParameters();
|
||||||
m_gdb = gdbBinary(rp);
|
if (rp.debugger.executable.isEmpty()) {
|
||||||
if (m_gdb.isEmpty()) {
|
|
||||||
handleGdbStartFailed();
|
handleGdbStartFailed();
|
||||||
handleAdapterStartFailed(
|
handleAdapterStartFailed(
|
||||||
msgNoGdbBinaryForToolChain(rp.toolChainAbi),
|
msgNoGdbBinaryForToolChain(rp.toolChainAbi),
|
||||||
Constants::DEBUGGER_COMMON_SETTINGS_ID);
|
Constants::DEBUGGER_COMMON_SETTINGS_ID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList gdbArgs;
|
QStringList gdbArgs;
|
||||||
gdbArgs << "-i";
|
gdbArgs << "-i";
|
||||||
gdbArgs << "mi";
|
gdbArgs << "mi";
|
||||||
@@ -4004,16 +3997,21 @@ void GdbEngine::startGdb(const QStringList &args)
|
|||||||
connect(&m_gdbProc, &QtcProcess::readyReadStandardOutput, this, &GdbEngine::readGdbStandardOutput);
|
connect(&m_gdbProc, &QtcProcess::readyReadStandardOutput, this, &GdbEngine::readGdbStandardOutput);
|
||||||
connect(&m_gdbProc, &QtcProcess::readyReadStandardError, this, &GdbEngine::readGdbStandardError);
|
connect(&m_gdbProc, &QtcProcess::readyReadStandardError, this, &GdbEngine::readGdbStandardError);
|
||||||
|
|
||||||
showMessage("STARTING " + m_gdb + " " + gdbArgs.join(' '));
|
showMessage("STARTING " + rp.debugger.executable + " " + gdbArgs.join(' '));
|
||||||
m_gdbProc.setCommand(m_gdb, QtcProcess::joinArgs(gdbArgs));
|
m_gdbProc.setCommand(rp.debugger.executable, QtcProcess::joinArgs(gdbArgs));
|
||||||
Environment env = Environment(m_gdbProc.systemEnvironment());
|
if (QFileInfo(rp.debugger.workingDirectory).isDir())
|
||||||
env.set("LC_NUMERIC", "C");
|
m_gdbProc.setWorkingDirectory(rp.debugger.workingDirectory);
|
||||||
m_gdbProc.setEnvironment(env);
|
m_gdbProc.setEnvironment(rp.debugger.environment);
|
||||||
m_gdbProc.start();
|
m_gdbProc.start();
|
||||||
|
|
||||||
if (!m_gdbProc.waitForStarted()) {
|
if (!m_gdbProc.waitForStarted()) {
|
||||||
handleGdbStartFailed();
|
handleGdbStartFailed();
|
||||||
const QString msg = errorMessage(QProcess::FailedToStart);
|
QString msg;
|
||||||
|
QString wd = m_gdbProc.workingDirectory();
|
||||||
|
if (!QFileInfo(wd).isDir())
|
||||||
|
msg = failedToStartMessage() + ' ' + tr("The working directory \"%s\" is not usable.").arg(wd);
|
||||||
|
else
|
||||||
|
msg = errorMessage(QProcess::FailedToStart);
|
||||||
handleAdapterStartFailed(msg);
|
handleAdapterStartFailed(msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4136,7 +4134,7 @@ void GdbEngine::startGdb(const QStringList &args)
|
|||||||
if (terminal()->isUsable())
|
if (terminal()->isUsable())
|
||||||
runCommand({"set inferior-tty " + QString::fromUtf8(terminal()->slaveDevice()), NoFlags});
|
runCommand({"set inferior-tty " + QString::fromUtf8(terminal()->slaveDevice()), NoFlags});
|
||||||
|
|
||||||
const QFileInfo gdbBinaryFile(m_gdb);
|
const QFileInfo gdbBinaryFile(rp.debugger.executable);
|
||||||
const QString uninstalledData = gdbBinaryFile.absolutePath() + "/data-directory/python";
|
const QString uninstalledData = gdbBinaryFile.absolutePath() + "/data-directory/python";
|
||||||
|
|
||||||
runCommand({"python sys.path.insert(1, '" + dumperSourcePath + "')", NoFlags});
|
runCommand({"python sys.path.insert(1, '" + dumperSourcePath + "')", NoFlags});
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include <debugger/registerhandler.h>
|
#include <debugger/registerhandler.h>
|
||||||
#include <debugger/watchhandler.h>
|
#include <debugger/watchhandler.h>
|
||||||
#include <debugger/watchutils.h>
|
#include <debugger/watchutils.h>
|
||||||
|
#include <debugger/debuggeritem.h>
|
||||||
#include <debugger/debuggertooltipmanager.h>
|
#include <debugger/debuggertooltipmanager.h>
|
||||||
|
|
||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
@@ -397,13 +398,12 @@ protected:
|
|||||||
//
|
//
|
||||||
void reloadDebuggingHelpers() override;
|
void reloadDebuggingHelpers() override;
|
||||||
|
|
||||||
QString m_gdb;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convenience Functions
|
// Convenience Functions
|
||||||
//
|
//
|
||||||
QString errorMessage(QProcess::ProcessError error);
|
QString errorMessage(QProcess::ProcessError error);
|
||||||
void showExecutionError(const QString &message);
|
void showExecutionError(const QString &message);
|
||||||
|
QString failedToStartMessage();
|
||||||
|
|
||||||
static QString tooltipIName(const QString &exp);
|
static QString tooltipIName(const QString &exp);
|
||||||
|
|
||||||
|
|||||||
@@ -121,10 +121,6 @@ void GdbPlainEngine::setupEngine()
|
|||||||
}
|
}
|
||||||
gdbArgs.append("--tty=" + m_outputCollector.serverName());
|
gdbArgs.append("--tty=" + m_outputCollector.serverName());
|
||||||
|
|
||||||
QString workingDirectory = runParameters().inferior.workingDirectory;
|
|
||||||
if (!workingDirectory.isEmpty() && QFileInfo::exists(workingDirectory))
|
|
||||||
m_gdbProc.setWorkingDirectory(workingDirectory);
|
|
||||||
|
|
||||||
startGdb(gdbArgs);
|
startGdb(gdbArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,8 +86,6 @@ void GdbRemoteServerEngine::setupEngine()
|
|||||||
m_uploadProc.start(arglist);
|
m_uploadProc.start(arglist);
|
||||||
m_uploadProc.waitForStarted();
|
m_uploadProc.waitForStarted();
|
||||||
}
|
}
|
||||||
if (!runParameters().inferior.workingDirectory.isEmpty())
|
|
||||||
m_gdbProc.setWorkingDirectory(runParameters().inferior.workingDirectory);
|
|
||||||
|
|
||||||
if (runParameters().remoteSetupNeeded) {
|
if (runParameters().remoteSetupNeeded) {
|
||||||
notifyEngineRequestRemoteSetup();
|
notifyEngineRequestRemoteSetup();
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ void LldbEngine::setupEngine()
|
|||||||
|
|
||||||
void LldbEngine::startLldb()
|
void LldbEngine::startLldb()
|
||||||
{
|
{
|
||||||
m_lldbCmd = runParameters().debuggerCommand;
|
QString lldbCmd = runParameters().debugger.executable;
|
||||||
connect(&m_lldbProc, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
|
connect(&m_lldbProc, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
|
||||||
this, &LldbEngine::handleLldbError);
|
this, &LldbEngine::handleLldbError);
|
||||||
connect(&m_lldbProc, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
|
connect(&m_lldbProc, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
|
||||||
@@ -260,17 +260,17 @@ void LldbEngine::startLldb()
|
|||||||
connect(this, &LldbEngine::outputReady,
|
connect(this, &LldbEngine::outputReady,
|
||||||
this, &LldbEngine::handleResponse, Qt::QueuedConnection);
|
this, &LldbEngine::handleResponse, Qt::QueuedConnection);
|
||||||
|
|
||||||
showMessage("STARTING LLDB: " + m_lldbCmd);
|
showMessage("STARTING LLDB: " + lldbCmd);
|
||||||
m_lldbProc.setEnvironment(runParameters().debuggerEnvironment);
|
m_lldbProc.setEnvironment(runParameters().debugger.environment);
|
||||||
if (!runParameters().inferior.workingDirectory.isEmpty())
|
if (QFileInfo(runParameters().debugger.workingDirectory).isDir())
|
||||||
m_lldbProc.setWorkingDirectory(runParameters().inferior.workingDirectory);
|
m_lldbProc.setWorkingDirectory(runParameters().debugger.workingDirectory);
|
||||||
|
|
||||||
m_lldbProc.setCommand(m_lldbCmd, QString());
|
m_lldbProc.setCommand(lldbCmd, QString());
|
||||||
m_lldbProc.start();
|
m_lldbProc.start();
|
||||||
|
|
||||||
if (!m_lldbProc.waitForStarted()) {
|
if (!m_lldbProc.waitForStarted()) {
|
||||||
const QString msg = tr("Unable to start LLDB \"%1\": %2")
|
const QString msg = tr("Unable to start LLDB \"%1\": %2")
|
||||||
.arg(m_lldbCmd, m_lldbProc.errorString());
|
.arg(lldbCmd, m_lldbProc.errorString());
|
||||||
notifyEngineSetupFailed();
|
notifyEngineSetupFailed();
|
||||||
showMessage("ADAPTER START FAILED");
|
showMessage("ADAPTER START FAILED");
|
||||||
if (!msg.isEmpty())
|
if (!msg.isEmpty())
|
||||||
@@ -852,7 +852,7 @@ QString LldbEngine::errorMessage(QProcess::ProcessError error) const
|
|||||||
return tr("The LLDB process failed to start. Either the "
|
return tr("The LLDB process failed to start. Either the "
|
||||||
"invoked program \"%1\" is missing, or you may have insufficient "
|
"invoked program \"%1\" is missing, or you may have insufficient "
|
||||||
"permissions to invoke the program.")
|
"permissions to invoke the program.")
|
||||||
.arg(m_lldbCmd);
|
.arg(runParameters().debugger.executable);
|
||||||
case QProcess::Crashed:
|
case QProcess::Crashed:
|
||||||
return tr("The LLDB process crashed some time after starting "
|
return tr("The LLDB process crashed some time after starting "
|
||||||
"successfully.");
|
"successfully.");
|
||||||
|
|||||||
@@ -150,7 +150,6 @@ private:
|
|||||||
QString m_inbuffer;
|
QString m_inbuffer;
|
||||||
QString m_scriptFileName;
|
QString m_scriptFileName;
|
||||||
Utils::QtcProcess m_lldbProc;
|
Utils::QtcProcess m_lldbProc;
|
||||||
QString m_lldbCmd;
|
|
||||||
|
|
||||||
// FIXME: Make generic.
|
// FIXME: Make generic.
|
||||||
int m_lastAgentId;
|
int m_lastAgentId;
|
||||||
|
|||||||
@@ -363,9 +363,8 @@ void AttachCoreDialog::coreFileChanged(const QString &core)
|
|||||||
if (!HostOsInfo::isWindowsHost() && QFile::exists(core)) {
|
if (!HostOsInfo::isWindowsHost() && QFile::exists(core)) {
|
||||||
Kit *k = d->kitChooser->currentKit();
|
Kit *k = d->kitChooser->currentKit();
|
||||||
QTC_ASSERT(k, return);
|
QTC_ASSERT(k, return);
|
||||||
FileName cmd = DebuggerKitInformation::debuggerCommand(k);
|
StandardRunnable debugger = DebuggerKitInformation::runnable(k);
|
||||||
GdbCoreEngine::CoreInfo cinfo =
|
GdbCoreEngine::CoreInfo cinfo = GdbCoreEngine::readExecutableNameFromCore(debugger, core);
|
||||||
GdbCoreEngine::readExecutableNameFromCore(cmd.toString(), core);
|
|
||||||
if (!cinfo.foundExecutableName.isEmpty())
|
if (!cinfo.foundExecutableName.isEmpty())
|
||||||
d->localExecFileName->setFileName(FileName::fromString(cinfo.foundExecutableName));
|
d->localExecFileName->setFileName(FileName::fromString(cinfo.foundExecutableName));
|
||||||
else if (!d->localExecFileName->isValid() && !cinfo.rawStringFromCore.isEmpty())
|
else if (!d->localExecFileName->isValid() && !cinfo.rawStringFromCore.isEmpty())
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ void PdbEngine::setupEngine()
|
|||||||
QStringList args = { bridge, scriptFile.fileName() };
|
QStringList args = { bridge, scriptFile.fileName() };
|
||||||
args.append(Utils::QtcProcess::splitArgs(runParameters().inferior.workingDirectory));
|
args.append(Utils::QtcProcess::splitArgs(runParameters().inferior.workingDirectory));
|
||||||
showMessage("STARTING " + m_interpreter + QLatin1Char(' ') + args.join(QLatin1Char(' ')));
|
showMessage("STARTING " + m_interpreter + QLatin1Char(' ') + args.join(QLatin1Char(' ')));
|
||||||
m_proc.setEnvironment(runParameters().debuggerEnvironment.toStringList());
|
m_proc.setEnvironment(runParameters().debugger.environment.toStringList());
|
||||||
m_proc.start(m_interpreter, args);
|
m_proc.start(m_interpreter, args);
|
||||||
|
|
||||||
if (!m_proc.waitForStarted()) {
|
if (!m_proc.waitForStarted()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user