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:
Friedemann Kleint
2009-07-27 15:32:46 +02:00
parent 5c8566709d
commit b41d3a45ad
7 changed files with 65 additions and 13 deletions

View File

@@ -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);
if (debugCDB)
qDebug() << Q_FUNC_INFO <<filename;
// Set image path
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);
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 <<'\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);
if (debugCDB)
qDebug() << "Starting " << cmd;