forked from qt-creator/qt-creator
Debugger: Implement disabling/enabling subbreakpoints with LLDB
Change-Id: Iaad8716b98d632e5a933b7f5b26549c7cb885ea7 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1474,6 +1474,21 @@ class Dumper(DumperBase):
|
|||||||
bp.SetOneShot(bool(args['oneshot']))
|
bp.SetOneShot(bool(args['oneshot']))
|
||||||
self.reportResult(self.describeBreakpoint(bp), args)
|
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):
|
def removeBreakpoint(self, args):
|
||||||
lldbId = int(args['lldbid'])
|
lldbId = int(args['lldbid'])
|
||||||
if lldbId > qqWatchpointOffset:
|
if lldbId > qqWatchpointOffset:
|
||||||
|
@@ -1417,8 +1417,6 @@ void BreakHandler::handleAlienBreakpoint(const QString &responseId, const Breakp
|
|||||||
|
|
||||||
SubBreakpoint BreakpointItem::findOrCreateSubBreakpoint(const QString &responseId)
|
SubBreakpoint BreakpointItem::findOrCreateSubBreakpoint(const QString &responseId)
|
||||||
{
|
{
|
||||||
const QString minorPart = responseId.section('.', 1);
|
|
||||||
|
|
||||||
SubBreakpoint loc = findFirstLevelChild([&](const SubBreakpoint &l) {
|
SubBreakpoint loc = findFirstLevelChild([&](const SubBreakpoint &l) {
|
||||||
return l->responseId == responseId;
|
return l->responseId == responseId;
|
||||||
});
|
});
|
||||||
|
@@ -512,6 +512,26 @@ void LldbEngine::updateBreakpoint(const Breakpoint &bp)
|
|||||||
runCommand(cmd);
|
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)
|
void LldbEngine::removeBreakpoint(const Breakpoint &bp)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(bp, return);
|
QTC_ASSERT(bp, return);
|
||||||
@@ -549,7 +569,7 @@ void LldbEngine::updateBreakpointData(const Breakpoint &bp, const GdbMi &bkpt, b
|
|||||||
const int numChild = locations.childCount();
|
const int numChild = locations.childCount();
|
||||||
if (numChild > 1) {
|
if (numChild > 1) {
|
||||||
for (const GdbMi &location : locations) {
|
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);
|
SubBreakpoint loc = bp->findOrCreateSubBreakpoint(locid);
|
||||||
QTC_ASSERT(loc, continue);
|
QTC_ASSERT(loc, continue);
|
||||||
loc->params.type = bp->type();
|
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.functionName = location["function"].data();
|
||||||
loc->params.fileName = location["file"].data();
|
loc->params.fileName = location["file"].data();
|
||||||
loc->params.lineNumber = location["line"].toInt();
|
loc->params.lineNumber = location["line"].toInt();
|
||||||
|
loc->displayName = QString("%1.%2").arg(bp->responseId()).arg(locid);
|
||||||
}
|
}
|
||||||
bp->setPending(false);
|
bp->setPending(false);
|
||||||
} else if (numChild == 1) {
|
} else if (numChild == 1) {
|
||||||
@@ -1020,6 +1041,7 @@ bool LldbEngine::hasCapability(unsigned cap) const
|
|||||||
| ReloadModuleSymbolsCapability
|
| ReloadModuleSymbolsCapability
|
||||||
| BreakOnThrowAndCatchCapability
|
| BreakOnThrowAndCatchCapability
|
||||||
| BreakConditionCapability
|
| BreakConditionCapability
|
||||||
|
| BreakIndividualLocationsCapability
|
||||||
| TracePointCapability
|
| TracePointCapability
|
||||||
| ReturnFromFunctionCapability
|
| ReturnFromFunctionCapability
|
||||||
| CreateFullBacktraceCapability
|
| CreateFullBacktraceCapability
|
||||||
|
@@ -89,6 +89,7 @@ private:
|
|||||||
void insertBreakpoint(const Breakpoint &bp) override;
|
void insertBreakpoint(const Breakpoint &bp) override;
|
||||||
void removeBreakpoint(const Breakpoint &bp) override;
|
void removeBreakpoint(const Breakpoint &bp) override;
|
||||||
void updateBreakpoint(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 assignValueInDebugger(WatchItem *item, const QString &expr, const QVariant &value) override;
|
||||||
void executeDebuggerCommand(const QString &command) override;
|
void executeDebuggerCommand(const QString &command) override;
|
||||||
|
Reference in New Issue
Block a user