debugger: partial revert of 894febba to fix QStringList display

There was a case where "childtype" had to be used instead of "type".
(cherry picked from commit 9af1a0a793)
This commit is contained in:
hjk
2009-08-25 17:32:14 +02:00
committed by con
parent b78f34fea1
commit 7265a2e875
2 changed files with 19 additions and 14 deletions

View File

@@ -3144,6 +3144,7 @@ void GdbEngine::updateWatchData(const WatchData &data)
void GdbEngine::rebuildModel() void GdbEngine::rebuildModel()
{ {
m_processedNames.clear();
PENDING_DEBUG("REBUILDING MODEL"); PENDING_DEBUG("REBUILDING MODEL");
emit gdbInputAvailable(LogStatus, _("<Rebuild Watchmodel>")); emit gdbInputAvailable(LogStatus, _("<Rebuild Watchmodel>"));
q->showStatusMessage(tr("Finished retrieving data."), 400); q->showStatusMessage(tr("Finished retrieving data."), 400);
@@ -3267,20 +3268,22 @@ void GdbEngine::handleVarAssign(const GdbResultRecord &, const QVariant &)
} }
// Find the "type" and "displayedtype" children of root and set up type. // Find the "type" and "displayedtype" children of root and set up type.
void GdbEngine::setWatchDataType(WatchData &data, const GdbMi &root) void GdbEngine::setWatchDataType(WatchData &data, const GdbMi &item)
{ {
const GdbMi &typeItem = root.findChild("type"); if (item.isValid()) {
if (typeItem.isValid()) { const QString miData = _(item.data());
const QString miData = _(typeItem.data());
if (!data.framekey.isEmpty()) if (!data.framekey.isEmpty())
m_varToType[data.framekey] = miData; m_varToType[data.framekey] = miData;
data.setType(miData); data.setType(miData);
} else if (data.type.isEmpty()) { } else if (data.type.isEmpty()) {
data.setTypeNeeded(); data.setTypeNeeded();
} }
const GdbMi &displayedTypeItem = root.findChild("displayedtype"); }
if (displayedTypeItem.isValid())
data.displayedType = _(displayedTypeItem.data()); void GdbEngine::setWatchDataDisplayedType(WatchData &data, const GdbMi &item)
{
if (item.isValid())
data.displayedType = _(item.data());
} }
void GdbEngine::handleVarCreate(const GdbResultRecord &record, void GdbEngine::handleVarCreate(const GdbResultRecord &record,
@@ -3293,7 +3296,7 @@ void GdbEngine::handleVarCreate(const GdbResultRecord &record,
//qDebug() << "HANDLE VARIABLE CREATION:" << data.toString(); //qDebug() << "HANDLE VARIABLE CREATION:" << data.toString();
if (record.resultClass == GdbResultDone) { if (record.resultClass == GdbResultDone) {
data.variable = data.iname; data.variable = data.iname;
setWatchDataType(data, record.data); setWatchDataType(data, record.data.findChild("type"));
if (hasDebuggingHelperForType(data.type)) { if (hasDebuggingHelperForType(data.type)) {
// we do not trust gdb if we have a custom dumper // we do not trust gdb if we have a custom dumper
if (record.data.findChild("children").isValid()) if (record.data.findChild("children").isValid())
@@ -3395,7 +3398,8 @@ void GdbEngine::handleDebuggingHelperValue2(const GdbResultRecord &record,
return; return;
} }
setWatchDataType(data, contents); setWatchDataType(data, record.data.findChild("type"));
setWatchDataDisplayedType(data, record.data.findChild("displaytype"));
setWatchDataValue(data, contents.findChild("value"), setWatchDataValue(data, contents.findChild("value"),
contents.findChild("valueencoded").data().toInt()); contents.findChild("valueencoded").data().toInt());
setWatchDataAddress(data, contents.findChild("addr")); setWatchDataAddress(data, contents.findChild("addr"));
@@ -3421,7 +3425,7 @@ void GdbEngine::handleDebuggingHelperValue2(const GdbResultRecord &record,
// try not to repeat data too often // try not to repeat data too often
WatchData childtemplate; WatchData childtemplate;
setWatchDataType(childtemplate, contents); setWatchDataType(childtemplate, contents.findChild("childtype"));
setWatchDataChildCount(childtemplate, contents.findChild("childnumchild")); setWatchDataChildCount(childtemplate, contents.findChild("childnumchild"));
//qDebug() << "DATA:" << data.toString(); //qDebug() << "DATA:" << data.toString();
@@ -3449,7 +3453,7 @@ void GdbEngine::handleDebuggingHelperValue2(const GdbResultRecord &record,
//data1.name += " (" + skey + ")"; //data1.name += " (" + skey + ")";
data1.name = skey; data1.name = skey;
} }
setWatchDataType(data1, item); setWatchDataType(data1, item.findChild("type"));
setWatchDataExpression(data1, item.findChild("exp")); setWatchDataExpression(data1, item.findChild("exp"));
setWatchDataChildCount(data1, item.findChild("numchild")); setWatchDataChildCount(data1, item.findChild("numchild"));
setWatchDataValue(data1, item.findChild("value"), setWatchDataValue(data1, item.findChild("value"),
@@ -3652,7 +3656,7 @@ void GdbEngine::setLocals(const QList<GdbMi> &locals)
data.name = nam; data.name = nam;
data.exp = nam; data.exp = nam;
data.framekey = m_currentFrame + data.name; data.framekey = m_currentFrame + data.name;
setWatchDataType(data, item); setWatchDataType(data, item.findChild("type"));
// set value only directly if it is simple enough, otherwise // set value only directly if it is simple enough, otherwise
// pass through the insertData() machinery // pass through the insertData() machinery
if (isIntOrFloatType(data.type) || isPointerType(data.type)) if (isIntOrFloatType(data.type) || isPointerType(data.type))
@@ -3709,7 +3713,7 @@ void GdbEngine::handleVarListChildrenHelper(const GdbMi &item,
data.name = _(exp); data.name = _(exp);
data.iname = parent.iname + _c('.') + data.name; data.iname = parent.iname + _c('.') + data.name;
data.variable = _(name); data.variable = _(name);
setWatchDataType(data, item); setWatchDataType(data, item.findChild("type"));
setWatchDataValue(data, item.findChild("value")); setWatchDataValue(data, item.findChild("value"));
setWatchDataAddress(data, item.findChild("addr")); setWatchDataAddress(data, item.findChild("addr"));
setWatchDataSAddress(data, item.findChild("saddr")); setWatchDataSAddress(data, item.findChild("saddr"));
@@ -3731,7 +3735,7 @@ void GdbEngine::handleVarListChildrenHelper(const GdbMi &item,
WatchData data; WatchData data;
data.iname = parent.iname + _c('.') + __(exp); data.iname = parent.iname + _c('.') + __(exp);
data.variable = _(name); data.variable = _(name);
setWatchDataType(data, item); setWatchDataType(data, item.findChild("type"));
setWatchDataValue(data, item.findChild("value")); setWatchDataValue(data, item.findChild("value"));
setWatchDataAddress(data, item.findChild("addr")); setWatchDataAddress(data, item.findChild("addr"));
setWatchDataSAddress(data, item.findChild("saddr")); setWatchDataSAddress(data, item.findChild("saddr"));

View File

@@ -368,6 +368,7 @@ private:
void handleVarListChildrenHelper(const GdbMi &child, void handleVarListChildrenHelper(const GdbMi &child,
const WatchData &parent); const WatchData &parent);
void setWatchDataType(WatchData &data, const GdbMi &mi); void setWatchDataType(WatchData &data, const GdbMi &mi);
void setWatchDataDisplayedType(WatchData &data, const GdbMi &mi);
void setLocals(const QList<GdbMi> &locals); void setLocals(const QList<GdbMi> &locals);
bool startModeAllowsDumpers() const; bool startModeAllowsDumpers() const;