From 00961969f4e42037b83de5ad4b90e754b474ec57 Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Wed, 16 Feb 2011 18:43:42 +0100
Subject: [PATCH] debugger: add dead code for potential improvements of the
 QScriptValue dumper

Looks there is no way to proceed without inferior calls right now.
---
 share/qtcreator/gdbmacros/gdbmacros.py        | 27 +++++++++++++++++++
 .../gdbdebugger/simple/simple_gdbtest_app.cpp |  1 +
 2 files changed, 28 insertions(+)

diff --git a/share/qtcreator/gdbmacros/gdbmacros.py b/share/qtcreator/gdbmacros/gdbmacros.py
index b821b629fc3..57df2e3dbe3 100644
--- a/share/qtcreator/gdbmacros/gdbmacros.py
+++ b/share/qtcreator/gdbmacros/gdbmacros.py
@@ -2430,6 +2430,33 @@ def qdump__QScriptValue(d, item):
     x = dd["jscValue"]["u"]
     tag = x["asBits"]["tag"]
     payload = x["asBits"]["payload"]
+    #isValid = long(x["asBits"]["tag"]) != -6   # Empty
+    #isCell = long(x["asBits"]["tag"]) == -2
+    #warn("IS CELL: %s " % isCell)
+    #isObject = False
+    #className = "UNKNOWN NAME"
+    #if isCell:
+    #    # isCell() && asCell()->isObject();
+    #    # in cell: m_structure->typeInfo().type() == ObjectType;
+    #    cellType = lookupType("QTJSC::JSCell").pointer()
+    #    cell = payload.cast(cellType).dereference()
+    #    dtype = "NO DYNAMIC TYPE"
+    #    try:
+    #        dtype = cell.dynamic_type
+    #    except:
+    #        pass
+    #    warn("DYNAMIC TYPE: %s" % dtype)
+    #    warn("STATUC  %s" % cell.type)
+    #    type = cell["m_structure"]["m_typeInfo"]["m_type"]
+    #    isObject = long(type) == 7 # ObjectType;
+    #    className = "UNKNOWN NAME"
+    #warn("IS OBJECT: %s " % isObject)
+
+    #inline bool JSCell::inherits(const ClassInfo* info) const
+    #for (const ClassInfo* ci = classInfo(); ci; ci = ci->parentClass) {
+    #    if (ci == info)
+    #        return true;
+    #return false;
 
     try:
         # This might already fail for "native" payloads.
diff --git a/tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp b/tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp
index 872fce8ff8c..a45ac4ef608 100644
--- a/tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp
+++ b/tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp
@@ -2240,6 +2240,7 @@ void testQScriptValue(int argc, char *argv[])
     s = engine.newVariant(QVariant(QString("sss")));
     s = engine.newDate(date);
     x = s.toInt32();
+    bool xx = s.isDate();
     date = s.toDateTime();
     s.setProperty("a", QScriptValue());
     QScriptValue d = s.data();
-- 
GitLab