aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@theqtcompany.com>2015-05-05 12:24:33 +0200
committerDavid Schulz <david.schulz@theqtcompany.com>2015-05-06 07:16:33 +0000
commitf97069ebb2c10ec435d09ac775c362bdd1c6acd4 (patch)
tree19ffbfc21dfc0418b5d8d46daf0fb17bb979f054 /src
parente855de40377f135c5770637036acd45df63880d7 (diff)
CdbExt: Setting actively which nodes should be expanded.
Change-Id: I1470a67aa559e4d93a01cc70701fb160e873317d Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com> Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/libs/qtcreatorcdbext/symbolgroup.cpp25
-rw-r--r--src/libs/qtcreatorcdbext/symbolgroupnode.cpp51
-rw-r--r--src/libs/qtcreatorcdbext/symbolgroupnode.h2
-rw-r--r--src/libs/qtcreatorcdbext/symbolgroupvalue.cpp4
4 files changed, 40 insertions, 42 deletions
diff --git a/src/libs/qtcreatorcdbext/symbolgroup.cpp b/src/libs/qtcreatorcdbext/symbolgroup.cpp
index 38d9afe5c0..8ca0f56640 100644
--- a/src/libs/qtcreatorcdbext/symbolgroup.cpp
+++ b/src/libs/qtcreatorcdbext/symbolgroup.cpp
@@ -203,12 +203,9 @@ std::string SymbolGroup::dump(const std::string &iname,
DebugPrint() << "SymbolGroup::dump(" << iname << '/'
<< aNode->absoluteFullIName() <<" resolves to " << node->absoluteFullIName()
<< " expanded=" << node->isExpanded();
- if (node->isExpanded()) { // Mark expand request by watch model
- node->clearFlags(SymbolGroupNode::ExpandedByDumper);
- } else {
- if (node->canExpand() && !node->expand(errorMessage))
- return std::string();
- }
+ if (!node->isExpanded() && node->canExpand() && !node->expand(errorMessage))
+ return std::string();
+ node->addFlags(SymbolGroupNode::ExpandedByRequest);
// After expansion, run the complex dumpers
if (p.dumpFlags & DumpParameters::DumpComplexDumpers)
node->runComplexDumpers(ctx);
@@ -378,8 +375,12 @@ static inline SymbolGroupNode *
bool SymbolGroup::expand(const std::string &nodeName, std::string *errorMessage)
{
- if (SymbolGroupNode *node = findNodeForExpansion(this, nodeName, errorMessage))
- return node == m_root ? true : node->expand(errorMessage);
+ if (SymbolGroupNode *node = findNodeForExpansion(this, nodeName, errorMessage)) {
+ if (node == m_root)
+ return true;
+ node->addFlags(SymbolGroupNode::ExpandedByRequest);
+ return node->expand(errorMessage);
+ }
return false;
}
@@ -393,8 +394,12 @@ bool SymbolGroup::collapse(const std::string &nodeName, std::string *errorMessag
bool SymbolGroup::expandRunComplexDumpers(const std::string &nodeName, const SymbolGroupValueContext &ctx, std::string *errorMessage)
{
- if (SymbolGroupNode *node = findNodeForExpansion(this, nodeName, errorMessage))
- return node == m_root ? true : node->expandRunComplexDumpers(ctx, errorMessage);
+ if (SymbolGroupNode *node = findNodeForExpansion(this, nodeName, errorMessage)) {
+ if (node == m_root)
+ return true;
+ node->addFlags(SymbolGroupNode::ExpandedByRequest);
+ return node->expandRunComplexDumpers(ctx, errorMessage);
+ }
return false;
}
diff --git a/src/libs/qtcreatorcdbext/symbolgroupnode.cpp b/src/libs/qtcreatorcdbext/symbolgroupnode.cpp
index a3922797d0..ee71a4c2f9 100644
--- a/src/libs/qtcreatorcdbext/symbolgroupnode.cpp
+++ b/src/libs/qtcreatorcdbext/symbolgroupnode.cpp
@@ -62,8 +62,8 @@ static inline void debugNodeFlags(std::ostream &str, unsigned f)
str << " DumperOk";
if (f & SymbolGroupNode::SimpleDumperFailed)
str << " DumperFailed";
- if (f & SymbolGroupNode::ExpandedByDumper)
- str << " ExpandedByDumper";
+ if (f & SymbolGroupNode::ExpandedByRequest)
+ str << " ExpandedByRequest";
if (f & SymbolGroupNode::AdditionalSymbol)
str << " AdditionalSymbol";
if (f & SymbolGroupNode::Obscured)
@@ -594,8 +594,8 @@ void ErrorSymbolGroupNode::debug(std::ostream &os, const std::string &visitingFu
\endlist
The dumping is mostly based on SymbolGroupValue expressions.
- in the debugger. Evaluating those dumpers might expand symbol nodes, which are
- then marked as 'ExpandedByDumper'. This stops the dump recursion to prevent
+ in the debugger. Evaluating those dumpers might expand symbol nodes, but those
+ are not marked as 'ExpandedByRequest'. This stops the dump recursion to prevent
outputting data that were not explicitly expanded by the watch handler.
\ingroup qtcreatorcdbext */
@@ -1022,7 +1022,6 @@ void SymbolGroupNode::runComplexDumpers(const SymbolGroupValueContext &ctx)
if (ctChildren.empty())
return;
- clearFlags(ExpandedByDumper);
// Mark current children as obscured. We cannot show both currently
// as this would upset the numerical sorting of the watch model
AbstractSymbolGroupNodePtrVectorConstIterator cend = children().end();
@@ -1269,11 +1268,8 @@ bool SymbolGroupNode::expand(std::string *errorMessage)
DebugPrint() << "SymbolGroupNode::expand " << name()
<<'/' << absoluteFullIName() << ' '
<< m_index << DebugNodeFlags(flags());
- if (isExpanded()) {
- // Clear the flag indication dumper expansion on a second, explicit request
- clearFlags(ExpandedByDumper);
+ if (isExpanded())
return true;
- }
if (!canExpand()) {
*errorMessage = msgExpandFailed(name(), absoluteFullIName(), m_index,
"No subelements to expand in node.");
@@ -1661,6 +1657,17 @@ SymbolGroupNodeVisitor::VisitResult
return VisitSkipChildren;
if (node->testFlags(SymbolGroupNode::AdditionalSymbol) && !node->testFlags(SymbolGroupNode::WatchNode))
return VisitSkipChildren;
+ // Recurse to children only if expanded by explicit watchmodel request
+ // and initialized.
+ bool visitChildren = true; // Report only one level for Qt Creator.
+ // Visit children of a SymbolGroupNode only if not expanded by its dumpers.
+ if (const SymbolGroupNode *realNode = node->resolveReference()->asSymbolGroupNode()) {
+ if (!realNode->isExpanded()
+ || realNode->testFlags(SymbolGroupNode::Uninitialized)
+ || !realNode->testFlags(SymbolGroupNode::ExpandedByRequest)) {
+ visitChildren = false;
+ }
+ }
// Comma between same level children given obscured children
if (depth == m_lastDepth)
m_os << ',';
@@ -1673,28 +1680,16 @@ SymbolGroupNodeVisitor::VisitResult
m_os << '{';
const int childCount = node->dump(m_os, fullIname, m_parameters, m_context);
m_os << ",numchild=\"" << childCount << '"';
-
- if (childCount) {
- // Recurse to children only if expanded by explicit watchmodel request
- // and initialized.
- // Visit children of a SymbolGroupNode only if not expanded by its dumpers.
- bool skipit = false;
- if (const SymbolGroupNode *realNode = node->resolveReference()->asSymbolGroupNode()) {
- if (!realNode->isExpanded() || realNode->testFlags(SymbolGroupNode::Uninitialized | SymbolGroupNode::ExpandedByDumper))
- skipit = true;
- }
- if (!skipit) {
- m_os << ",children=[";
- if (m_parameters.humanReadable())
- m_os << '\n';
- return VisitContinue;
- }
+ if (!childCount)
+ visitChildren = false;
+ if (visitChildren) { // open children array
+ m_os << ",children=[";
+ } else { // No children, close array.
+ m_os << '}';
}
- // No children, close array.
- m_os << '}';
if (m_parameters.humanReadable())
m_os << '\n';
- return VisitSkipChildren;
+ return visitChildren ? VisitContinue : VisitSkipChildren;
}
void DumpSymbolGroupNodeVisitor::childrenVisited(const AbstractSymbolGroupNode *n, unsigned)
diff --git a/src/libs/qtcreatorcdbext/symbolgroupnode.h b/src/libs/qtcreatorcdbext/symbolgroupnode.h
index 4b7609c209..bdb0ddaf23 100644
--- a/src/libs/qtcreatorcdbext/symbolgroupnode.h
+++ b/src/libs/qtcreatorcdbext/symbolgroupnode.h
@@ -224,7 +224,7 @@ public:
SimpleDumperOk = 0x4, // Internal dumper ran, value set
SimpleDumperFailed = 0x8, // Internal dumper failed
SimpleDumperMask = SimpleDumperNotApplicable|SimpleDumperOk|SimpleDumperFailed,
- ExpandedByDumper = 0x10,
+ ExpandedByRequest = 0x10,
AdditionalSymbol = 0x20, // Introduced by addSymbol, should not be visible
Obscured = 0x40, // Symbol is obscured by (for example) fake container children
ComplexDumperOk = 0x80,
diff --git a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp
index a8fef4a3a3..b15ebc0d01 100644
--- a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp
+++ b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp
@@ -160,10 +160,8 @@ bool SymbolGroupValue::ensureExpanded() const
// Set a flag indicating the node was expanded by SymbolGroupValue
// and not by an explicit request from the watch model.
- if (m_node->expand(&m_errorMessage)) {
- m_node->addFlags(SymbolGroupNode::ExpandedByDumper);
+ if (m_node->expand(&m_errorMessage))
return true;
- }
if (SymbolGroupValue::verbose)
DebugPrint() << "Expand failure of '" << name() << "': " << m_errorMessage;
return false;