Commit b8ae9fd4 authored by hjk's avatar hjk Committed by Christian Stenger

Debugger: Adjust native mixed debugging after upstream changes

Change-Id: I4d137fadd0de2aa346f2f49932faac4ee9ed41e7
Reviewed-by: default avatarUlf Hermann <ulf.hermann@theqtcompany.com>
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent be1e0f7e
This diff is collapsed.
......@@ -1603,7 +1603,7 @@ class Dumper(DumperBase):
objfile = fromNativePath(symtab.objfile.filename)
fileName = fromNativePath(symtab.fullname())
if self.nativeMixed and functionName == "qt_qmlDebugEventFromService":
if self.nativeMixed and functionName == "qt_qmlDebugMessageAvailable":
interpreterStack = self.extractInterpreterStack()
#print("EXTRACTED INTEPRETER STACK: %s" % interpreterStack)
for interpreterFrame in interpreterStack.get('frames', []):
......@@ -1641,13 +1641,11 @@ class Dumper(DumperBase):
self.dumper = dumper
self.args = args
spec = "qt_qmlDebugConnectorOpen"
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.doInsertInterpreterBreakpoint(args, True)
print("Resolving QML breakpoint %s -> %s" % (args, bp))
self.dumper.resolvePendingInterpreterBreakpoint(args)
self.enabled = False
return False
......@@ -1800,14 +1798,14 @@ registerCommand("threadnames", threadnames)
#
#######################################################################
class QmlEngineEventBreakpoint(gdb.Breakpoint):
class InterpreterMessageBreakpoint(gdb.Breakpoint):
def __init__(self):
spec = "qt_qmlDebugEventFromService"
super(QmlEngineEventBreakpoint, self).\
spec = "qt_qmlDebugMessageAvailable"
super(InterpreterMessageBreakpoint, self).\
__init__(spec, gdb.BP_BREAKPOINT, internal=True)
def stop(self):
print("Interpreter event received.")
return theDumper.handleInterpreterEvent()
return theDumper.handleInterpreterMessage()
QmlEngineEventBreakpoint()
InterpreterMessageBreakpoint()
......@@ -693,7 +693,7 @@ class Dumper(DumperBase):
if self.nativeMixed:
self.interpreterEventBreakpoint = \
self.target.BreakpointCreateByName("qt_qmlDebugEventFromService")
self.target.BreakpointCreateByName("qt_qmlDebugMessageAvailable")
state = 1 if self.target.IsValid() else 0
self.reportResult('success="%s",msg="%s",exe="%s"' % (state, error, self.executable_), args)
......@@ -871,7 +871,7 @@ class Dumper(DumperBase):
functionName = frame.GetFunctionName()
if isNativeMixed and functionName == "::qt_qmlDebugEventFromService()":
if isNativeMixed and functionName == "::qt_qmlDebugMessageAvailable()":
interpreterStack = self.extractInterpreterStack()
for interpreterFrame in interpreterStack.get('frames', []):
function = interpreterFrame.get('function', '')
......@@ -1341,9 +1341,9 @@ class Dumper(DumperBase):
self.reportState("inferiorstopok")
self.process.Continue();
return
if functionName == "::qt_qmlDebugEventFromService()":
self.report("EVENT FROM SERVICE")
res = self.handleInterpreterEvent()
if functionName == "::qt_qmlDebugMessageAvailable()":
self.report("ASYNC MESSAGE FROM SERVICE")
res = self.handleInterpreterMessage()
if not res:
self.report("EVENT NEEDS NO STOP")
self.reportState("stopped")
......@@ -1427,7 +1427,7 @@ class Dumper(DumperBase):
if bpType == BreakpointByFileAndLine:
fileName = args["file"]
if fileName.endswith(".js") or fileName.endswith(".qml"):
self.doInsertInterpreterBreakpoint(args, False)
self.insertInterpreterBreakpoint(args)
return
extra = ''
......@@ -1742,7 +1742,7 @@ class Dumper(DumperBase):
bp = self.target.BreakpointCreateByName("qt_qmlDebugConnectorOpen")
bp.SetOneShot(True)
self.interpreterBreakpointResolvers.append(
lambda: self.doInsertInterpreterBreakpoint(args, True))
lambda: self.resolvePendingInterpreterBreakpoint(args))
# Used in dumper auto test.
......
......@@ -2308,7 +2308,7 @@ def qdump__QV4__String(d, value):
d.putStringValue(d.addressOf(value) + 2 * d.ptrSize())
def qdump__QV4__Value(d, value):
v = toInteger(str(value["val"]))
v = toInteger(str(value["_val"]))
NaNEncodeMask = 0xffff800000000000
IsInt32Mask = 0x0002000000000000
IsDoubleMask = 0xfffc000000000000
......@@ -2319,7 +2319,10 @@ def qdump__QV4__Value(d, value):
ns = d.qtNamespace()
if v & IsInt32Mask:
d.putBetterType("%sQV4::Value (int32)" % ns)
d.putValue(value["int_32"])
vv = v & 0xffffffff
vv = vv if vv < 0x80000000 else -(0x100000000 - vv)
d.putBetterType("%sQV4::Value (int32)" % ns)
d.putValue("%d" % vv)
elif v & IsDoubleMask:
d.putBetterType("%sQV4::Value (double)" % ns)
d.putValue("%x" % (v ^ 0xffff800000000000), Hex2EncodedFloat8)
......@@ -2332,6 +2335,7 @@ def qdump__QV4__Value(d, value):
elif v & IsNullOrBooleanMask:
d.putBetterType("%sQV4::Value (null/bool)" % ns)
d.putValue("(null/bool)")
d.putValue(v & 1)
else:
vtable = value["m"]["vtable"]
if toInteger(vtable["isString"]):
......
......@@ -1470,6 +1470,8 @@ QString BreakpointItem::toToolTip() const
<< "</td><td>" << QDir::toNativeSeparators(markerFileName()) << "</td></tr>"
<< "<tr><td>" << tr("Marker Line:")
<< "</td><td>" << markerLineNumber() << "</td></tr>"
<< "<tr><td>" << tr("Hit Count:")
<< "</td><td>" << m_response.hitCount << "</td></tr>"
<< "</table><br><hr><table>"
<< "<tr><th>" << tr("Property")
<< "</th><th>" << tr("Requested")
......
......@@ -877,6 +877,8 @@ DebuggerEncoding debuggerEncoding(const QByteArray &data)
return SpecialNullValue;
if (data == "itemcount")
return SpecialItemCountValue;
if (data == "notaccessible")
return SpecialNotAccessibleValue;
return DebuggerEncoding(data.toInt());
}
......
This diff is collapsed.
......@@ -211,6 +211,7 @@ private:
private: ////////// Gdb Output, State & Capability Handling //////////
protected:
Q_SLOT void handleResponse(const QByteArray &buff);
void handleAsyncOutput(const QByteArray &asyncClass, const GdbMi &result);
void handleStopResponse(const GdbMi &data);
void handleResultRecord(DebuggerResponse *response);
void handleStop1(const GdbMi &data);
......@@ -282,6 +283,8 @@ private: ////////// View & Data Stuff //////////
void handleBreakCondition(const DebuggerResponse &response, Breakpoint bp);
void handleBreakThreadSpec(const DebuggerResponse &response, Breakpoint bp);
void handleBreakLineNumber(const DebuggerResponse &response, Breakpoint bp);
void handleInsertInterpreterBreakpoint(const DebuggerResponse &response, Breakpoint bp);
void handleInterpreterBreakpointModified(const GdbMi &data);
void handleWatchInsert(const DebuggerResponse &response, Breakpoint bp);
void handleCatchInsert(const DebuggerResponse &response, Breakpoint bp);
void handleBkpt(const GdbMi &bkpt, Breakpoint bp);
......
......@@ -954,7 +954,7 @@ void LldbEngine::handleLocationNotification(const GdbMi &reportedLocation)
// Quickly set the location marker.
if (lineNumber > 0
&& QFileInfo::exists(fileName)
&& function != "::qt_qmlDebugEventFromService()")
&& function != "::qt_qmlDebugMessageAvailable()")
gotoLocation(Location(fileName, lineNumber));
}
......
......@@ -167,6 +167,21 @@ QString StackFrame::toToolTip() const
return res;
}
static QString findFile(const QString &baseDir, const QString &relativeFile)
{
QDir dir(baseDir);
while (true) {
const QString path = dir.absoluteFilePath(relativeFile);
const QFileInfo fi(path);
if (fi.isFile())
return path;
if (dir.isRoot())
break;
dir.cdUp();
}
return QString();
}
// Try to resolve files coming from resource files.
void StackFrame::fixQrcFrame(const DebuggerRunParameters &rp)
{
......@@ -179,21 +194,19 @@ void StackFrame::fixQrcFrame(const DebuggerRunParameters &rp)
}
if (!file.startsWith(QLatin1String("qrc:/")))
return;
const QString relativeFile = file.right(file.size() - 5);
if (rp.projectSourceDirectory.isEmpty())
return;
const QFileInfo pFi(rp.projectSourceDirectory + QLatin1Char('/') + relativeFile);
if (pFi.isFile()) {
file = pFi.absoluteFilePath();
usable = true;
return;
}
const QFileInfo cFi(QDir::currentPath() + QLatin1Char('/') + relativeFile);
if (cFi.isFile()) {
file = cFi.absoluteFilePath();
usable = true;
QString relativeFile = file.right(file.size() - 5);
while (relativeFile.startsWith(QLatin1Char('/')))
relativeFile = relativeFile.mid(1);
QString absFile = findFile(rp.projectSourceDirectory, relativeFile);
if (absFile.isEmpty())
absFile = findFile(QDir::currentPath(), relativeFile);
if (absFile.isEmpty())
return;
}
file = absFile;
usable = true;
}
QDebug operator<<(QDebug d, const StackFrame &f)
......
......@@ -391,8 +391,8 @@ QByteArray WatchData::hexAddress() const
void WatchData::updateValue(const GdbMi &item)
{
GdbMi value = item["value"];
if (value.isValid()) {
DebuggerEncoding encoding = debuggerEncoding(item["valueencoded"].data());
DebuggerEncoding encoding = debuggerEncoding(item["valueencoded"].data());
if (value.isValid() || encoding != Unencoded8Bit) {
setValue(decodeData(value.data(), encoding));
} else {
setValueNeeded();
......@@ -576,7 +576,8 @@ void parseChildrenData(const WatchData &data0, const GdbMi &item,
setWatchDataValueEnabled(data, item["valueenabled"]);
setWatchDataValueEditable(data, item["valueeditable"]);
data.updateChildCount(item["numchild"]);
data.updateChildCount(item["numchild"]); // GDB/MI
data.updateChildCount(item["haschild"]); // native-mixed
itemHandler(data);
bool ok = false;
......
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