Commit b41d3a45 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

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.
parent 5c856670
......@@ -307,6 +307,7 @@ CdbDebugEnginePrivate::CdbDebugEnginePrivate(DebuggerManager *parent,
bool CdbDebugEnginePrivate::init(QString *errorMessage)
{
enum { bufLen = 10240 };
// Load the DLL
DebuggerEngineLibrary lib;
if (!lib.init(m_options->path, errorMessage))
......@@ -343,6 +344,14 @@ bool CdbDebugEnginePrivate::init(QString *errorMessage)
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));
if (FAILED(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 QString filename(sp->executable);
// Set image path
const QFileInfo fi(filename);
QString imagePath = QDir::toNativeSeparators(fi.absolutePath());
if (!m_d->m_baseImagePath.isEmpty()) {
imagePath += QLatin1Char(';');
imagePath += m_d->m_baseImagePath;
}
m_d->m_cif.debugSymbols->SetImagePathWide(reinterpret_cast<PCWSTR>(imagePath.utf16()));
if (debugCDB)
qDebug() << Q_FUNC_INFO <<filename;
qDebug() << Q_FUNC_INFO <<'\n' << filename << imagePath;
const QFileInfo fi(filename);
m_d->m_cif.debugSymbols->AppendImagePathWide(reinterpret_cast<PCWSTR>(QDir::toNativeSeparators(fi.absolutePath()).utf16()));
//m_cif.debugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_DEBUG | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS);
m_d->m_cif.debugSymbols->SetSymbolOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST | SYMOPT_AUTO_PUBLICS);
//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);
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);
if (debugCDB)
qDebug() << "Starting " << cmd;
......
......@@ -157,6 +157,7 @@ struct CdbDebugEnginePrivate
CdbDebugEventCallback m_debugEventCallBack;
CdbDebugOutput m_debugOutputCallBack;
QSharedPointer<CdbDumperHelper> m_dumper;
QString m_baseImagePath;
CdbDebugEngine* m_engine;
DebuggerManager *m_debuggerManager;
......
......@@ -38,18 +38,21 @@ static const char *enabledKeyC = "Enabled";
static const char *pathKeyC = "Path";
static const char *symbolPathsKeyC = "SymbolPaths";
static const char *sourcePathsKeyC = "SourcePaths";
static const char *verboseSymbolLoadingKeyC = "SymbolPaths";
namespace Debugger {
namespace Internal {
CdbOptions::CdbOptions() :
enabled(false)
enabled(false),
verboseSymbolLoading(false)
{
}
void CdbOptions::clear()
{
enabled = false;
verboseSymbolLoading = false;
path.clear();
}
......@@ -69,6 +72,7 @@ void CdbOptions::fromSettings(const QSettings *s)
path = s->value(keyRoot + QLatin1String(pathKeyC), QString()).toString();
symbolPaths = s->value(keyRoot + QLatin1String(symbolPathsKeyC), QStringList()).toStringList();
sourcePaths = s->value(keyRoot + QLatin1String(sourcePathsKeyC), QStringList()).toStringList();
verboseSymbolLoading = s->value(keyRoot + QLatin1String(verboseSymbolLoadingKeyC), false).toBool();
}
void CdbOptions::toSettings(QSettings *s) const
......@@ -78,6 +82,7 @@ void CdbOptions::toSettings(QSettings *s) const
s->setValue(QLatin1String(pathKeyC), path);
s->setValue(QLatin1String(symbolPathsKeyC), symbolPaths);
s->setValue(QLatin1String(sourcePathsKeyC), sourcePaths);
s->setValue(QLatin1String(verboseSymbolLoadingKeyC), verboseSymbolLoading);
s->endGroup();
}
......@@ -128,6 +133,8 @@ unsigned CdbOptions::compare(const CdbOptions &rhs) const
rc |= InitializationOptionsChanged;
if (symbolPaths != rhs.symbolPaths || sourcePaths != rhs.sourcePaths)
rc |= DebuggerPathsChanged;
if (verboseSymbolLoading != rhs.verboseSymbolLoading)
rc |= SymbolOptionsChanged;
return rc;
}
......
......@@ -49,7 +49,9 @@ public:
void toSettings(QSettings *s) const;
// 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;
// Locate the debugging tools
......@@ -59,6 +61,7 @@ public:
QString path;
QStringList symbolPaths;
QStringList sourcePaths;
bool verboseSymbolLoading;
};
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.symbolPathListEditor->setPathList(o.symbolPaths);
m_ui.sourcePathListEditor->setPathList(o.sourcePaths);
m_ui.verboseSymbolLoadingCheckBox->setChecked(o.verboseSymbolLoading);
}
CdbOptions CdbOptionsPageWidget::options() const
......@@ -93,6 +95,7 @@ CdbOptions CdbOptionsPageWidget::options() const
rc.enabled = m_ui.cdbPathGroupBox->isChecked();
rc.symbolPaths = m_ui.symbolPathListEditor->pathList();
rc.sourcePaths = m_ui.sourcePathListEditor->pathList();
rc.verboseSymbolLoading = m_ui.verboseSymbolLoadingCheckBox->isChecked();
return rc;
}
......@@ -167,11 +170,17 @@ void CdbOptionsPage::apply()
if (!m_widget)
return;
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->toSettings(Core::ICore::instance()->settings());
if (changedMask & CdbOptions::DebuggerPathsChanged)
// Paths changed?
if (changedMask & CdbOptions::DebuggerPathsChanged) {
emit debuggerPathsChanged();
changedMask &= ~CdbOptions::DebuggerPathsChanged;
}
// Remaining options?
if (changedMask)
emit optionsChanged();
}
}
......
......@@ -86,6 +86,7 @@ public:
signals:
void debuggerPathsChanged();
void optionsChanged();
private:
const QSharedPointer<CdbOptions> m_options;
......
......@@ -38,7 +38,7 @@
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="noteLabel">
<property name="text">
<string extracomment="Placeholder" notr="true">Note: bla, blah</string>
<string notr="true" extracomment="Placeholder">Note: bla, blah</string>
</property>
</widget>
</item>
......@@ -79,6 +79,22 @@
</layout>
</widget>
</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>
<spacer name="verticalSpacer">
<property name="orientation">
......
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