forked from qt-creator/qt-creator
Debugger [CDB]: Fix module resolution.
Use breakpoint id as response id to identify breakpoints in reponse to 'list breakpoint' command. Change-Id: I31686aef0193bf2e26e38482c7efebf294a358c4 Reviewed-on: http://codereview.qt.nokia.com/940 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -51,6 +51,9 @@ namespace Internal {
|
|||||||
|
|
||||||
This identifies a breakpoint in the \c BreakHandler. The
|
This identifies a breakpoint in the \c BreakHandler. The
|
||||||
major parts are strictly increasing over time.
|
major parts are strictly increasing over time.
|
||||||
|
|
||||||
|
The minor part identifies a multiple breakpoint
|
||||||
|
set for example by gdb in constructors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -105,6 +108,10 @@ BreakpointModelId BreakpointModelId::child(int row) const
|
|||||||
|
|
||||||
This is what the external debuggers use to identify a breakpoint.
|
This is what the external debuggers use to identify a breakpoint.
|
||||||
It is only valid for one debugger run.
|
It is only valid for one debugger run.
|
||||||
|
|
||||||
|
In gdb, the breakpoint number is used, which is constant
|
||||||
|
during a session. CDB's breakpoint numbers vary if breakpoints
|
||||||
|
are deleted, so, the ID is used.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
BreakpointResponseId::BreakpointResponseId(const QByteArray &ba)
|
BreakpointResponseId::BreakpointResponseId(const QByteArray &ba)
|
||||||
|
@@ -2512,6 +2512,7 @@ void CdbEngine::attemptBreakpointSynchronization()
|
|||||||
BreakpointParameters parameters = handler->breakpointData(id);
|
BreakpointParameters parameters = handler->breakpointData(id);
|
||||||
BreakpointResponse response;
|
BreakpointResponse response;
|
||||||
response.fromParameters(parameters);
|
response.fromParameters(parameters);
|
||||||
|
response.id = BreakpointResponseId(id.majorPart(), id.minorPart());
|
||||||
// If we encountered that file and have a module for it: Add it.
|
// If we encountered that file and have a module for it: Add it.
|
||||||
if (parameters.type == BreakpointByFileAndLine && parameters.module.isEmpty()) {
|
if (parameters.type == BreakpointByFileAndLine && parameters.module.isEmpty()) {
|
||||||
const QHash<QString, QString>::const_iterator it = m_fileNameModuleHash.constFind(parameters.fileName);
|
const QHash<QString, QString>::const_iterator it = m_fileNameModuleHash.constFind(parameters.fileName);
|
||||||
@@ -2833,14 +2834,14 @@ void CdbEngine::handleBreakPoints(const GdbMi &value)
|
|||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
foreach (const GdbMi &breakPointG, value.children()) {
|
foreach (const GdbMi &breakPointG, value.children()) {
|
||||||
BreakpointResponse reportedResponse;
|
BreakpointResponse reportedResponse;
|
||||||
const BreakpointResponseId id = parseBreakPoint(breakPointG, &reportedResponse);
|
parseBreakPoint(breakPointG, &reportedResponse);
|
||||||
if (debugBreakpoints)
|
if (debugBreakpoints)
|
||||||
qDebug(" Parsed %d: pending=%d %s\n", id.majorPart(),
|
qDebug(" Parsed %d: pending=%d %s\n", reportedResponse.id.majorPart(),
|
||||||
reportedResponse.pending,
|
reportedResponse.pending,
|
||||||
qPrintable(reportedResponse.toString()));
|
qPrintable(reportedResponse.toString()));
|
||||||
|
if (reportedResponse.id.isValid() && !reportedResponse.pending) {
|
||||||
if (!reportedResponse.pending) {
|
const BreakpointModelId mid = handler->findBreakpointByResponseId(reportedResponse.id);
|
||||||
BreakpointModelId mid = handler->findBreakpointByResponseId(id);
|
QTC_ASSERT(mid.isValid(), continue; )
|
||||||
const PendingBreakPointMap::iterator it = m_pendingBreakpointMap.find(mid);
|
const PendingBreakPointMap::iterator it = m_pendingBreakpointMap.find(mid);
|
||||||
if (it != m_pendingBreakpointMap.end()) {
|
if (it != m_pendingBreakpointMap.end()) {
|
||||||
// Complete the response and set on handler.
|
// Complete the response and set on handler.
|
||||||
@@ -2852,9 +2853,8 @@ void CdbEngine::handleBreakPoints(const GdbMi &value)
|
|||||||
currentResponse.enabled = reportedResponse.enabled;
|
currentResponse.enabled = reportedResponse.enabled;
|
||||||
formatCdbBreakPointResponse(mid, currentResponse, str);
|
formatCdbBreakPointResponse(mid, currentResponse, str);
|
||||||
if (debugBreakpoints)
|
if (debugBreakpoints)
|
||||||
qDebug(" Setting for %d: %s\n", id.majorPart(),
|
qDebug(" Setting for %d: %s\n", currentResponse.id.majorPart(),
|
||||||
qPrintable(currentResponse.toString()));
|
qPrintable(currentResponse.toString()));
|
||||||
BreakpointModelId mid = handler->findBreakpointByResponseId(id);
|
|
||||||
handler->setResponse(mid, currentResponse);
|
handler->setResponse(mid, currentResponse);
|
||||||
m_pendingBreakpointMap.erase(it);
|
m_pendingBreakpointMap.erase(it);
|
||||||
}
|
}
|
||||||
|
@@ -298,21 +298,18 @@ static inline bool gdbmiChildToBool(const GdbMi &parent, const char *childName,
|
|||||||
// Parse extension command listing breakpoints.
|
// Parse extension command listing breakpoints.
|
||||||
// Note that not all fields are returned, since file, line, function are encoded
|
// Note that not all fields are returned, since file, line, function are encoded
|
||||||
// in the expression (that is in addition deleted on resolving for a bp-type breakpoint).
|
// in the expression (that is in addition deleted on resolving for a bp-type breakpoint).
|
||||||
BreakpointResponseId parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r,
|
void parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r,
|
||||||
QString *expression /* = 0 */)
|
QString *expression /* = 0 */)
|
||||||
{
|
{
|
||||||
BreakpointResponseId id = BreakpointResponseId(-1);
|
|
||||||
int majorPart = 0;
|
|
||||||
gdbmiChildToInt(gdbmi, "number", &majorPart);
|
|
||||||
gdbmiChildToBool(gdbmi, "enabled", &(r->enabled));
|
gdbmiChildToBool(gdbmi, "enabled", &(r->enabled));
|
||||||
gdbmiChildToBool(gdbmi, "deferred", &(r->pending));
|
gdbmiChildToBool(gdbmi, "deferred", &(r->pending));
|
||||||
r->id = BreakpointResponseId(majorPart);
|
r->id = BreakpointResponseId();
|
||||||
const GdbMi idG = gdbmi.findChild("id");
|
const GdbMi idG = gdbmi.findChild("id");
|
||||||
if (idG.isValid()) { // Might not be valid if there is not id
|
if (idG.isValid()) { // Might not be valid if there is not id
|
||||||
bool ok;
|
bool ok;
|
||||||
const BreakpointResponseId cid(idG.data().toInt(&ok));
|
const int id = idG.data().toInt(&ok);
|
||||||
if (ok)
|
if (ok)
|
||||||
id = cid;
|
r->id = BreakpointResponseId(id);
|
||||||
}
|
}
|
||||||
const GdbMi moduleG = gdbmi.findChild("module");
|
const GdbMi moduleG = gdbmi.findChild("module");
|
||||||
if (moduleG.isValid())
|
if (moduleG.isValid())
|
||||||
@@ -328,7 +325,6 @@ BreakpointResponseId parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r,
|
|||||||
if (gdbmiChildToInt(gdbmi, "passcount", &(r->ignoreCount)))
|
if (gdbmiChildToInt(gdbmi, "passcount", &(r->ignoreCount)))
|
||||||
r->ignoreCount--;
|
r->ignoreCount--;
|
||||||
gdbmiChildToInt(gdbmi, "thread", &(r->threadSpec));
|
gdbmiChildToInt(gdbmi, "thread", &(r->threadSpec));
|
||||||
return id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray cdbWriteMemoryCommand(quint64 addr, const QByteArray &data)
|
QByteArray cdbWriteMemoryCommand(quint64 addr, const QByteArray &data)
|
||||||
|
@@ -69,7 +69,7 @@ QByteArray cdbAddBreakpointCommand(const BreakpointParameters &d,
|
|||||||
// Parse extension command listing breakpoints.
|
// Parse extension command listing breakpoints.
|
||||||
// Note that not all fields are returned, since file, line, function are encoded
|
// Note that not all fields are returned, since file, line, function are encoded
|
||||||
// in the expression (that is in addition deleted on resolving for a bp-type breakpoint).
|
// in the expression (that is in addition deleted on resolving for a bp-type breakpoint).
|
||||||
BreakpointResponseId parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r, QString *expression = 0);
|
void parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r, QString *expression = 0);
|
||||||
|
|
||||||
// Convert a CDB integer value: '00000000`0012a290' -> '12a290', '0n10' ->'10'
|
// Convert a CDB integer value: '00000000`0012a290' -> '12a290', '0n10' ->'10'
|
||||||
QByteArray fixCdbIntegerValue(QByteArray t, bool stripLeadingZeros = false, int *basePtr = 0);
|
QByteArray fixCdbIntegerValue(QByteArray t, bool stripLeadingZeros = false, int *basePtr = 0);
|
||||||
|
Reference in New Issue
Block a user