Make break by function work for CDB.

Add function to automagically resolve function symbol names
that are missing the module name (module!foo). Kill some
trailing whitespace. Add a hack to transform qMain->main for VS.
This commit is contained in:
Friedemann Kleint
2009-04-15 10:05:40 +02:00
parent 0c03179fac
commit d11242feba
5 changed files with 123 additions and 21 deletions

View File

@@ -28,6 +28,7 @@
**************************************************************************/
#include "cdbbreakpoint.h"
#include "cdbmodules.h"
#include "breakhandler.h"
#include "cdbdebugengine_p.h"
@@ -279,20 +280,48 @@ bool CDBBreakPoint::getBreakPoints(IDebugControl4* debugControl, QList<CDBBreakP
return true;
}
// Synchronize (halted) engine breakpoints with those of the BreakHandler.
bool CDBBreakPoint::synchronizeBreakPoints(IDebugControl4* debugControl,
IDebugSymbols3 *syms,
BreakHandler *handler,
QString *errorMessage)
{
typedef QMap<CDBBreakPoint, int> BreakPointIndexMap;
BreakPointIndexMap breakPointIndexMap;
// convert BreakHandler's bps into a map of BreakPoint->BreakHandler->Index
if (debugCDB)
qDebug() << Q_FUNC_INFO;
BreakPointIndexMap breakPointIndexMap;
// convert BreakHandler's bps into a map of BreakPoint->BreakHandler->Index
// Ignore invalid functions (that could not be found) as they make
// the debugger hang.
const int handlerCount = handler->size();
for (int i=0; i < handlerCount; ++i)
breakPointIndexMap.insert(CDBBreakPoint(*handler->at(i)), i);
const QChar moduleDelimiter = QLatin1Char('!');
for (int i=0; i < handlerCount; ++i) {
BreakpointData *bd = handler->at(i);
// Function breakpoints: Are the module names specified?
bool breakPointOk = false;
if (bd->funcName.isEmpty()) {
breakPointOk = true;
} else {
switch (resolveSymbol(syms, &bd->funcName, errorMessage)) {
case ResolveSymbolOk:
breakPointOk = true;
break;
case ResolveSymbolAmbiguous:
qWarning("Warning: %s\n", qPrintable(*errorMessage));
breakPointOk = true;
break;
case ResolveSymbolNotFound:
case ResolveSymbolError:
qWarning("Warning: %s\n", qPrintable(*errorMessage));
break;
};
} // function breakpoint
if (breakPointOk)
breakPointIndexMap.insert(CDBBreakPoint(*bd), i);
}
errorMessage->clear();
// get number of engine breakpoints
ULONG engineCount;
if (!getBreakPointCount(debugControl, &engineCount, errorMessage))