forked from qt-creator/qt-creator
debugger: fix handling of watchpoint notification with gdb 7.4
Task-number: QTCREATORBUG-7144 Change-Id: I204062de55e241ea7954f0e3bce123973028e076 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -604,10 +604,15 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
|
|||||||
//|| data.type == BreakpointAtVFork
|
//|| data.type == BreakpointAtVFork
|
||||||
|| data.type == BreakpointAtSysCall)
|
|| data.type == BreakpointAtSysCall)
|
||||||
return typeToString(data.type);
|
return typeToString(data.type);
|
||||||
if (data.type == WatchpointAtAddress)
|
if (data.type == WatchpointAtAddress) {
|
||||||
return tr("Data at 0x%1").arg(data.address, 0, 16);
|
quint64 address = response.address ? response.address : data.address;
|
||||||
if (data.type == WatchpointAtExpression)
|
return tr("Data at 0x%1").arg(address, 0, 16);
|
||||||
return tr("Data at %1").arg(data.expression);
|
}
|
||||||
|
if (data.type == WatchpointAtExpression) {
|
||||||
|
QString expression = !response.expression.isEmpty()
|
||||||
|
? response.expression : data.expression;
|
||||||
|
return tr("Data at %1").arg(expression);
|
||||||
|
}
|
||||||
return empty;
|
return empty;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1052,11 +1057,14 @@ void BreakHandler::appendBreakpoint(const BreakpointParameters &data)
|
|||||||
scheduleSynchronization();
|
scheduleSynchronization();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakHandler::handleAlienBreakpoint(BreakpointModelId id,
|
void BreakHandler::handleAlienBreakpoint(const BreakpointResponse &response, DebuggerEngine *engine)
|
||||||
const BreakpointResponse &response, DebuggerEngine *engine)
|
|
||||||
{
|
{
|
||||||
if (response.id.isMinor()) {
|
BreakpointModelId id = findSimilarBreakpoint(response);
|
||||||
insertSubBreakpoint(id, response);
|
if (id.isValid()) {
|
||||||
|
if (response.id.isMinor())
|
||||||
|
insertSubBreakpoint(id, response);
|
||||||
|
else
|
||||||
|
setResponse(id, response);
|
||||||
} else {
|
} else {
|
||||||
BreakpointModelId id(++currentId);
|
BreakpointModelId id(++currentId);
|
||||||
const int row = m_storage.size();
|
const int row = m_storage.size();
|
||||||
@@ -1066,10 +1074,6 @@ void BreakHandler::handleAlienBreakpoint(BreakpointModelId id,
|
|||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
||||||
it->data = response;
|
it->data = response;
|
||||||
it->data.type = BreakpointByFileAndLine;
|
|
||||||
it->data.functionName.clear();
|
|
||||||
it->data.address = 0;
|
|
||||||
|
|
||||||
it->response = response;
|
it->response = response;
|
||||||
it->state = BreakpointInserted;
|
it->state = BreakpointInserted;
|
||||||
it->engine = engine;
|
it->engine = engine;
|
||||||
|
@@ -70,8 +70,7 @@ public:
|
|||||||
|
|
||||||
// The only way to add a new breakpoint.
|
// The only way to add a new breakpoint.
|
||||||
void appendBreakpoint(const BreakpointParameters &data);
|
void appendBreakpoint(const BreakpointParameters &data);
|
||||||
void handleAlienBreakpoint(BreakpointModelId id,
|
void handleAlienBreakpoint(const BreakpointResponse &response, DebuggerEngine *engine);
|
||||||
const BreakpointResponse &response, DebuggerEngine *engine);
|
|
||||||
void insertSubBreakpoint(BreakpointModelId id, const BreakpointResponse &data);
|
void insertSubBreakpoint(BreakpointModelId id, const BreakpointResponse &data);
|
||||||
void removeAlienBreakpoint(BreakpointModelId id);
|
void removeAlienBreakpoint(BreakpointModelId id);
|
||||||
|
|
||||||
|
@@ -518,13 +518,15 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
|||||||
} else if (asyncClass == "breakpoint-created") {
|
} else if (asyncClass == "breakpoint-created") {
|
||||||
// "{bkpt={number="1",type="breakpoint",disp="del",enabled="y",
|
// "{bkpt={number="1",type="breakpoint",disp="del",enabled="y",
|
||||||
// addr="<PENDING>",pending="main",times="0",
|
// addr="<PENDING>",pending="main",times="0",
|
||||||
//original-location="main"}}"
|
// original-location="main"}}" -- or --
|
||||||
|
// {bkpt={number="2",type="hw watchpoint",disp="keep",enabled="y",
|
||||||
|
// what="*0xbfffed48",times="0",original-location="*0xbfffed48"
|
||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
foreach (const GdbMi &bkpt, result.children()) {
|
foreach (const GdbMi &bkpt, result.children()) {
|
||||||
BreakpointResponse br;
|
BreakpointResponse br;
|
||||||
|
br.type = BreakpointByFileAndLine;
|
||||||
updateResponse(br, bkpt);
|
updateResponse(br, bkpt);
|
||||||
BreakpointModelId id = handler->findBreakpointByResponseId(br.id);
|
handler->handleAlienBreakpoint(br, this);
|
||||||
handler->handleAlienBreakpoint(id, br, this);
|
|
||||||
}
|
}
|
||||||
} else if (asyncClass == "breakpoint-deleted") {
|
} else if (asyncClass == "breakpoint-deleted") {
|
||||||
// "breakpoint-deleted" "{id="1"}"
|
// "breakpoint-deleted" "{id="1"}"
|
||||||
@@ -2380,11 +2382,21 @@ void GdbEngine::updateResponse(BreakpointResponse &response, const GdbMi &bkpt)
|
|||||||
} else if (child.hasName("thread")) {
|
} else if (child.hasName("thread")) {
|
||||||
response.threadSpec = child.data().toInt();
|
response.threadSpec = child.data().toInt();
|
||||||
} else if (child.hasName("type")) {
|
} else if (child.hasName("type")) {
|
||||||
// "breakpoint", "hw breakpoint", "tracepoint"
|
// "breakpoint", "hw breakpoint", "tracepoint", "hw watchpoint"
|
||||||
if (child.data().contains("tracepoint"))
|
// {bkpt={number="2",type="hw watchpoint",disp="keep",enabled="y",
|
||||||
|
// what="*0xbfffed48",times="0",original-location="*0xbfffed48"
|
||||||
|
if (child.data().contains("tracepoint")) {
|
||||||
response.tracepoint = true;
|
response.tracepoint = true;
|
||||||
else if (!child.data().contains("reakpoint"))
|
} else if (child.data() == "hw watchpoint" || child.data() == "watchpoint") {
|
||||||
response.type = WatchpointAtAddress;
|
QByteArray what = bkpt.findChild("what").data();
|
||||||
|
if (what.startsWith("*0x")) {
|
||||||
|
response.type = WatchpointAtAddress;
|
||||||
|
response.address = what.mid(1).toULongLong(0, 0);
|
||||||
|
} else {
|
||||||
|
response.type = WatchpointAtExpression;
|
||||||
|
response.expression = QString::fromLocal8Bit(what);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (child.hasName("original-location")) {
|
} else if (child.hasName("original-location")) {
|
||||||
originalLocation = child.data();
|
originalLocation = child.data();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user