Commit 6a71c631 authored by hjk's avatar hjk

Debugger: Make display of QObject names optional

... and switch it off by default. The feature has indeterministic
performance impact and lost quite a bit of its utility since GDB
learned to extract dynamic object types most of the times.

Change-Id: I22cccb03ba67f9ff6ad757bbc06eb372d84bbffe
Reviewed-by: default avatarLeena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
parent e5b9e819
......@@ -254,6 +254,7 @@ class Dumper(DumperBase):
self.useFancy = int(args.get("fancy", "0"))
self.forceQtNamespace = int(args.get("forcens", "0"))
self.passExceptions = int(args.get("passexceptions", "0"))
self.showQObjectNames = int(args.get("qobjectnames", "0"))
self.nativeMixed = int(args.get("nativemixed", "0"))
self.autoDerefPointers = int(args.get("autoderef", "0"))
self.partialUpdate = int(args.get("partial", "0"))
......@@ -1115,9 +1116,10 @@ class Dumper(DumperBase):
#warn("INAME: %s " % self.currentIName)
#warn("INAMES: %s " % self.expandedINames)
#warn("EXPANDED: %s " % (self.currentIName in self.expandedINames))
staticMetaObject = self.extractStaticMetaObject(value.type)
if staticMetaObject:
self.putQObjectNameValue(value)
if self.showQObjectNames:
staticMetaObject = self.extractStaticMetaObject(value.type)
if staticMetaObject:
self.putQObjectNameValue(value)
self.putType(typeName)
self.putEmptyValue()
self.putNumChild(len(typeobj.fields()))
......@@ -1126,6 +1128,8 @@ class Dumper(DumperBase):
innerType = None
with Children(self, 1, childType=innerType):
self.putFields(value)
if not self.showQObjectNames:
staticMetaObject = self.extractStaticMetaObject(value.type)
if staticMetaObject:
self.putQObjectGuts(value, staticMetaObject)
......@@ -1801,6 +1805,7 @@ class CliDumper(Dumper):
args['fancy'] = 1
args['passexception'] = 1
args['autoderef'] = 1
args['qobjectnames'] = 1
name = args['varlist']
self.prepare(args)
self.output = name + ' = '
......
......@@ -197,6 +197,7 @@ class Dumper(DumperBase):
self.eventState = lldb.eStateInvalid
self.expandedINames = {}
self.passExceptions = False
self.showQObjectNames = False
self.useLldbDumpers = False
self.autoDerefPointers = True
self.useDynamicType = True
......@@ -1096,22 +1097,24 @@ class Dumper(DumperBase):
# Normal value
#numchild = 1 if value.MightHaveChildren() else 0
numchild = value.GetNumChildren()
self.putType(typeName)
self.putEmptyValue(-1)
staticMetaObject = self.extractStaticMetaObject(value.GetType())
if staticMetaObject:
self.context = value
self.putQObjectNameValue(value)
else:
v = value.GetValue()
if v:
self.putValue(v)
v = value.GetValue()
if v:
self.putValue(v)
self.put('numchild="%s",' % numchild)
self.putType(typeName)
self.putEmptyValue()
self.putNumChild(numchild)
if self.showQObjectNames:
staticMetaObject = self.extractStaticMetaObject(value.GetType())
if staticMetaObject:
self.context = value
self.putQObjectNameValue(value)
if self.currentIName in self.expandedINames:
with Children(self):
self.putFields(value)
if not self.showQObjectNames:
staticMetaObject = self.extractStaticMetaObject(value.GetType())
if staticMetaObject:
self.putQObjectGuts(value, staticMetaObject)
......@@ -1189,6 +1192,7 @@ class Dumper(DumperBase):
self.useDynamicType = int(args.get('dyntype', '0'))
self.useFancy = int(args.get('fancy', '0'))
self.passExceptions = int(args.get('passexceptions', '0'))
self.showQObjectNames = int(args.get('qobjectnames', '0'))
self.currentWatchers = args.get('watchers', {})
self.typeformats = args.get('typeformats', {})
self.formats = args.get('formats', {})
......
......@@ -213,6 +213,7 @@ CommonOptionsPageWidget::CommonOptionsPageWidget
m_group->insert(action(MaximalStackDepth), spinBoxMaximalStackDepth);
m_group->insert(action(ShowStdNamespace), 0);
m_group->insert(action(ShowQtNamespace), 0);
m_group->insert(action(ShowQObjectNames), 0);
m_group->insert(action(SortStructMembers), 0);
m_group->insert(action(LogTimeStamps), 0);
m_group->insert(action(VerboseLog), 0);
......@@ -372,6 +373,7 @@ QWidget *LocalsAndExpressionsOptionsPage::widget()
auto checkBoxShowThreadNames = new QCheckBox(debuggingHelperGroupBox);
auto checkBoxShowStdNamespace = new QCheckBox(m_widget);
auto checkBoxShowQtNamespace = new QCheckBox(m_widget);
auto checkBoxShowQObjectNames = new QCheckBox(m_widget);
auto spinBoxMaximalStringLength = new QSpinBox(m_widget);
spinBoxMaximalStringLength->setSpecialValueText(tr("<unlimited>"));
......@@ -394,6 +396,7 @@ QWidget *LocalsAndExpressionsOptionsPage::widget()
layout1->addItem(new QSpacerItem(10, 10));
layout1->addRow(checkBoxShowStdNamespace);
layout1->addRow(checkBoxShowQtNamespace);
layout1->addRow(checkBoxShowQObjectNames);
layout1->addItem(new QSpacerItem(10, 10));
layout1->addRow(tr("Maximum string length:"), spinBoxMaximalStringLength);
layout1->addRow(tr("Display string length:"), spinBoxDisplayStringLimit);
......@@ -413,6 +416,7 @@ QWidget *LocalsAndExpressionsOptionsPage::widget()
m_group.insert(action(ShowThreadNames), checkBoxShowThreadNames);
m_group.insert(action(ShowStdNamespace), checkBoxShowStdNamespace);
m_group.insert(action(ShowQtNamespace), checkBoxShowQtNamespace);
m_group.insert(action(ShowQObjectNames), checkBoxShowQObjectNames);
m_group.insert(action(DisplayStringLimit), spinBoxDisplayStringLimit);
m_group.insert(action(MaximalStringLength), spinBoxMaximalStringLength);
......
......@@ -268,6 +268,18 @@ DebuggerSettings::DebuggerSettings()
item->setValue(true);
insertItem(ShowQtNamespace, item);
item = new SavedAction(this);
item->setSettingsKey(debugModeGroup, QLatin1String("ShowQObjectNames"));
item->setText(tr("Show QObject names if available"));
item->setDialogText(tr("Show QObject names if available"));
item->setToolTip(tr("<p>Displays the objectName property of QObject based items. "
"Note that this can negatively impact debugger performance "
"even if no QObjects are present."));
item->setCheckable(true);
item->setDefaultValue(false);
item->setValue(false);
insertItem(ShowQObjectNames, item);
item = new SavedAction(this);
item->setSettingsKey(debugModeGroup, QLatin1String("SortStructMembers"));
item->setText(tr("Sort Members of Classes and Structs Alphabetically"));
......
......@@ -157,6 +157,7 @@ enum DebuggerActionCode
// Watchers & Locals
ShowStdNamespace,
ShowQtNamespace,
ShowQObjectNames,
SortStructMembers,
AutoDerefPointers,
MaximalStringLength,
......
......@@ -4586,6 +4586,7 @@ void GdbEngine::doUpdateLocals(const UpdateParameters &params)
cmd.arg("fancy", boolSetting(UseDebuggingHelpers));
cmd.arg("autoderef", boolSetting(AutoDerefPointers));
cmd.arg("dyntype", boolSetting(UseDynamicType));
cmd.arg("qobjectnames", boolSetting(ShowQObjectNames));
cmd.arg("nativemixed", isNativeMixedActive());
StackFrame frame = stackHandler()->currentFrame();
......
......@@ -802,6 +802,7 @@ void LldbEngine::doUpdateLocals(const UpdateParameters &params)
cmd.arg("dyntype", boolSetting(UseDynamicType));
cmd.arg("partialvar", params.partialVariable);
cmd.arg("sortstructs", boolSetting(SortStructMembers));
cmd.arg("qobjectnames", boolSetting(ShowQObjectNames));
StackFrame frame = stackHandler()->currentFrame();
cmd.arg("context", frame.context);
......
......@@ -338,6 +338,8 @@ WatchModel::WatchModel(WatchHandler *handler, DebuggerEngine *engine)
m_engine, &DebuggerEngine::updateAll);
connect(action(ShowQtNamespace), &SavedAction::valueChanged,
m_engine, &DebuggerEngine::updateAll);
connect(action(ShowQObjectNames), &SavedAction::valueChanged,
m_engine, &DebuggerEngine::updateAll);
}
void WatchModel::reinitialize(bool includeInspectData)
......
......@@ -586,7 +586,7 @@ QSet<Id> KitFeatureProvider::availablePlatforms() const
QString KitFeatureProvider::displayNameForPlatform(Id id) const
{
foreach (const IDeviceFactory *f, ExtensionSystem::PluginManager::getObjects<IDeviceFactory>()) {
foreach (IDeviceFactory *f, ExtensionSystem::PluginManager::getObjects<IDeviceFactory>()) {
const QString dn = f->displayNameForId(id);
if (!dn.isEmpty())
return dn;
......
......@@ -1303,6 +1303,7 @@ void tst_Dumpers::dumper()
"python theDumper.fetchVariables({"
"'token':2,'fancy':1,'forcens':1,'sortstructs':1,"
"'autoderef':1,'dyntype':1,'passexceptions':1,"
"'qobjectnames':1,"
"'expanded':[" + expandedq + "]})\n";
cmds += "quit\n";
......@@ -1334,6 +1335,7 @@ void tst_Dumpers::dumper()
// "sc print(dir())\n"
"sc Tester('" + t->buildPath.toLatin1() + "/doit', {'fancy':1,'forcens':1,"
"'autoderef':1,'dyntype':1,'passexceptions':1,"
"'qobjectnames':1,"
"'expanded':[" + expandedq + "]})\n"
"quit\n";
......
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