forked from qt-creator/qt-creator
debugger: work on autotests
This commit is contained in:
@@ -252,6 +252,7 @@ void GdbEngine::initializeVariables()
|
||||
m_debuggingHelperState = DebuggingHelperUninitialized;
|
||||
m_gdbVersion = 100;
|
||||
m_gdbBuildVersion = -1;
|
||||
m_isSynchroneous = false;
|
||||
|
||||
m_fullToShortName.clear();
|
||||
m_shortToFullName.clear();
|
||||
@@ -1310,6 +1311,16 @@ void GdbEngine::handleShowVersion(const GdbResponse &response)
|
||||
}
|
||||
}
|
||||
|
||||
void GdbEngine::handleIsSynchroneous(const GdbResponse &response)
|
||||
{
|
||||
Q_UNUSED(response);
|
||||
if (response.resultClass == GdbResultDone) {
|
||||
m_isSynchroneous = true;
|
||||
} else {
|
||||
m_isSynchroneous = false;
|
||||
}
|
||||
}
|
||||
|
||||
void GdbEngine::handleExecContinue(const GdbResponse &response)
|
||||
{
|
||||
if (response.resultClass == GdbResultRunning) {
|
||||
@@ -3247,7 +3258,7 @@ void GdbEngine::handleChildren(const WatchData &data0, const GdbMi &item,
|
||||
item.findChild("valuetooltipencoded").data().toInt());
|
||||
setWatchDataValueEnabled(data, item.findChild("valueenabled"));
|
||||
setWatchDataValueEditable(data, item.findChild("valueeditable"));
|
||||
//qDebug() << "HANDLE CHILDREN: " << data.toString();
|
||||
//qDebug() << "\nAPPEND TO LIST: " << data.toString() << "\n";
|
||||
list->append(data);
|
||||
|
||||
// try not to repeat data too often
|
||||
@@ -3370,7 +3381,6 @@ void GdbEngine::updateLocals()
|
||||
|
||||
if (isSynchroneous()) {
|
||||
QStringList expanded = m_manager->watchHandler()->expandedINames().toList();
|
||||
qDebug() << "EXPANDED: " << expanded;
|
||||
postCommand(_("bb %1").arg(expanded.join(_(","))),
|
||||
WatchUpdate, CB(handleStackFrame1));
|
||||
postCommand(_("p 0"), WatchUpdate, CB(handleStackFrame2));
|
||||
@@ -3393,7 +3403,7 @@ void GdbEngine::handleStackFrame1(const GdbResponse &response)
|
||||
out.chop(1);
|
||||
//qDebug() << "FIRST CHUNK: " << out;
|
||||
m_firstChunk = out;
|
||||
} else if (response.resultClass == GdbResultError) {
|
||||
} else {
|
||||
QTC_ASSERT(false, /**/);
|
||||
}
|
||||
}
|
||||
@@ -3406,24 +3416,25 @@ void GdbEngine::handleStackFrame2(const GdbResponse &response)
|
||||
out.chop(1);
|
||||
//qDebug() << "SECOND CHUNK: " << out;
|
||||
out = m_firstChunk + out;
|
||||
// FIXME: Hack, make sure dumper does not return "{}"
|
||||
out.replace(",{}", "");
|
||||
GdbMi all("[" + out + "]");
|
||||
qDebug() << "ALL: " << all.toString();
|
||||
QList<GdbMi> locals = all.children();
|
||||
//manager()->watchHandler()->insertBulkData(locals);
|
||||
//setLocals(locals);
|
||||
//GdbMi all(out);
|
||||
|
||||
//qDebug() << "\n\n\nALL: " << all.toString() << "\n";
|
||||
GdbMi locals = all.findChild("locals");
|
||||
//qDebug() << "\n\n\nLOCALS: " << locals.toString() << "\n";
|
||||
WatchData *data = manager()->watchHandler()->findItem(_("local"));
|
||||
QTC_ASSERT(data, return);
|
||||
|
||||
QList<WatchData> list;
|
||||
foreach (const GdbMi &local, locals)
|
||||
handleChildren(*data, local, &list);
|
||||
|
||||
//foreach (const GdbMi &local, locals.children)
|
||||
// handleChildren(*data, local, &list);
|
||||
handleChildren(*data, locals, &list);
|
||||
//for (int i = 0; i != list.size(); ++i)
|
||||
// qDebug() << "READ: " << list.at(i).toString();
|
||||
manager()->watchHandler()->insertBulkData(list);
|
||||
|
||||
manager()->watchHandler()->updateWatchers();
|
||||
} else if (response.resultClass == GdbResultError) {
|
||||
} else {
|
||||
QTC_ASSERT(false, /**/);
|
||||
}
|
||||
}
|
||||
@@ -4094,6 +4105,7 @@ void GdbEngine::handleAdapterStarted()
|
||||
debugMessage(_("ADAPTER SUCCESSFULLY STARTED, INITIALIZING GDB"));
|
||||
|
||||
postCommand(_("show version"), CB(handleShowVersion));
|
||||
postCommand(_("help bb"), CB(handleIsSynchroneous));
|
||||
//postCommand(_("-enable-timings");
|
||||
postCommand(_("set print static-members off")); // Seemingly doesn't work.
|
||||
//postCommand(_("set debug infrun 1"));
|
||||
@@ -4253,7 +4265,7 @@ void GdbEngine::showMessageBox(int icon, const QString &title, const QString &te
|
||||
|
||||
bool GdbEngine::isSynchroneous() const
|
||||
{
|
||||
return false;
|
||||
return m_isSynchroneous;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -269,6 +269,7 @@ private:
|
||||
void handleShowVersion(const GdbResponse &response);
|
||||
void handleQuerySources(const GdbResponse &response);
|
||||
void handleWatchPoint(const GdbResponse &response);
|
||||
void handleIsSynchroneous(const GdbResponse &response);
|
||||
bool showToolTip();
|
||||
|
||||
// Convenience
|
||||
@@ -299,6 +300,7 @@ private:
|
||||
|
||||
int m_gdbVersion; // 6.8.0 is 680
|
||||
int m_gdbBuildVersion; // MAC only?
|
||||
bool m_isSynchroneous; // Can act synchroneously?
|
||||
|
||||
// awful hack to keep track of used files
|
||||
QMap<QString, QString> m_shortToFullName;
|
||||
|
||||
@@ -868,16 +868,21 @@ static int findInsertPosition(const QList<WatchItem *> &list, const WatchItem *i
|
||||
|
||||
void WatchModel::insertData(const WatchData &data)
|
||||
{
|
||||
// qDebug() << "WMI:" << data.toString();
|
||||
//qDebug() << "WMI:" << data.toString();
|
||||
//static int bulk = 0;
|
||||
//qDebug() << "SINGLE: " << ++bulk << data.toString();
|
||||
QTC_ASSERT(!data.iname.isEmpty(), return);
|
||||
if (data.iname.isEmpty()) {
|
||||
int x;
|
||||
x = 1;
|
||||
}
|
||||
QTC_ASSERT(!data.iname.isEmpty(), qDebug() << data.toString(); return);
|
||||
WatchItem *parent = findItem(parentName(data.iname), m_root);
|
||||
if (!parent) {
|
||||
WatchData parent;
|
||||
parent.iname = parentName(data.iname);
|
||||
insertData(parent);
|
||||
//MODEL_DEBUG("\nFIXING MISSING PARENT FOR\n" << data.iname);
|
||||
MODEL_DEBUG("\nFIXING MISSING PARENT FOR\n" << data.iname);
|
||||
if (!parent.iname.isEmpty())
|
||||
insertData(parent);
|
||||
return;
|
||||
}
|
||||
QModelIndex index = watchIndex(parent);
|
||||
@@ -1098,10 +1103,12 @@ void WatchHandler::insertData(const WatchData &data)
|
||||
return;
|
||||
}
|
||||
if (data.isSomethingNeeded()) {
|
||||
MODEL_DEBUG("SOMETHING NEEDED: " << data.toString());
|
||||
m_manager->updateWatchData(data);
|
||||
} else {
|
||||
WatchModel *model = modelForIName(data.iname);
|
||||
QTC_ASSERT(model, return);
|
||||
MODEL_DEBUG("NOTHING NEEDED: " << data.toString());
|
||||
model->insertData(data);
|
||||
}
|
||||
}
|
||||
@@ -1372,7 +1379,7 @@ WatchModel *WatchHandler::modelForIName(const QString &iname) const
|
||||
return m_watchers;
|
||||
if (iname.startsWith(QLatin1String("tooltip")))
|
||||
return m_tooltips;
|
||||
QTC_ASSERT(false, /**/);
|
||||
QTC_ASSERT(false, qDebug() << "INAME: " << iname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user