Debugger[CDB]: Fix bug in updating pointer-type watch items.

Collapse pointer-type items in watch symbol group when updating.

Task-number: QTCREATORBUG-5652
Change-Id: I077120c7352da5bc330bb000786a50432bb47738
Reviewed-on: http://codereview.qt.nokia.com/2424
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
Friedemann Kleint
2011-08-01 08:36:00 +02:00
parent 65c0eb5165
commit ee7b327f4c
4 changed files with 78 additions and 3 deletions

View File

@@ -1093,6 +1093,39 @@ static std::string msgExpandFailed(const std::string &name, const std::string &i
return str.str();
}
static std::string msgCollapseFailed(const std::string &name, const std::string &iname,
ULONG index, const std::string &why)
{
std::ostringstream str;
str << "Collapsing of '" << name << "'/'" << iname << " (index: " << index
<< ") failed: " << why;
return str.str();
}
bool SymbolGroupNode::collapse(std::string *errorMessage)
{
if (!isExpanded())
return true;
SymbolGroupNode *sParent = symbolGroupNodeParent();
if (!sParent) {
*errorMessage = msgCollapseFailed(name(), absoluteFullIName(), m_index, "Cannot collapse root.");
ExtensionContext::instance().report('X', 0, 0, "Error", "%s", errorMessage->c_str());
return false;
}
// Get current number of children
const ULONG next = nextSymbolIndex();
HRESULT hr = m_symbolGroup->debugSymbolGroup()->ExpandSymbol(m_index, FALSE);
if (FAILED(hr)) {
*errorMessage = msgCollapseFailed(name(), absoluteFullIName(), m_index, msgDebugEngineComFailed("ExpandSymbol(FALSE)", hr));
ExtensionContext::instance().report('X', 0, 0, "Error", "%s", errorMessage->c_str());
return false;
}
removeChildren();
if (next)
sParent->notifyIndexesMoved(m_index + 1, false, next - m_index - 1);
return true;
}
// Expand!
bool SymbolGroupNode::expand(std::string *errorMessage)
{