Debugger: Implement disabling/enabling subbreakpoints with LLDB

Change-Id: Iaad8716b98d632e5a933b7f5b26549c7cb885ea7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2018-10-22 14:26:28 +02:00
parent 3e42841141
commit 2556d4b44b
4 changed files with 39 additions and 3 deletions

View File

@@ -1474,6 +1474,21 @@ class Dumper(DumperBase):
bp.SetOneShot(bool(args['oneshot']))
self.reportResult(self.describeBreakpoint(bp), args)
def enableSubbreakpoint(self, args):
lldbId = int(args['lldbid'])
locId = int(args['locid'])
bp = self.target.FindBreakpointByID(lldbId)
res = False
enabled = False
if bp.IsValid():
loc = bp.FindLocationByID(locId)
if loc.IsValid():
loc.SetEnabled(bool(args['enabled']))
enabled = loc.IsEnabled()
res = True
self.reportResult('success="%s",enabled="%s",locid="%s"'
% (int(res), int(enabled), locId), args)
def removeBreakpoint(self, args):
lldbId = int(args['lldbid'])
if lldbId > qqWatchpointOffset:

View File

@@ -1417,8 +1417,6 @@ void BreakHandler::handleAlienBreakpoint(const QString &responseId, const Breakp
SubBreakpoint BreakpointItem::findOrCreateSubBreakpoint(const QString &responseId)
{
const QString minorPart = responseId.section('.', 1);
SubBreakpoint loc = findFirstLevelChild([&](const SubBreakpoint &l) {
return l->responseId == responseId;
});

View File

@@ -512,6 +512,26 @@ void LldbEngine::updateBreakpoint(const Breakpoint &bp)
runCommand(cmd);
}
void LldbEngine::enableSubBreakpoint(const SubBreakpoint &sbp, bool on)
{
QTC_ASSERT(sbp, return);
Breakpoint bp = sbp->breakpoint();
QTC_ASSERT(bp, return);
DebuggerCommand cmd("enableSubbreakpoint");
cmd.arg("lldbid", bp->responseId());
cmd.arg("locid", sbp->responseId);
cmd.arg("enabled", on);
cmd.callback = [bp, sbp](const DebuggerResponse &response) {
QTC_ASSERT(sbp, return);
QTC_ASSERT(bp, return);
if (response.resultClass == ResultDone) {
sbp->params.enabled = response.data["enabled"].toInt();
bp->adjustMarker();
}
};
runCommand(cmd);
}
void LldbEngine::removeBreakpoint(const Breakpoint &bp)
{
QTC_ASSERT(bp, return);
@@ -549,7 +569,7 @@ void LldbEngine::updateBreakpointData(const Breakpoint &bp, const GdbMi &bkpt, b
const int numChild = locations.childCount();
if (numChild > 1) {
for (const GdbMi &location : locations) {
const QString locid = QString("%1.%2").arg(rid).arg(location["locid"].data());
const QString locid = location["locid"].data();
SubBreakpoint loc = bp->findOrCreateSubBreakpoint(locid);
QTC_ASSERT(loc, continue);
loc->params.type = bp->type();
@@ -557,6 +577,7 @@ void LldbEngine::updateBreakpointData(const Breakpoint &bp, const GdbMi &bkpt, b
loc->params.functionName = location["function"].data();
loc->params.fileName = location["file"].data();
loc->params.lineNumber = location["line"].toInt();
loc->displayName = QString("%1.%2").arg(bp->responseId()).arg(locid);
}
bp->setPending(false);
} else if (numChild == 1) {
@@ -1020,6 +1041,7 @@ bool LldbEngine::hasCapability(unsigned cap) const
| ReloadModuleSymbolsCapability
| BreakOnThrowAndCatchCapability
| BreakConditionCapability
| BreakIndividualLocationsCapability
| TracePointCapability
| ReturnFromFunctionCapability
| CreateFullBacktraceCapability

View File

@@ -89,6 +89,7 @@ private:
void insertBreakpoint(const Breakpoint &bp) override;
void removeBreakpoint(const Breakpoint &bp) override;
void updateBreakpoint(const Breakpoint &bp) override;
void enableSubBreakpoint(const SubBreakpoint &sbp, bool on) override;
void assignValueInDebugger(WatchItem *item, const QString &expr, const QVariant &value) override;
void executeDebuggerCommand(const QString &command) override;