Commit e7121d50 authored by hjk's avatar hjk
Browse files

debugger: polish breakpoint locations

Task-number: QTCREATORBUG-3912
parent a2bb4ac2
......@@ -1249,17 +1249,27 @@ QString BreakHandler::BreakpointItem::toToolTip() const
formatAddress(str, data.address);
str << "</td><td>";
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()) {
str << "</td></tr>"
<< "<tr><td>" << tr("Command:")
str << "<tr><td>" << tr("Command:")
<< "</td><td>" << data.command
<< "</td><td>" << response.command<< "</td></tr>";
<< "</td><td>" << response.command
<< "</td></tr>";
}
if (!data.condition.isEmpty() || !response.condition.isEmpty()) {
str << "</td></tr>"
<< "<tr><td>" << tr("Condition:")
str << "<tr><td>" << tr("Condition:")
<< "</td><td>" << data.condition
<< "</td><td>" << response.condition << "</td></tr>";
<< "</td><td>" << response.condition
<< "</td></tr>";
}
if (data.ignoreCount || response.ignoreCount) {
str << "<tr><td>" << tr("Ignore Count:") << "</td><td>";
......@@ -1268,10 +1278,10 @@ QString BreakHandler::BreakpointItem::toToolTip() const
str << "</td><td>";
if (response.ignoreCount)
str << response.ignoreCount;
str << "</td></tr>";
}
if (data.threadSpec >= 0 || response.threadSpec >= 0) {
str << "</td></tr>"
<< "<tr><td>" << tr("Thread Specification:")
str << "<tr><td>" << tr("Thread Specification:")
<< "</td><td>";
if (data.threadSpec >= 0)
str << data.threadSpec;
......
......@@ -131,7 +131,8 @@ public:
QString fullName; //!< Full file name acknowledged by the debugger engine.
bool multiple; //!< Happens in constructors/gdb.
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;
......
......@@ -475,6 +475,9 @@ void GdbEngine::handleResponse(const QByteArray &buff)
if (!isQmlStepBreakpoint1(number) && isQmlStepBreakpoint2(number)) {
BreakpointId id = breakHandler()->findBreakpointByNumber(number);
updateBreakpointDataFromOutput(id, bkpt);
BreakpointResponse response = breakHandler()->response(id);
if (response.correctedLineNumber == 0)
attemptAdjustBreakpointLocation(id);
}
} else {
qDebug() << "IGNORED ASYNC OUTPUT"
......@@ -2155,8 +2158,11 @@ void GdbEngine::updateBreakpointDataFromOutput(BreakpointId id, const GdbMi &bkp
} else if (child.hasName("func")) {
response.functionName = _(child.data());
} else if (child.hasName("addr")) {
// <MULTIPLE> happens in constructors. In this case there are
// _two_ fields named "addr" in the response. On Linux that is...
// <MULTIPLE> happens in constructors, inline functions, and
// 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")) {
response.address = child.data().mid(2).toULongLong(0, 16);
} else {
......@@ -2404,6 +2410,12 @@ void GdbEngine::handleBreakList(const GdbMi &table)
BreakpointId id = breakHandler()->findSimilarBreakpoint(needle);
if (id != BreakpointId(-1)) {
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 {
qDebug() << " NOTHING SUITABLE FOUND";
showMessage(_("CANNOT FIND BP: " + bkpt.toString()));
......@@ -2413,6 +2425,16 @@ void GdbEngine::handleBreakList(const GdbMi &table)
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)
{
QTC_ASSERT(response.resultClass == GdbResultDone, /**/)
......
......@@ -359,6 +359,7 @@ private: ////////// View & Data Stuff //////////
//
void handleBreakList(const GdbResponse &response);
void handleBreakList(const GdbMi &table);
void handleBreakListMultiple(const GdbResponse &response);
void handleBreakIgnore(const GdbResponse &response);
void handleBreakDisable(const GdbResponse &response);
void handleBreakEnable(const GdbResponse &response);
......
Markdown is supported
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