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

CDB: Set symbol options at initalization phase.

parent 30357334
......@@ -359,6 +359,7 @@ void CdbDebugEngine::startDebugger(const QSharedPointer<DebuggerStartParameters>
m_d->m_inferiorStartupComplete = false;
setState(AdapterStarted, Q_FUNC_INFO, __LINE__);
m_d->setVerboseSymbolLoading(m_d->m_options->verboseSymbolLoading);
const DebuggerStartMode mode = sp->startMode;
// Figure out dumper. @TODO: same in gdb...
const QString dumperLibName = QDir::toNativeSeparators(manager()->qtDumperLibraryName());
......@@ -451,7 +452,6 @@ bool CdbDebugEngine::startDebuggerWithExecutable(DebuggerStartMode sm, QString *
sp->executable,
sp->processArgs,
sp->environment,
m_d->m_options->verboseSymbolLoading,
errorMessage);
if (rc)
m_d->m_mode = sm;
......
......@@ -140,6 +140,10 @@ const char *msgExecutionStatusString(ULONG executionStatus)
return "<Unknown execution status>";
}
static const ULONG defaultSymbolOptions = SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME |
SYMOPT_LOAD_LINES | SYMOPT_OMAP_FIND_NEAREST |
SYMOPT_AUTO_PUBLICS;
// ComInterfaces
ComInterfaces::ComInterfaces() :
debugClient(0),
......@@ -276,6 +280,11 @@ bool CoreEngine::init(const QString &dllEnginePath, QString *errorMessage)
*errorMessage = QString::fromLatin1("Creation of IDebugSymbols3 failed: %1").arg(msgDebugEngineComResult(hr));
return false;
}
hr = m_cif.debugSymbols->SetSymbolOptions(defaultSymbolOptions);
if (FAILED(hr)) {
*errorMessage = msgComFailed("SetSymbolOptions", hr);
return false;
}
WCHAR buf[bufLen];
hr = m_cif.debugSymbols->GetImagePathWide(buf, bufLen, 0);
......@@ -377,7 +386,6 @@ bool CoreEngine::startDebuggerWithExecutable(const QString &workingDirectory,
const QString &filename,
const QStringList &args,
const QStringList &envList,
bool verboseSymbolLoading,
QString *errorMessage)
{
DEBUG_CREATE_PROCESS_OPTIONS dbgopts;
......@@ -400,11 +408,6 @@ bool CoreEngine::startDebuggerWithExecutable(const QString &workingDirectory,
if (debug)
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 (verboseSymbolLoading)
symbolOptions |= SYMOPT_DEBUG;
m_cif.debugSymbols->SetSymbolOptions(symbolOptions);
const QString cmd = Utils::AbstractProcess::createWinCommandline(filename, args);
if (debug)
qDebug() << "Starting " << cmd;
......@@ -498,6 +501,37 @@ bool CoreEngine::setSymbolPaths(const QStringList &s, QString *errorMessage)
return true;
}
bool CoreEngine::isVerboseSymbolLoading() const
{
ULONG opts;
const HRESULT hr = m_cif.debugSymbols->GetSymbolOptions(&opts);
return SUCCEEDED(hr) && (opts & SYMOPT_DEBUG);
}
bool CoreEngine::setVerboseSymbolLoading(bool newValue)
{
ULONG opts;
HRESULT hr = m_cif.debugSymbols->GetSymbolOptions(&opts);
if (FAILED(hr)) {
qWarning("%s", qPrintable(msgComFailed("GetSymbolOptions", hr)));
return false;
}
const bool isVerbose = (opts & SYMOPT_DEBUG);
if (isVerbose == newValue)
return true;
if (newValue) {
opts |= SYMOPT_DEBUG;
} else {
opts &= ~SYMOPT_DEBUG;
}
hr = m_cif.debugSymbols->SetSymbolOptions(opts);
if (FAILED(hr)) {
qWarning("%s", qPrintable(msgComFailed("SetSymbolOptions", hr)));
return false;
}
return true;
}
bool CoreEngine::executeDebuggerCommand(const QString &command, QString *errorMessage)
{
// output to all clients, else we do not see anything
......
......@@ -82,7 +82,6 @@ public:
const QString &filename,
const QStringList &args,
const QStringList &env,
bool verboseSymbolLoading,
QString *errorMessage);
bool startAttachDebugger(qint64 pid, bool suppressInitialBreakPoint,
......@@ -125,6 +124,9 @@ public:
QStringList symbolPaths() const;
bool setSymbolPaths(const QStringList &s, QString *errorMessage);
bool isVerboseSymbolLoading() const;
bool setVerboseSymbolLoading(bool v);
// Options
ExpressionSyntax expressionSyntax() const;
ExpressionSyntax setExpressionSyntax(ExpressionSyntax es);
......
......@@ -197,6 +197,8 @@ void CdbApplication::syncCommand(int command, const QString &arg)
case Sync_EvalExpression: {
QString value;
QString type;
std::printf("Evaluating '%s' in code level %d, syntax %d\n",
qPrintable(arg), m_engine->codeLevel(), m_engine->expressionSyntax());
if (m_engine->evaluateExpression(arg, &value, &type, &errorMessage)) {
std::printf("[%s] %s\n", qPrintable(type), qPrintable(value));
} else {
......@@ -229,10 +231,22 @@ void CdbApplication::syncCommand(int command, const QString &arg)
}
}
break;
case Sync_ListBreakPoints: {
QList<CdbCore::BreakPoint> bps;
if (CdbCore::BreakPoint::getBreakPoints(m_engine->interfaces().debugControl, &bps, &errorMessage)) {
foreach (const CdbCore::BreakPoint &bp, bps)
std::printf("%s\n", qPrintable(bp.expression()));
} else {
std::printf("BREAKPOINT LIST FAILED: %s\n", qPrintable(errorMessage));
}
}
break;
case Sync_PrintFrame:
printFrame(arg);
break;
case Unknown:
std::printf("Executing '%s' in code level %d, syntax %d\n",
qPrintable(arg), m_engine->codeLevel(), m_engine->expressionSyntax());
if (!m_engine->executeDebuggerCommand(arg, &errorMessage))
std::printf("%s\n", qPrintable(errorMessage));
break;
......@@ -253,8 +267,7 @@ void CdbApplication::executionCommand(int command, const QString &arg)
const QString binary = args.front();
args.pop_front();
ok = m_engine->startDebuggerWithExecutable(QString(), binary, args,
QStringList(), false,
&errorMessage);
QStringList(), &errorMessage);
}
}
break;
......
......@@ -44,6 +44,7 @@ static const char help[] =
"Q Clear command queue\n"
"B file:line Queue a breakpoint for adding in AttachProcess\n"
"B Clear breakpoint queue\n"
"L List breakpoints\n"
"F <n> Print stack frame <n>, 0 being top\n"
"\nThe remaining commands are passed to CDB.\n";
......@@ -84,6 +85,8 @@ static Command evaluateCommand(const QString &cmdToken)
return Sync_Queue;
case 'B':
return Sync_QueueBreakPoint;
case 'L':
return Sync_ListBreakPoints;
case 'E':
return Sync_EvalExpression;
case 'G':
......
......@@ -49,7 +49,8 @@ enum Command {
Sync_EvalExpression = SyncCommand|1,
Sync_Queue = SyncCommand|2,
Sync_QueueBreakPoint = SyncCommand|3,
Sync_PrintFrame = SyncCommand|4,
Sync_ListBreakPoints = SyncCommand|4,
Sync_PrintFrame = SyncCommand|5,
Execution_Go = ExecutionCommand|1,
Execution_StartBinary = ExecutionCommand|2
};
......
Supports Markdown
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