forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -203,12 +203,9 @@ std::string SymbolGroup::dump(const std::string &iname,
|
|||||||
DebugPrint() << "SymbolGroup::dump(" << iname << '/'
|
DebugPrint() << "SymbolGroup::dump(" << iname << '/'
|
||||||
<< aNode->absoluteFullIName() <<" resolves to " << node->absoluteFullIName()
|
<< aNode->absoluteFullIName() <<" resolves to " << node->absoluteFullIName()
|
||||||
<< " expanded=" << node->isExpanded();
|
<< " expanded=" << node->isExpanded();
|
||||||
if (node->isExpanded()) { // Mark expand request by watch model
|
if (!node->isExpanded() && node->canExpand() && !node->expand(errorMessage))
|
||||||
node->clearFlags(SymbolGroupNode::ExpandedByDumper);
|
return std::string();
|
||||||
} else {
|
node->addFlags(SymbolGroupNode::ExpandedByRequest);
|
||||||
if (node->canExpand() && !node->expand(errorMessage))
|
|
||||||
return std::string();
|
|
||||||
}
|
|
||||||
// After expansion, run the complex dumpers
|
// After expansion, run the complex dumpers
|
||||||
if (p.dumpFlags & DumpParameters::DumpComplexDumpers)
|
if (p.dumpFlags & DumpParameters::DumpComplexDumpers)
|
||||||
node->runComplexDumpers(ctx);
|
node->runComplexDumpers(ctx);
|
||||||
@@ -378,8 +375,12 @@ static inline SymbolGroupNode *
|
|||||||
|
|
||||||
bool SymbolGroup::expand(const std::string &nodeName, std::string *errorMessage)
|
bool SymbolGroup::expand(const std::string &nodeName, std::string *errorMessage)
|
||||||
{
|
{
|
||||||
if (SymbolGroupNode *node = findNodeForExpansion(this, nodeName, errorMessage))
|
if (SymbolGroupNode *node = findNodeForExpansion(this, nodeName, errorMessage)) {
|
||||||
return node == m_root ? true : node->expand(errorMessage);
|
if (node == m_root)
|
||||||
|
return true;
|
||||||
|
node->addFlags(SymbolGroupNode::ExpandedByRequest);
|
||||||
|
return node->expand(errorMessage);
|
||||||
|
}
|
||||||
return false;
|
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)
|
bool SymbolGroup::expandRunComplexDumpers(const std::string &nodeName, const SymbolGroupValueContext &ctx, std::string *errorMessage)
|
||||||
{
|
{
|
||||||
if (SymbolGroupNode *node = findNodeForExpansion(this, nodeName, errorMessage))
|
if (SymbolGroupNode *node = findNodeForExpansion(this, nodeName, errorMessage)) {
|
||||||
return node == m_root ? true : node->expandRunComplexDumpers(ctx, errorMessage);
|
if (node == m_root)
|
||||||
|
return true;
|
||||||
|
node->addFlags(SymbolGroupNode::ExpandedByRequest);
|
||||||
|
return node->expandRunComplexDumpers(ctx, errorMessage);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -62,8 +62,8 @@ static inline void debugNodeFlags(std::ostream &str, unsigned f)
|
|||||||
str << " DumperOk";
|
str << " DumperOk";
|
||||||
if (f & SymbolGroupNode::SimpleDumperFailed)
|
if (f & SymbolGroupNode::SimpleDumperFailed)
|
||||||
str << " DumperFailed";
|
str << " DumperFailed";
|
||||||
if (f & SymbolGroupNode::ExpandedByDumper)
|
if (f & SymbolGroupNode::ExpandedByRequest)
|
||||||
str << " ExpandedByDumper";
|
str << " ExpandedByRequest";
|
||||||
if (f & SymbolGroupNode::AdditionalSymbol)
|
if (f & SymbolGroupNode::AdditionalSymbol)
|
||||||
str << " AdditionalSymbol";
|
str << " AdditionalSymbol";
|
||||||
if (f & SymbolGroupNode::Obscured)
|
if (f & SymbolGroupNode::Obscured)
|
||||||
@@ -594,8 +594,8 @@ void ErrorSymbolGroupNode::debug(std::ostream &os, const std::string &visitingFu
|
|||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
The dumping is mostly based on SymbolGroupValue expressions.
|
The dumping is mostly based on SymbolGroupValue expressions.
|
||||||
in the debugger. Evaluating those dumpers might expand symbol nodes, which are
|
in the debugger. Evaluating those dumpers might expand symbol nodes, but those
|
||||||
then marked as 'ExpandedByDumper'. This stops the dump recursion to prevent
|
are not marked as 'ExpandedByRequest'. This stops the dump recursion to prevent
|
||||||
outputting data that were not explicitly expanded by the watch handler.
|
outputting data that were not explicitly expanded by the watch handler.
|
||||||
\ingroup qtcreatorcdbext */
|
\ingroup qtcreatorcdbext */
|
||||||
|
|
||||||
@@ -1022,7 +1022,6 @@ void SymbolGroupNode::runComplexDumpers(const SymbolGroupValueContext &ctx)
|
|||||||
if (ctChildren.empty())
|
if (ctChildren.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
clearFlags(ExpandedByDumper);
|
|
||||||
// Mark current children as obscured. We cannot show both currently
|
// Mark current children as obscured. We cannot show both currently
|
||||||
// as this would upset the numerical sorting of the watch model
|
// as this would upset the numerical sorting of the watch model
|
||||||
AbstractSymbolGroupNodePtrVectorConstIterator cend = children().end();
|
AbstractSymbolGroupNodePtrVectorConstIterator cend = children().end();
|
||||||
@@ -1269,11 +1268,8 @@ bool SymbolGroupNode::expand(std::string *errorMessage)
|
|||||||
DebugPrint() << "SymbolGroupNode::expand " << name()
|
DebugPrint() << "SymbolGroupNode::expand " << name()
|
||||||
<<'/' << absoluteFullIName() << ' '
|
<<'/' << absoluteFullIName() << ' '
|
||||||
<< m_index << DebugNodeFlags(flags());
|
<< m_index << DebugNodeFlags(flags());
|
||||||
if (isExpanded()) {
|
if (isExpanded())
|
||||||
// Clear the flag indication dumper expansion on a second, explicit request
|
|
||||||
clearFlags(ExpandedByDumper);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (!canExpand()) {
|
if (!canExpand()) {
|
||||||
*errorMessage = msgExpandFailed(name(), absoluteFullIName(), m_index,
|
*errorMessage = msgExpandFailed(name(), absoluteFullIName(), m_index,
|
||||||
"No subelements to expand in node.");
|
"No subelements to expand in node.");
|
||||||
@@ -1661,6 +1657,17 @@ SymbolGroupNodeVisitor::VisitResult
|
|||||||
return VisitSkipChildren;
|
return VisitSkipChildren;
|
||||||
if (node->testFlags(SymbolGroupNode::AdditionalSymbol) && !node->testFlags(SymbolGroupNode::WatchNode))
|
if (node->testFlags(SymbolGroupNode::AdditionalSymbol) && !node->testFlags(SymbolGroupNode::WatchNode))
|
||||||
return VisitSkipChildren;
|
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
|
// Comma between same level children given obscured children
|
||||||
if (depth == m_lastDepth)
|
if (depth == m_lastDepth)
|
||||||
m_os << ',';
|
m_os << ',';
|
||||||
@@ -1673,28 +1680,16 @@ SymbolGroupNodeVisitor::VisitResult
|
|||||||
m_os << '{';
|
m_os << '{';
|
||||||
const int childCount = node->dump(m_os, fullIname, m_parameters, m_context);
|
const int childCount = node->dump(m_os, fullIname, m_parameters, m_context);
|
||||||
m_os << ",numchild=\"" << childCount << '"';
|
m_os << ",numchild=\"" << childCount << '"';
|
||||||
|
if (!childCount)
|
||||||
if (childCount) {
|
visitChildren = false;
|
||||||
// Recurse to children only if expanded by explicit watchmodel request
|
if (visitChildren) { // open children array
|
||||||
// and initialized.
|
m_os << ",children=[";
|
||||||
// Visit children of a SymbolGroupNode only if not expanded by its dumpers.
|
} else { // No children, close array.
|
||||||
bool skipit = false;
|
m_os << '}';
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// No children, close array.
|
|
||||||
m_os << '}';
|
|
||||||
if (m_parameters.humanReadable())
|
if (m_parameters.humanReadable())
|
||||||
m_os << '\n';
|
m_os << '\n';
|
||||||
return VisitSkipChildren;
|
return visitChildren ? VisitContinue : VisitSkipChildren;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DumpSymbolGroupNodeVisitor::childrenVisited(const AbstractSymbolGroupNode *n, unsigned)
|
void DumpSymbolGroupNodeVisitor::childrenVisited(const AbstractSymbolGroupNode *n, unsigned)
|
||||||
|
@@ -224,7 +224,7 @@ public:
|
|||||||
SimpleDumperOk = 0x4, // Internal dumper ran, value set
|
SimpleDumperOk = 0x4, // Internal dumper ran, value set
|
||||||
SimpleDumperFailed = 0x8, // Internal dumper failed
|
SimpleDumperFailed = 0x8, // Internal dumper failed
|
||||||
SimpleDumperMask = SimpleDumperNotApplicable|SimpleDumperOk|SimpleDumperFailed,
|
SimpleDumperMask = SimpleDumperNotApplicable|SimpleDumperOk|SimpleDumperFailed,
|
||||||
ExpandedByDumper = 0x10,
|
ExpandedByRequest = 0x10,
|
||||||
AdditionalSymbol = 0x20, // Introduced by addSymbol, should not be visible
|
AdditionalSymbol = 0x20, // Introduced by addSymbol, should not be visible
|
||||||
Obscured = 0x40, // Symbol is obscured by (for example) fake container children
|
Obscured = 0x40, // Symbol is obscured by (for example) fake container children
|
||||||
ComplexDumperOk = 0x80,
|
ComplexDumperOk = 0x80,
|
||||||
|
@@ -160,10 +160,8 @@ bool SymbolGroupValue::ensureExpanded() const
|
|||||||
|
|
||||||
// Set a flag indicating the node was expanded by SymbolGroupValue
|
// Set a flag indicating the node was expanded by SymbolGroupValue
|
||||||
// and not by an explicit request from the watch model.
|
// and not by an explicit request from the watch model.
|
||||||
if (m_node->expand(&m_errorMessage)) {
|
if (m_node->expand(&m_errorMessage))
|
||||||
m_node->addFlags(SymbolGroupNode::ExpandedByDumper);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (SymbolGroupValue::verbose)
|
if (SymbolGroupValue::verbose)
|
||||||
DebugPrint() << "Expand failure of '" << name() << "': " << m_errorMessage;
|
DebugPrint() << "Expand failure of '" << name() << "': " << m_errorMessage;
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user