Commit 54bbcc4a authored by dt's avatar dt
Browse files

Mention possible locations of the debugging helper in the error dialog

Requires a lot of trivial forwarding.
parent 609e3c7f
......@@ -170,6 +170,12 @@ QString CMakeRunConfiguration::dumperLibrary() const
return dhl;
}
QStringList CMakeRunConfiguration::dumperLibraryLocations() const
{
QString qmakePath = ProjectExplorer::DebuggingHelperLibrary::findSystemQt(environment());
return ProjectExplorer::DebuggingHelperLibrary::debuggingHelperLibraryLocations(qmakePath);
}
ProjectExplorer::Environment CMakeRunConfiguration::baseEnvironment() const
{
ProjectExplorer::Environment env;
......
......@@ -70,6 +70,7 @@ public:
virtual void save(ProjectExplorer::PersistentSettingsWriter &writer) const;
virtual void restore(const ProjectExplorer::PersistentSettingsReader &reader);
virtual QString dumperLibrary() const;
virtual QStringList dumperLibraryLocations() const;
virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
signals:
......
......@@ -539,12 +539,13 @@ bool CdbDebugEngine::startDebugger(const QSharedPointer<DebuggerStartParameters>
const QString dumperLibName = QDir::toNativeSeparators(m_d->m_debuggerManagerAccess->qtDumperLibraryName());
bool dumperEnabled = mode != AttachCore
&& mode != AttachCrashedExternal
&& !dumperLibName.isEmpty()
&& m_d->m_debuggerManagerAccess->qtDumperLibraryEnabled();
if (dumperEnabled) {
const QFileInfo fi(dumperLibName);
if (!fi.isFile()) {
const QString msg = tr("The dumper library '%1' does not exist.").arg(dumperLibName);
const QStringList &locations = m_d->m_debuggerManagerAccess->qtDumperLibraryLocations();
const QString loc = locations.join(QLatin1String(", "));
const QString msg = tr("The dumper library was not found at %1.").arg(loc);
m_d->m_debuggerManagerAccess->showQtDumperLibraryWarning(msg);
dumperEnabled = false;
}
......
......@@ -1004,6 +1004,11 @@ void DebuggerManager::setQtDumperLibraryName(const QString &dl)
m_dumperLib = dl;
}
void DebuggerManager::setQtDumperLibraryLocations(const QStringList &dl)
{
m_dumperLibLocations = dl;
}
qint64 DebuggerManager::inferiorPid() const
{
return m_inferiorPid;
......@@ -1518,6 +1523,15 @@ QString DebuggerManager::qtDumperLibraryName() const
return m_dumperLib;
}
QStringList DebuggerManager::qtDumperLibraryLocations() const
{
if (theDebuggerAction(UseCustomDebuggingHelperLocation)->value().toBool())
return QStringList() <<
( theDebuggerAction(CustomDebuggingHelperLocation)->value().toString()
+ tr(" (explicitly set in the Debugger Options)"));
return m_dumperLibLocations;
}
void DebuggerManager::showQtDumperLibraryWarning(const QString &details)
{
QMessageBox dialog(mainWindow());
......
......@@ -236,6 +236,7 @@ private:
virtual bool qtDumperLibraryEnabled() const = 0;
virtual QString qtDumperLibraryName() const = 0;
virtual QStringList qtDumperLibraryLocations() const = 0;
virtual void showQtDumperLibraryWarning(const QString &details = QString()) = 0;
virtual bool isReverseDebugging() const = 0;
......@@ -272,6 +273,7 @@ public slots:
virtual qint64 inferiorPid() const;
void setQtDumperLibraryName(const QString &dl); // Run Control
void setQtDumperLibraryLocations(const QStringList &dl);
void setSimpleDockWidgetArrangement();
void setLocked(bool locked);
......@@ -376,6 +378,7 @@ private:
virtual bool qtDumperLibraryEnabled() const;
virtual QString qtDumperLibraryName() const;
virtual QStringList qtDumperLibraryLocations() const;
virtual void showQtDumperLibraryWarning(const QString &details = QString());
virtual bool isReverseDebugging() const;
......@@ -434,6 +437,7 @@ private:
QSharedPointer<DebuggerStartParameters> m_startParameters;
DebuggerRunControl *m_runControl;
QString m_dumperLib;
QStringList m_dumperLibLocations;
qint64 m_inferiorPid;
......
......@@ -158,6 +158,7 @@ void DebuggerRunControl::start()
break;
}
m_manager->setQtDumperLibraryName(rc->dumperLibrary());
m_manager->setQtDumperLibraryLocations(rc->dumperLibraryLocations());
if (const ProjectExplorer::Project *project = rc->project()) {
m_startParameters->buildDir = project->buildDirectory(project->activeBuildConfiguration());
}
......
......@@ -3855,11 +3855,13 @@ void GdbEngine::tryLoadDebuggingHelpers()
if (!qq->qtDumperLibraryEnabled())
return;
const QString lib = qq->qtDumperLibraryName();
const QStringList &locations = qq->qtDumperLibraryLocations();
//qDebug() << "DUMPERLIB:" << lib;
// @TODO: same in CDB engine...
const QFileInfo fi(lib);
if (!fi.exists()) {
const QString msg = tr("The dumper library '%1' does not exist.").arg(lib);
const QString loc = locations.join(QLatin1String(", "));
const QString msg = tr("The dumper library was not found at %1.").arg(loc);
debugMessage(msg);
qq->showQtDumperLibraryWarning(msg);
return;
......
......@@ -57,6 +57,7 @@ public:
virtual QStringList commandLineArguments() const = 0;
virtual Environment environment() const = 0;
virtual QString dumperLibrary() const = 0;
virtual QStringList dumperLibraryLocations() const = 0;
virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const = 0;
virtual void save(PersistentSettingsWriter &writer) const;
......
......@@ -459,6 +459,12 @@ QString CustomExecutableRunConfiguration::dumperLibrary() const
return ProjectExplorer::DebuggingHelperLibrary::debuggingHelperLibrary(qmakePath);
}
QStringList CustomExecutableRunConfiguration::dumperLibraryLocations() const
{
QString qmakePath = ProjectExplorer::DebuggingHelperLibrary::findSystemQt(environment());
return ProjectExplorer::DebuggingHelperLibrary::debuggingHelperLibraryLocations(qmakePath);
}
ProjectExplorer::ToolChain::ToolChainType CustomExecutableRunConfiguration::toolChainType() const
{
return ProjectExplorer::ToolChain::UNKNOWN;
......
......@@ -89,6 +89,7 @@ public:
virtual QWidget *configurationWidget();
virtual QString dumperLibrary() const;
virtual QStringList dumperLibraryLocations() const;
virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
......
......@@ -66,11 +66,16 @@ QStringList DebuggingHelperLibrary::debuggingHelperLibraryDirectories(const QStr
QStringList directories;
directories
<< (qtInstallData + "/qtc-debugging-helper/")
<< (QApplication::applicationDirPath() + "/../qtc-debugging-helper/" + QString::number(hash)) + "/"
<< QDir::cleanPath((QApplication::applicationDirPath() + "/../qtc-debugging-helper/" + QString::number(hash))) + "/"
<< (QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/qtc-debugging-helper/" + QString::number(hash)) + "/";
return directories;
}
QStringList DebuggingHelperLibrary::debuggingHelperLibraryLocations(const QString &qmakePath)
{
return debuggingHelperLibraryLocations(qtInstallDataDir(qmakePath), qtDir(qmakePath));
}
QString DebuggingHelperLibrary::debuggingHelperLibrary(const QString &qmakePath)
{
return debuggingHelperLibrary(qtInstallDataDir(qmakePath), qtDir(qmakePath));
......@@ -94,6 +99,22 @@ QString DebuggingHelperLibrary::qtDir(const QString &qmakePath)
// Debugging Helper Library
QStringList DebuggingHelperLibrary::debuggingHelperLibraryLocations(const QString &qtInstallData, const QString &qtpath)
{
QStringList result;
foreach(const QString &directory, debuggingHelperLibraryDirectories(qtInstallData, qtpath)) {
#if defined(Q_OS_WIN)
QFileInfo fi(directory + "debug/gdbmacros.dll");
#elif defined(Q_OS_MAC)
QFileInfo fi(directory + "libgdbmacros.dylib");
#else // generic UNIX
QFileInfo fi(directory + "libgdbmacros.so");
#endif
result << fi.filePath();
}
return result;
}
QString DebuggingHelperLibrary::debuggingHelperLibrary(const QString &qtInstallData, const QString &qtpath)
{
foreach(const QString &directory, debuggingHelperLibraryDirectories(qtInstallData, qtpath)) {
......
......@@ -49,11 +49,18 @@ public:
static QString qtVersionForQMake(const QString &qmakePath);
static bool hasDebuggingHelperLibrary(const QString &qmakePath);
static QString debuggingHelperLibrary(const QString &qmakePath);
static QString buildDebuggingHelperLibrary(const QString &qmakePath, const QString &make, const Environment &env);
static QString debuggingHelperLibrary(const QString &qtInstallData, const QString &qtpath);
static QString copyDebuggingHelperLibrary(const QString &qtInstallData, const QString &qtdir);
static QString buildDebuggingHelperLibrary(const QString &qmakePath, const QString &make, const Environment &env);
static QString buildDebuggingHelperLibrary(const QString &directory, const QString &makeCommand, const QString &qmakeCommand, const QString &mkspec, const Environment &env);
static QStringList debuggingHelperLibraryLocations(const QString &qmakePath);
static QStringList debuggingHelperLibraryLocations(const QString &qtInstallData, const QString &qtpath);
static QString copyDebuggingHelperLibrary(const QString &qtInstallData, const QString &qtdir);
private:
static QStringList debuggingHelperLibraryDirectories(const QString &qtInstallData, const QString &qtpath);
static QString qtInstallDataDir(const QString &qmakePath);
......
......@@ -381,6 +381,11 @@ QString QmlRunConfiguration::dumperLibrary() const
return QString();
}
QStringList QmlRunConfiguration::dumperLibraryLocations() const
{
return QStringList();
}
QWidget *QmlRunConfiguration::configurationWidget()
{
QWidget *config = new QWidget;
......
......@@ -150,6 +150,7 @@ public:
virtual QStringList commandLineArguments() const;
virtual ProjectExplorer::Environment environment() const;
virtual QString dumperLibrary() const;
virtual QStringList dumperLibraryLocations() const;
virtual QWidget *configurationWidget();
ProjectExplorer::ToolChain::ToolChainType toolChainType() const { return ProjectExplorer::ToolChain::OTHER; }
......
......@@ -637,6 +637,13 @@ QString Qt4RunConfiguration::dumperLibrary() const
return version->debuggingHelperLibrary();
}
QStringList Qt4RunConfiguration::dumperLibraryLocations() const
{
Qt4Project *pro = qobject_cast<Qt4Project *>(project());
QtVersion *version = pro->qtVersion(pro->activeBuildConfiguration());
return version->debuggingHelperLibraryLocations();;
}
void Qt4RunConfiguration::setBaseEnvironmentBase(BaseEnvironmentBase env)
{
if (m_baseEnvironmentBase == env)
......
......@@ -74,6 +74,7 @@ public:
virtual QStringList commandLineArguments() const;
virtual ProjectExplorer::Environment environment() const;
virtual QString dumperLibrary() const;
virtual QStringList dumperLibraryLocations() const;
virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
bool isUsingDyldImageSuffix() const;
......
......@@ -1102,6 +1102,14 @@ QString QtVersion::debuggingHelperLibrary() const
return DebuggingHelperLibrary::debuggingHelperLibrary(qtInstallData, path());
}
QStringList QtVersion::debuggingHelperLibraryLocations() const
{
QString qtInstallData = versionInfo().value("QT_INSTALL_DATA");
if (qtInstallData.isEmpty())
qtInstallData = path();
return DebuggingHelperLibrary::debuggingHelperLibraryLocations(qtInstallData, path());
}
bool QtVersion::hasDocumentation() const
{
updateVersionInfo();
......
......@@ -96,6 +96,7 @@ public:
bool hasDebuggingHelper() const;
QString debuggingHelperLibrary() const;
QStringList debuggingHelperLibraryLocations() const;
// Builds a debugging library
// returns the output of the commands
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment