forked from qt-creator/qt-creator
CDB: Added option for verbose symbol loading, fixed image path.
Do not add all image paths (from different projects), keep a base path and add current.
This commit is contained in:
@@ -307,6 +307,7 @@ CdbDebugEnginePrivate::CdbDebugEnginePrivate(DebuggerManager *parent,
|
|||||||
|
|
||||||
bool CdbDebugEnginePrivate::init(QString *errorMessage)
|
bool CdbDebugEnginePrivate::init(QString *errorMessage)
|
||||||
{
|
{
|
||||||
|
enum { bufLen = 10240 };
|
||||||
// Load the DLL
|
// Load the DLL
|
||||||
DebuggerEngineLibrary lib;
|
DebuggerEngineLibrary lib;
|
||||||
if (!lib.init(m_options->path, errorMessage))
|
if (!lib.init(m_options->path, errorMessage))
|
||||||
@@ -343,6 +344,14 @@ bool CdbDebugEnginePrivate::init(QString *errorMessage)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WCHAR buf[bufLen];
|
||||||
|
hr = m_cif.debugSymbols->GetImagePathWide(buf, bufLen, 0);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
*errorMessage = msgComFailed("GetImagePathWide", hr);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_baseImagePath = QString::fromUtf16(buf);
|
||||||
|
|
||||||
hr = lib.debugCreate( __uuidof(IDebugRegisters2), reinterpret_cast<void**>(&m_cif.debugRegisters));
|
hr = lib.debugCreate( __uuidof(IDebugRegisters2), reinterpret_cast<void**>(&m_cif.debugRegisters));
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
*errorMessage = QString::fromLatin1("Creation of IDebugRegisters2 failed: %1").arg(msgDebugEngineComResult(hr));
|
*errorMessage = QString::fromLatin1("Creation of IDebugRegisters2 failed: %1").arg(msgDebugEngineComResult(hr));
|
||||||
@@ -619,16 +628,22 @@ bool CdbDebugEngine::startDebuggerWithExecutable(DebuggerStartMode sm, QString *
|
|||||||
|
|
||||||
const QSharedPointer<DebuggerStartParameters> sp = m_d->m_debuggerManager->startParameters();
|
const QSharedPointer<DebuggerStartParameters> sp = m_d->m_debuggerManager->startParameters();
|
||||||
const QString filename(sp->executable);
|
const QString filename(sp->executable);
|
||||||
if (debugCDB)
|
// Set image path
|
||||||
qDebug() << Q_FUNC_INFO <<filename;
|
|
||||||
|
|
||||||
const QFileInfo fi(filename);
|
const QFileInfo fi(filename);
|
||||||
m_d->m_cif.debugSymbols->AppendImagePathWide(reinterpret_cast<PCWSTR>(QDir::toNativeSeparators(fi.absolutePath()).utf16()));
|
QString imagePath = QDir::toNativeSeparators(fi.absolutePath());
|
||||||
//m_cif.debugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_DEBUG | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS);
|
if (!m_d->m_baseImagePath.isEmpty()) {
|
||||||
m_d->m_cif.debugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS);
|
imagePath += QLatin1Char(';');
|
||||||
//m_cif.debugSymbols->AddSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_DEBUG | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS | SYMOPT_NO_IMAGE_SEARCH);
|
imagePath += m_d->m_baseImagePath;
|
||||||
|
}
|
||||||
|
m_d->m_cif.debugSymbols->SetImagePathWide(reinterpret_cast<PCWSTR>(imagePath.utf16()));
|
||||||
|
if (debugCDB)
|
||||||
|
qDebug() << Q_FUNC_INFO <<'\n' << filename << imagePath;
|
||||||
|
|
||||||
|
ULONG symbolOptions = SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS;
|
||||||
|
if (m_d->m_options->verboseSymbolLoading)
|
||||||
|
symbolOptions |= SYMOPT_DEBUG;
|
||||||
|
m_d->m_cif.debugSymbols->SetSymbolOptions(symbolOptions);
|
||||||
|
|
||||||
// TODO console
|
|
||||||
const QString cmd = Core::Utils::AbstractProcess::createWinCommandline(filename, sp->processArgs);
|
const QString cmd = Core::Utils::AbstractProcess::createWinCommandline(filename, sp->processArgs);
|
||||||
if (debugCDB)
|
if (debugCDB)
|
||||||
qDebug() << "Starting " << cmd;
|
qDebug() << "Starting " << cmd;
|
||||||
|
@@ -157,6 +157,7 @@ struct CdbDebugEnginePrivate
|
|||||||
CdbDebugEventCallback m_debugEventCallBack;
|
CdbDebugEventCallback m_debugEventCallBack;
|
||||||
CdbDebugOutput m_debugOutputCallBack;
|
CdbDebugOutput m_debugOutputCallBack;
|
||||||
QSharedPointer<CdbDumperHelper> m_dumper;
|
QSharedPointer<CdbDumperHelper> m_dumper;
|
||||||
|
QString m_baseImagePath;
|
||||||
|
|
||||||
CdbDebugEngine* m_engine;
|
CdbDebugEngine* m_engine;
|
||||||
DebuggerManager *m_debuggerManager;
|
DebuggerManager *m_debuggerManager;
|
||||||
|
@@ -38,18 +38,21 @@ static const char *enabledKeyC = "Enabled";
|
|||||||
static const char *pathKeyC = "Path";
|
static const char *pathKeyC = "Path";
|
||||||
static const char *symbolPathsKeyC = "SymbolPaths";
|
static const char *symbolPathsKeyC = "SymbolPaths";
|
||||||
static const char *sourcePathsKeyC = "SourcePaths";
|
static const char *sourcePathsKeyC = "SourcePaths";
|
||||||
|
static const char *verboseSymbolLoadingKeyC = "SymbolPaths";
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
CdbOptions::CdbOptions() :
|
CdbOptions::CdbOptions() :
|
||||||
enabled(false)
|
enabled(false),
|
||||||
|
verboseSymbolLoading(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbOptions::clear()
|
void CdbOptions::clear()
|
||||||
{
|
{
|
||||||
enabled = false;
|
enabled = false;
|
||||||
|
verboseSymbolLoading = false;
|
||||||
path.clear();
|
path.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,6 +72,7 @@ void CdbOptions::fromSettings(const QSettings *s)
|
|||||||
path = s->value(keyRoot + QLatin1String(pathKeyC), QString()).toString();
|
path = s->value(keyRoot + QLatin1String(pathKeyC), QString()).toString();
|
||||||
symbolPaths = s->value(keyRoot + QLatin1String(symbolPathsKeyC), QStringList()).toStringList();
|
symbolPaths = s->value(keyRoot + QLatin1String(symbolPathsKeyC), QStringList()).toStringList();
|
||||||
sourcePaths = s->value(keyRoot + QLatin1String(sourcePathsKeyC), QStringList()).toStringList();
|
sourcePaths = s->value(keyRoot + QLatin1String(sourcePathsKeyC), QStringList()).toStringList();
|
||||||
|
verboseSymbolLoading = s->value(keyRoot + QLatin1String(verboseSymbolLoadingKeyC), false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbOptions::toSettings(QSettings *s) const
|
void CdbOptions::toSettings(QSettings *s) const
|
||||||
@@ -78,6 +82,7 @@ void CdbOptions::toSettings(QSettings *s) const
|
|||||||
s->setValue(QLatin1String(pathKeyC), path);
|
s->setValue(QLatin1String(pathKeyC), path);
|
||||||
s->setValue(QLatin1String(symbolPathsKeyC), symbolPaths);
|
s->setValue(QLatin1String(symbolPathsKeyC), symbolPaths);
|
||||||
s->setValue(QLatin1String(sourcePathsKeyC), sourcePaths);
|
s->setValue(QLatin1String(sourcePathsKeyC), sourcePaths);
|
||||||
|
s->setValue(QLatin1String(verboseSymbolLoadingKeyC), verboseSymbolLoading);
|
||||||
s->endGroup();
|
s->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,6 +133,8 @@ unsigned CdbOptions::compare(const CdbOptions &rhs) const
|
|||||||
rc |= InitializationOptionsChanged;
|
rc |= InitializationOptionsChanged;
|
||||||
if (symbolPaths != rhs.symbolPaths || sourcePaths != rhs.sourcePaths)
|
if (symbolPaths != rhs.symbolPaths || sourcePaths != rhs.sourcePaths)
|
||||||
rc |= DebuggerPathsChanged;
|
rc |= DebuggerPathsChanged;
|
||||||
|
if (verboseSymbolLoading != rhs.verboseSymbolLoading)
|
||||||
|
rc |= SymbolOptionsChanged;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -49,7 +49,9 @@ public:
|
|||||||
void toSettings(QSettings *s) const;
|
void toSettings(QSettings *s) const;
|
||||||
|
|
||||||
// A set of flags for comparison function.
|
// A set of flags for comparison function.
|
||||||
enum ChangeFlags { InitializationOptionsChanged = 0x1, DebuggerPathsChanged = 0x2 };
|
enum ChangeFlags { InitializationOptionsChanged = 0x1,
|
||||||
|
DebuggerPathsChanged = 0x2,
|
||||||
|
SymbolOptionsChanged = 0x4 };
|
||||||
unsigned compare(const CdbOptions &s) const;
|
unsigned compare(const CdbOptions &s) const;
|
||||||
|
|
||||||
// Locate the debugging tools
|
// Locate the debugging tools
|
||||||
@@ -59,6 +61,7 @@ public:
|
|||||||
QString path;
|
QString path;
|
||||||
QStringList symbolPaths;
|
QStringList symbolPaths;
|
||||||
QStringList sourcePaths;
|
QStringList sourcePaths;
|
||||||
|
bool verboseSymbolLoading;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator==(const CdbOptions &s1, const CdbOptions &s2)
|
inline bool operator==(const CdbOptions &s1, const CdbOptions &s2)
|
||||||
|
@@ -84,6 +84,8 @@ void CdbOptionsPageWidget::setOptions(CdbOptions &o)
|
|||||||
m_ui.cdbPathGroupBox->setChecked(o.enabled);
|
m_ui.cdbPathGroupBox->setChecked(o.enabled);
|
||||||
m_ui.symbolPathListEditor->setPathList(o.symbolPaths);
|
m_ui.symbolPathListEditor->setPathList(o.symbolPaths);
|
||||||
m_ui.sourcePathListEditor->setPathList(o.sourcePaths);
|
m_ui.sourcePathListEditor->setPathList(o.sourcePaths);
|
||||||
|
m_ui.verboseSymbolLoadingCheckBox->setChecked(o.verboseSymbolLoading);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CdbOptions CdbOptionsPageWidget::options() const
|
CdbOptions CdbOptionsPageWidget::options() const
|
||||||
@@ -93,6 +95,7 @@ CdbOptions CdbOptionsPageWidget::options() const
|
|||||||
rc.enabled = m_ui.cdbPathGroupBox->isChecked();
|
rc.enabled = m_ui.cdbPathGroupBox->isChecked();
|
||||||
rc.symbolPaths = m_ui.symbolPathListEditor->pathList();
|
rc.symbolPaths = m_ui.symbolPathListEditor->pathList();
|
||||||
rc.sourcePaths = m_ui.sourcePathListEditor->pathList();
|
rc.sourcePaths = m_ui.sourcePathListEditor->pathList();
|
||||||
|
rc.verboseSymbolLoading = m_ui.verboseSymbolLoadingCheckBox->isChecked();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,11 +170,17 @@ void CdbOptionsPage::apply()
|
|||||||
if (!m_widget)
|
if (!m_widget)
|
||||||
return;
|
return;
|
||||||
const CdbOptions newOptions = m_widget->options();
|
const CdbOptions newOptions = m_widget->options();
|
||||||
if (const unsigned changedMask = m_options->compare(newOptions)) {
|
if (unsigned changedMask = m_options->compare(newOptions)) {
|
||||||
*m_options = newOptions;
|
*m_options = newOptions;
|
||||||
m_options->toSettings(Core::ICore::instance()->settings());
|
m_options->toSettings(Core::ICore::instance()->settings());
|
||||||
if (changedMask & CdbOptions::DebuggerPathsChanged)
|
// Paths changed?
|
||||||
|
if (changedMask & CdbOptions::DebuggerPathsChanged) {
|
||||||
emit debuggerPathsChanged();
|
emit debuggerPathsChanged();
|
||||||
|
changedMask &= ~CdbOptions::DebuggerPathsChanged;
|
||||||
|
}
|
||||||
|
// Remaining options?
|
||||||
|
if (changedMask)
|
||||||
|
emit optionsChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -86,6 +86,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void debuggerPathsChanged();
|
void debuggerPathsChanged();
|
||||||
|
void optionsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QSharedPointer<CdbOptions> m_options;
|
const QSharedPointer<CdbOptions> m_options;
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="noteLabel">
|
<widget class="QLabel" name="noteLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string extracomment="Placeholder" notr="true">Note: bla, blah</string>
|
<string notr="true" extracomment="Placeholder">Note: bla, blah</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -79,6 +79,22 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="variousOptionsGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Other options</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout_3">
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="verboseSymbolLoadingCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Verbose Symbol Loading</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
Reference in New Issue
Block a user