debugger: polish breakpoint locations

Task-number: QTCREATORBUG-3912
This commit is contained in:
hjk
2011-03-02 13:37:29 +01:00
parent a2bb4ac211
commit e7121d50d7
4 changed files with 45 additions and 11 deletions

View File

@@ -1249,17 +1249,27 @@ QString BreakHandler::BreakpointItem::toToolTip() const
formatAddress(str, data.address); formatAddress(str, data.address);
str << "</td><td>"; str << "</td><td>";
formatAddress(str, response.address); formatAddress(str, response.address);
str << "</td></tr>";
if (response.multiple) {
str << "<tr><td>" << tr("Multiple Addresses:")
<< "</td><td>";
foreach (quint64 address, response.addresses) {
formatAddress(str, data.address);
str << " ";
}
str << "</td></tr>";
}
if (!data.command.isEmpty() || !response.command.isEmpty()) { if (!data.command.isEmpty() || !response.command.isEmpty()) {
str << "</td></tr>" str << "<tr><td>" << tr("Command:")
<< "<tr><td>" << tr("Command:")
<< "</td><td>" << data.command << "</td><td>" << data.command
<< "</td><td>" << response.command<< "</td></tr>"; << "</td><td>" << response.command
<< "</td></tr>";
} }
if (!data.condition.isEmpty() || !response.condition.isEmpty()) { if (!data.condition.isEmpty() || !response.condition.isEmpty()) {
str << "</td></tr>" str << "<tr><td>" << tr("Condition:")
<< "<tr><td>" << tr("Condition:")
<< "</td><td>" << data.condition << "</td><td>" << data.condition
<< "</td><td>" << response.condition << "</td></tr>"; << "</td><td>" << response.condition
<< "</td></tr>";
} }
if (data.ignoreCount || response.ignoreCount) { if (data.ignoreCount || response.ignoreCount) {
str << "<tr><td>" << tr("Ignore Count:") << "</td><td>"; str << "<tr><td>" << tr("Ignore Count:") << "</td><td>";
@@ -1268,10 +1278,10 @@ QString BreakHandler::BreakpointItem::toToolTip() const
str << "</td><td>"; str << "</td><td>";
if (response.ignoreCount) if (response.ignoreCount)
str << response.ignoreCount; str << response.ignoreCount;
str << "</td></tr>";
} }
if (data.threadSpec >= 0 || response.threadSpec >= 0) { if (data.threadSpec >= 0 || response.threadSpec >= 0) {
str << "</td></tr>" str << "<tr><td>" << tr("Thread Specification:")
<< "<tr><td>" << tr("Thread Specification:")
<< "</td><td>"; << "</td><td>";
if (data.threadSpec >= 0) if (data.threadSpec >= 0)
str << data.threadSpec; str << data.threadSpec;

View File

@@ -131,7 +131,8 @@ public:
QString fullName; //!< Full file name acknowledged by the debugger engine. QString fullName; //!< Full file name acknowledged by the debugger engine.
bool multiple; //!< Happens in constructors/gdb. bool multiple; //!< Happens in constructors/gdb.
QByteArray extra; //!< gdb: <PENDING>, <MULTIPLE> QByteArray extra; //!< gdb: <PENDING>, <MULTIPLE>
int correctedLineNumber; QList<quint64> addresses;//!< Extra addresses for templated code.
int correctedLineNumber; //!< Line number as seen by gdb.
}; };
typedef QList<BreakpointId> BreakpointIds; typedef QList<BreakpointId> BreakpointIds;

View File

@@ -475,6 +475,9 @@ void GdbEngine::handleResponse(const QByteArray &buff)
if (!isQmlStepBreakpoint1(number) && isQmlStepBreakpoint2(number)) { if (!isQmlStepBreakpoint1(number) && isQmlStepBreakpoint2(number)) {
BreakpointId id = breakHandler()->findBreakpointByNumber(number); BreakpointId id = breakHandler()->findBreakpointByNumber(number);
updateBreakpointDataFromOutput(id, bkpt); updateBreakpointDataFromOutput(id, bkpt);
BreakpointResponse response = breakHandler()->response(id);
if (response.correctedLineNumber == 0)
attemptAdjustBreakpointLocation(id);
} }
} else { } else {
qDebug() << "IGNORED ASYNC OUTPUT" qDebug() << "IGNORED ASYNC OUTPUT"
@@ -2155,8 +2158,11 @@ void GdbEngine::updateBreakpointDataFromOutput(BreakpointId id, const GdbMi &bkp
} else if (child.hasName("func")) { } else if (child.hasName("func")) {
response.functionName = _(child.data()); response.functionName = _(child.data());
} else if (child.hasName("addr")) { } else if (child.hasName("addr")) {
// <MULTIPLE> happens in constructors. In this case there are // <MULTIPLE> happens in constructors, inline functions, and
// _two_ fields named "addr" in the response. On Linux that is... // at other places like 'foreach' lines. In this case there are
// fields named "addr" in the response and/or the address
// is called <MULTIPLE>.
//qDebug() << "ADDR: " << child.data() << (child.data() == "<MULTIPLE>");
if (child.data().startsWith("0x")) { if (child.data().startsWith("0x")) {
response.address = child.data().mid(2).toULongLong(0, 16); response.address = child.data().mid(2).toULongLong(0, 16);
} else { } else {
@@ -2404,6 +2410,12 @@ void GdbEngine::handleBreakList(const GdbMi &table)
BreakpointId id = breakHandler()->findSimilarBreakpoint(needle); BreakpointId id = breakHandler()->findSimilarBreakpoint(needle);
if (id != BreakpointId(-1)) { if (id != BreakpointId(-1)) {
updateBreakpointDataFromOutput(id, bkpt); updateBreakpointDataFromOutput(id, bkpt);
BreakpointResponse response = breakHandler()->response(id);
if (response.correctedLineNumber == 0)
attemptAdjustBreakpointLocation(id);
if (response.multiple && response.addresses.isEmpty())
postCommand("info break " + QByteArray::number(response.number),
NeedsStop, CB(handleBreakListMultiple), QVariant(id));
} else { } else {
qDebug() << " NOTHING SUITABLE FOUND"; qDebug() << " NOTHING SUITABLE FOUND";
showMessage(_("CANNOT FIND BP: " + bkpt.toString())); showMessage(_("CANNOT FIND BP: " + bkpt.toString()));
@@ -2413,6 +2425,16 @@ void GdbEngine::handleBreakList(const GdbMi &table)
m_breakListOutdated = false; m_breakListOutdated = false;
} }
void GdbEngine::handleBreakListMultiple(const GdbResponse &response)
{
QTC_ASSERT(response.resultClass == GdbResultDone, /**/)
const BreakpointId id = response.cookie.toInt();
BreakHandler *handler = breakHandler();
BreakpointResponse br = handler->response(id);
br.addresses.append(0);
handler->setResponse(id, br);
}
void GdbEngine::handleBreakDisable(const GdbResponse &response) void GdbEngine::handleBreakDisable(const GdbResponse &response)
{ {
QTC_ASSERT(response.resultClass == GdbResultDone, /**/) QTC_ASSERT(response.resultClass == GdbResultDone, /**/)

View File

@@ -359,6 +359,7 @@ private: ////////// View & Data Stuff //////////
// //
void handleBreakList(const GdbResponse &response); void handleBreakList(const GdbResponse &response);
void handleBreakList(const GdbMi &table); void handleBreakList(const GdbMi &table);
void handleBreakListMultiple(const GdbResponse &response);
void handleBreakIgnore(const GdbResponse &response); void handleBreakIgnore(const GdbResponse &response);
void handleBreakDisable(const GdbResponse &response); void handleBreakDisable(const GdbResponse &response);
void handleBreakEnable(const GdbResponse &response); void handleBreakEnable(const GdbResponse &response);