Commit 96a0f480 authored by hjk's avatar hjk

Debugger: Pass all breakpoint properties to *brigde.py

Change-Id: I58ee1b106e1cd6e8ad5ce99b226860c528698520
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
parent ca1f7434
......@@ -1745,16 +1745,16 @@ class DumperBase:
return int(bp)
def insertQmlBreakpoint(self, args):
fullName = args['fileName']
lineNumber = args['lineNumber']
print("Insert QML breakpoint %s:%s" % (fullName, lineNumber))
bp = self.doInsertQmlBreakPoint(fullName, lineNumber)
print("Insert QML breakpoint %s" % self.describeBreakpointData(args))
bp = self.doInsertQmlBreakpoint(args)
res = self.sendQmlCommand('prepareStep')
#if res is None:
# print("Resetting stepping failed.")
return str(bp)
def doInsertQmlBreakPoint(self, fullName, lineNumber):
def doInsertQmlBreakpoint(self, args):
fullName = args['fileName']
lineNumber = args['lineNumber']
pos = fullName.rfind('/')
engineName = "qrc:/" + fullName[pos+1:]
bp = self.sendQmlCommand('insertBreakpoint',
......@@ -1763,12 +1763,17 @@ class DumperBase:
if bp is None:
#print("Direct QML breakpoint insertion failed.")
#print("Make pending.")
self.createResolvePendingBreakpointsHookBreakpoint(fullName, lineNumber)
self.createResolvePendingBreakpointsHookBreakpoint(args)
return 0
print("Resolving QML breakpoint: %s" % bp)
return int(bp)
def describeBreakpointData(self, args):
fullName = args['fileName']
lineNumber = args['lineNumber']
return "%s:%s" % (fullName, lineNumber)
def isInternalQmlFrame(self, functionName):
if functionName is None:
return False
......
......@@ -1804,26 +1804,23 @@ class Dumper(DumperBase):
return ''.join(self.output)
def createResolvePendingBreakpointsHookBreakpoint(self, fullName, lineNumber):
def createResolvePendingBreakpointsHookBreakpoint(self, args):
class Resolver(gdb.Breakpoint):
def __init__(self, dumper, fullName, lineNumber):
def __init__(self, dumper, args):
self.dumper = dumper
self.fullName = fullName
self.lineNumber = lineNumber
self.args = args
spec = "qt_v4ResolvePendingBreakpointsHook"
print("Preparing hook to resolve pending QML breakpoint at %s:%s"
% (self.fullName, self.lineNumber))
print("Preparing hook to resolve pending QML breakpoint at %s" % args)
super(Resolver, self).\
__init__(spec, gdb.BP_BREAKPOINT, internal=True, temporary=False)
def stop(self):
bp = self.dumper.doInsertQmlBreakPoint(self.fullName, self.lineNumber)
print("Resolving QML breakpoint %s:%s -> %s"
% (self.fullName, self.lineNumber, bp))
bp = self.dumper.doInsertQmlBreakpoint(args)
print("Resolving QML breakpoint %s -> %s" % (args, bp))
self.enabled = False
return False
self.qmlBreakpoints.append(Resolver(self, fullName, lineNumber))
self.qmlBreakpoints.append(Resolver(self, args))
......
......@@ -1716,7 +1716,7 @@ class Dumper(DumperBase):
self.reportError(error)
self.reportVariables()
def createResolvePendingBreakpointsHookBreakpoint(self, fullName, lineNumber):
def createResolvePendingBreakpointsHookBreakpoint(self, args):
self.nativeMixed = True
if self.qmlTriggeredBreakpoint is None:
self.qmlTriggeredBreakpoint = \
......@@ -1725,13 +1725,7 @@ class Dumper(DumperBase):
bp = self.target.BreakpointCreateByName("qt_v4ResolvePendingBreakpointsHook")
bp.SetOneShot(True)
self.qmlBreakpointResolvers[bp] = lambda: \
self.resolvePendingQmlBreakpoint(fullName, lineNumber)
def resolvePendingQmlBreakpoint(self, fullName, lineNumber):
bp = self.doInsertQmlBreakPoint(fullName, lineNumber)
print("Resolving QML breakpoint %s:%s -> %s" % (fullName, lineNumber, bp))
#ns = self.qtNamespace()
self.doInsertQmlBreakpoint(args)
# Used in dumper auto test.
......
......@@ -745,6 +745,21 @@ const BreakpointParameters &Breakpoint::parameters() const
return b->m_params;
}
void Breakpoint::addToCommand(DebuggerCommand *cmd) const
{
cmd->arg("modelid", id().toByteArray());
cmd->arg("type", type());
cmd->arg("ignorecount", ignoreCount());
cmd->arg("condition", condition().toHex());
cmd->arg("function", functionName().toUtf8());
cmd->arg("oneshot", isOneShot());
cmd->arg("enabled", isEnabled());
cmd->arg("fileName", fileName().toUtf8());
cmd->arg("lineNumber", lineNumber());
cmd->arg("address", address());
cmd->arg("expression", expression());
}
BreakpointState Breakpoint::state() const
{
QTC_ASSERT(b, return BreakpointState());
......
......@@ -49,6 +49,7 @@ namespace Internal {
class BreakpointItem;
class BreakHandler;
class DebuggerCommand;
class DebuggerEngine;
// Non-owning "deletion-safe" wrapper around a BreakpointItem *
......@@ -66,6 +67,7 @@ public:
uint hash() const;
const BreakpointParameters &parameters() const;
void addToCommand(DebuggerCommand *cmd) const;
BreakpointModelId id() const;
bool isLocatedAt(const QString &fileName, int lineNumber,
......
......@@ -2759,9 +2759,7 @@ void GdbEngine::insertBreakpoint(Breakpoint bp)
if (!data.isCppBreakpoint()) {
DebuggerCommand cmd("insertQmlBreakpoint");
cmd.arg("fileName", data.fileName);
cmd.arg("lineNumber", data.lineNumber);
cmd.arg("condition", data.condition);
bp.addToCommand(&cmd);
runCommand(cmd);
bp.notifyBreakpointInsertOk();
return;
......@@ -2912,8 +2910,7 @@ void GdbEngine::removeBreakpoint(Breakpoint bp)
const BreakpointParameters &data = bp.parameters();
if (!data.isCppBreakpoint()) {
DebuggerCommand cmd("removeQmlBreakpoint");
cmd.arg("fileName", data.fileName);
cmd.arg("lineNumber", data.lineNumber);
bp.addToCommand(&cmd);
runCommand(cmd);
bp.notifyBreakpointRemoveOk();
return;
......
......@@ -316,7 +316,7 @@ void LldbEngine::setupInferior()
.arg(bp.id().toString()).arg(bp.state()));
bp.setEngine(this);
cmd.beginGroup();
insertBreakpointHelper(&cmd, bp);
bp.addToCommand(&cmd);
cmd.endGroup();
} else {
showMessage(_("BREAKPOINT %1 IN STATE %2 IS NOT ACCEPTABLE")
......@@ -561,42 +561,16 @@ bool LldbEngine::acceptsBreakpoint(Breakpoint bp) const
void LldbEngine::insertBreakpoint(Breakpoint bp)
{
DebuggerCommand cmd("insertBreakpoint");
insertBreakpointHelper(&cmd, bp);
runCommand(cmd);
}
void LldbEngine::insertBreakpointHelper(DebuggerCommand *cmd, Breakpoint bp) const
{
cmd->arg("modelid", bp.id().toByteArray());
cmd->arg("type", bp.type());
cmd->arg("ignorecount", bp.ignoreCount());
cmd->arg("condition", bp.condition().toHex());
cmd->arg("function", bp.functionName().toUtf8());
cmd->arg("oneshot", bp.isOneShot());
cmd->arg("enabled", bp.isEnabled());
cmd->arg("fileName", bp.fileName().toUtf8());
cmd->arg("lineNumber", bp.lineNumber());
cmd->arg("address", bp.address());
cmd->arg("expression", bp.expression());
bp.addToCommand(&cmd);
bp.notifyBreakpointInsertProceeding();
runCommand(cmd);
}
void LldbEngine::changeBreakpoint(Breakpoint bp)
{
const BreakpointResponse &response = bp.response();
DebuggerCommand cmd("changeBreakpoint");
cmd.arg("modelid", bp.id().toByteArray());
cmd.arg("lldbid", response.id.toByteArray());
cmd.arg("type", bp.type());
cmd.arg("ignorecount", bp.ignoreCount());
cmd.arg("condition", bp.condition().toHex());
cmd.arg("function", bp.functionName().toUtf8());
cmd.arg("oneshot", bp.isOneShot());
cmd.arg("enabled", bp.isEnabled());
cmd.arg("fileName", bp.fileName().toUtf8());
cmd.arg("lineNumber", bp.lineNumber());
cmd.arg("address", bp.address());
cmd.arg("expression", bp.expression());
bp.addToCommand(&cmd);
bp.notifyBreakpointChangeProceeding();
runCommand(cmd);
}
......
......@@ -99,7 +99,6 @@ private:
bool stateAcceptsBreakpointChanges() const;
bool acceptsBreakpoint(Breakpoint bp) const;
void insertBreakpoint(Breakpoint bp);
void insertBreakpointHelper(DebuggerCommand *cmd, Breakpoint bp) const;
void removeBreakpoint(Breakpoint bp);
void changeBreakpoint(Breakpoint bp);
......
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