forked from qt-creator/qt-creator
Debugger: Update debugger details when executable is replaced
Store last modified time in persistent storage, and if it is changed, reinitialize the item. Change-Id: I15e8c843fecd3cebd528f2dadb64645828a2b221 Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
24f34420fd
commit
383737d020
@@ -57,6 +57,7 @@ const char DEBUGGER_INFORMATION_AUTODETECTED[] = "AutoDetected";
|
|||||||
const char DEBUGGER_INFORMATION_AUTODETECTION_SOURCE[] = "AutoDetectionSource";
|
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";
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
|
|
||||||
@@ -87,6 +88,7 @@ DebuggerItem::DebuggerItem(const QVariantMap &data)
|
|||||||
m_version = data.value(QLatin1String(DEBUGGER_INFORMATION_VERSION)).toString();
|
m_version = data.value(QLatin1String(DEBUGGER_INFORMATION_VERSION)).toString();
|
||||||
m_engineType = DebuggerEngineType(data.value(QLatin1String(DEBUGGER_INFORMATION_ENGINETYPE),
|
m_engineType = DebuggerEngineType(data.value(QLatin1String(DEBUGGER_INFORMATION_ENGINETYPE),
|
||||||
static_cast<int>(NoEngineType)).toInt());
|
static_cast<int>(NoEngineType)).toInt());
|
||||||
|
m_lastModified = data.value(QLatin1String(DEBUGGER_INFORMATION_LASTMODIFIED)).toDateTime();
|
||||||
|
|
||||||
foreach (const QString &a, data.value(QLatin1String(DEBUGGER_INFORMATION_ABIS)).toStringList()) {
|
foreach (const QString &a, data.value(QLatin1String(DEBUGGER_INFORMATION_ABIS)).toStringList()) {
|
||||||
Abi abi(a);
|
Abi abi(a);
|
||||||
@@ -110,7 +112,9 @@ void DebuggerItem::reinitializeFromFile()
|
|||||||
// happy with both -version and --version. So use the "working" -version
|
// happy with both -version and --version. So use the "working" -version
|
||||||
// except for the experimental LLDB-MI which insists on --version.
|
// except for the experimental LLDB-MI which insists on --version.
|
||||||
const char *version = "-version";
|
const char *version = "-version";
|
||||||
if (m_command.toFileInfo().baseName().toLower().contains(QLatin1String("lldb-mi")))
|
const QFileInfo fileInfo = m_command.toFileInfo();
|
||||||
|
m_lastModified = fileInfo.lastModified();
|
||||||
|
if (fileInfo.baseName().toLower().contains(QLatin1String("lldb-mi")))
|
||||||
version = "--version";
|
version = "--version";
|
||||||
|
|
||||||
QProcess proc;
|
QProcess proc;
|
||||||
@@ -203,6 +207,11 @@ QStringList DebuggerItem::abiNames() const
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDateTime DebuggerItem::lastModified() const
|
||||||
|
{
|
||||||
|
return m_lastModified;
|
||||||
|
}
|
||||||
|
|
||||||
bool DebuggerItem::isGood() const
|
bool DebuggerItem::isGood() const
|
||||||
{
|
{
|
||||||
return m_engineType != NoEngineType;
|
return m_engineType != NoEngineType;
|
||||||
@@ -234,6 +243,7 @@ QVariantMap DebuggerItem::toMap() const
|
|||||||
data.insert(QLatin1String(DEBUGGER_INFORMATION_AUTODETECTION_SOURCE), m_autoDetectionSource);
|
data.insert(QLatin1String(DEBUGGER_INFORMATION_AUTODETECTION_SOURCE), m_autoDetectionSource);
|
||||||
data.insert(QLatin1String(DEBUGGER_INFORMATION_VERSION), m_version);
|
data.insert(QLatin1String(DEBUGGER_INFORMATION_VERSION), m_version);
|
||||||
data.insert(QLatin1String(DEBUGGER_INFORMATION_ABIS), abiNames());
|
data.insert(QLatin1String(DEBUGGER_INFORMATION_ABIS), abiNames());
|
||||||
|
data.insert(QLatin1String(DEBUGGER_INFORMATION_LASTMODIFIED), m_lastModified);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
|
||||||
|
#include <QDateTime>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
@@ -92,6 +93,7 @@ public:
|
|||||||
MatchLevel matchTarget(const ProjectExplorer::Abi &targetAbi) const;
|
MatchLevel matchTarget(const ProjectExplorer::Abi &targetAbi) const;
|
||||||
|
|
||||||
QStringList abiNames() const;
|
QStringList abiNames() const;
|
||||||
|
QDateTime lastModified() const;
|
||||||
|
|
||||||
bool isGood() const;
|
bool isGood() const;
|
||||||
QString validityMessage() const;
|
QString validityMessage() const;
|
||||||
@@ -112,6 +114,7 @@ private:
|
|||||||
QString m_autoDetectionSource;
|
QString m_autoDetectionSource;
|
||||||
QString m_version;
|
QString m_version;
|
||||||
QList<ProjectExplorer::Abi> m_abis;
|
QList<ProjectExplorer::Abi> m_abis;
|
||||||
|
QDateTime m_lastModified;
|
||||||
|
|
||||||
friend class Internal::DebuggerConfigWidget;
|
friend class Internal::DebuggerConfigWidget;
|
||||||
friend class Internal::DebuggerItemConfigWidget;
|
friend class Internal::DebuggerItemConfigWidget;
|
||||||
|
@@ -256,8 +256,12 @@ void DebuggerItemManager::autoDetectGdbOrLldbDebuggers()
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (const FileName &command, suspects) {
|
foreach (const FileName &command, suspects) {
|
||||||
if (findByCommand(command))
|
DebuggerItem *existingItem = findByCommand(command);
|
||||||
|
if (existingItem) {
|
||||||
|
if (command.toFileInfo().lastModified() != existingItem->lastModified())
|
||||||
|
existingItem->reinitializeFromFile();
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
DebuggerItem item;
|
DebuggerItem item;
|
||||||
item.createId();
|
item.createId();
|
||||||
item.setCommand(command);
|
item.setCommand(command);
|
||||||
@@ -309,9 +313,9 @@ void DebuggerItemManager::readLegacyDebuggers(const FileName &file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const DebuggerItem *DebuggerItemManager::findByCommand(const FileName &command)
|
DebuggerItem *DebuggerItemManager::findByCommand(const FileName &command)
|
||||||
{
|
{
|
||||||
foreach (const DebuggerItem &item, m_debuggers)
|
for (auto &item: m_debuggers)
|
||||||
if (item.command() == command)
|
if (item.command() == command)
|
||||||
return &item;
|
return &item;
|
||||||
|
|
||||||
|
@@ -55,7 +55,7 @@ public:
|
|||||||
static QVariant registerDebugger(const DebuggerItem &item);
|
static QVariant registerDebugger(const DebuggerItem &item);
|
||||||
static void deregisterDebugger(const QVariant &id);
|
static void deregisterDebugger(const QVariant &id);
|
||||||
|
|
||||||
static const DebuggerItem *findByCommand(const Utils::FileName &command);
|
static DebuggerItem *findByCommand(const Utils::FileName &command);
|
||||||
static const DebuggerItem *findById(const QVariant &id);
|
static const DebuggerItem *findById(const QVariant &id);
|
||||||
static const DebuggerItem *findByEngineType(DebuggerEngineType engineType);
|
static const DebuggerItem *findByEngineType(DebuggerEngineType engineType);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user