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