debugger: implement selected of string encoding per pointer type/individual pointer

This commit is contained in:
hjk
2010-03-11 18:55:52 +01:00
parent 8575e4c784
commit c8a61cc8f2
9 changed files with 244 additions and 100 deletions

View File

@@ -252,10 +252,10 @@ void GdbEngine::updateSubItemClassic(const WatchData &data0)
return;
}
// we should have a type now. this is relied upon further below
// We should have a type now. This is relied upon further below.
QTC_ASSERT(!data.type.isEmpty(), return);
// a common case that can be easily solved
// A common case that can be easily solved.
if (data.isChildrenNeeded() && isPointerType(data.type)
&& !hasDebuggingHelperForType(data.type)) {
// We sometimes know what kind of children pointers have
@@ -431,8 +431,6 @@ void GdbEngine::handleDebuggingHelperValue3Classic(const GdbResponse &response)
while (out.endsWith(' ') || out.endsWith('\n'))
out.chop(1);
QList<QByteArray> list = out.split(' ');
//qDebug() << "RECEIVED" << response.toString() << "FOR" << data0.toString()
// << " STREAM:" << out;
if (list.isEmpty()) {
//: Value for variable
data.setError(WatchData::msgNotInScope());
@@ -538,7 +536,7 @@ void GdbEngine::tryLoadDebuggingHelpersClassic()
postCommand("call (void*)dlopen(\"" + GdbMi::escapeCString(dlopenLib)
+ "\", " + flag + ")",
CB(handleDebuggingHelperSetup));
// some older systems like CentOS 4.6 prefer this:
// Some older systems like CentOS 4.6 prefer this:
postCommand("call (void*)__dlopen(\"" + GdbMi::escapeCString(dlopenLib)
+ "\", " + flag + ")",
CB(handleDebuggingHelperSetup));
@@ -550,7 +548,7 @@ void GdbEngine::tryLoadDebuggingHelpersClassic()
void GdbEngine::tryQueryDebuggingHelpersClassic()
{
PRECONDITION;
// retrieve list of dumpable classes
// Retrieve list of dumpable classes.
postCommand("call (void*)qDumpObjectData440(1,0,0,0,0,0,0,0)");
postCommand("p (char*)&qDumpOutBuffer",
CB(handleQueryDebuggingHelperClassic));
@@ -560,7 +558,7 @@ void GdbEngine::recheckDebuggingHelperAvailabilityClassic()
{
PRECONDITION;
if (m_gdbAdapter->dumperHandling() != AbstractGdbAdapter::DumperNotAvailable) {
// retrieve list of dumpable classes
// Retrieve list of dumpable classes.
postCommand("call (void*)qDumpObjectData440(1,0,0,0,0,0,0,0)");
postCommand("p (char*)&qDumpOutBuffer",
CB(handleQueryDebuggingHelperClassic));
@@ -681,7 +679,6 @@ bool GdbEngine::checkDebuggingHelpersClassic()
if (!manager()->qtDumperLibraryEnabled())
return false;
const QString lib = qtDumperLibraryName();
//qDebug() << "DUMPERLIB:" << lib;
const QFileInfo fi(lib);
if (!fi.exists()) {
const QStringList &locations = manager()->qtDumperLibraryLocations();

View File

@@ -3321,7 +3321,7 @@ void GdbEngine::setWatchDataDisplayedType(WatchData &data, const GdbMi &item)
void GdbEngine::handleVarCreate(const GdbResponse &response)
{
WatchData data = response.cookie.value<WatchData>();
// happens e.g. when we already issued a var-evaluate command
// Happens e.g. when we already issued a var-evaluate command.
if (!data.isValid())
return;
//qDebug() << "HANDLE VARIABLE CREATION:" << data.toString();
@@ -3351,11 +3351,9 @@ void GdbEngine::handleVarCreate(const GdbResponse &response)
void GdbEngine::handleDebuggingHelperSetup(const GdbResponse &response)
{
//qDebug() << "CUSTOM SETUP RESULT:" << response.toString();
if (response.resultClass == GdbResultDone) {
} else {
QString msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
//qDebug() << "CUSTOM DUMPER SETUP ERROR MESSAGE:" << msg;
showStatusMessage(tr("Custom dumper setup: %1").arg(msg), 10000);
}
}
@@ -3381,7 +3379,6 @@ void GdbEngine::handleChildren(const WatchData &data0, const GdbMi &item,
}
setWatchDataType(data, item.findChild("type"));
setWatchDataEditValue(data, item.findChild("editvalue"));
setWatchDataChildCount(data, item.findChild("numchild"));
setWatchDataValue(data, item.findChild("value"),
item.findChild("valueencoded").data().toInt());
setWatchDataAddress(data, item.findChild("addr"));
@@ -3391,6 +3388,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"));
setWatchDataChildCount(data, item.findChild("numchild"));
//qDebug() << "\nAPPEND TO LIST: " << data.toString() << "\n";
list->append(data);
@@ -3451,7 +3449,7 @@ void GdbEngine::updateLocals(const QVariant &cookie)
}
// Parse a local variable from GdbMi
// Parse a local variable from GdbMi.
WatchData GdbEngine::localVariable(const GdbMi &item,
const QStringList &uninitializedVariables,
QMap<QByteArray, int> *seen)
@@ -3479,7 +3477,7 @@ WatchData GdbEngine::localVariable(const GdbMi &item,
WatchData data;
QString nam = _(name);
data.iname = "local." + name + QByteArray::number(n + 1);
//: Variable %1 is the variable name, %2 is a simple count
//: Variable %1 is the variable name, %2 is a simple count.
data.name = WatchData::shadowedName(nam, n);
if (uninitializedVariables.contains(data.name)) {
data.setError(WatchData::msgNotInScope());
@@ -3511,8 +3509,8 @@ WatchData GdbEngine::localVariable(const GdbMi &item,
// somewhere in the response.
data.setChildrenUnneeded();
} else {
// set value only directly if it is simple enough, otherwise
// pass through the insertData() machinery
// Set value only directly if it is simple enough, otherwise
// pass through the insertData() machinery.
if (isIntOrFloatType(data.type) || isPointerType(data.type))
setWatchDataValue(data, item.findChild("value"));
if (isSymbianIntType(data.type)) {
@@ -3523,7 +3521,11 @@ WatchData GdbEngine::localVariable(const GdbMi &item,
if (!m_manager->watchHandler()->isExpandedIName(data.iname))
data.setChildrenUnneeded();
if (isPointerType(data.type) || data.name == __("this"))
GdbMi t = item.findChild("numchild");
if (t.isValid())
data.setHasChildren(t.data().toInt() > 0);
else if (isPointerType(data.type) || data.name == __("this"))
data.setHasChildren(true);
return data;
}

View File

@@ -55,13 +55,7 @@ void GdbEngine::updateLocalsPython(const QByteArray &varList)
//m_toolTipExpression.clear();
WatchHandler *handler = m_manager->watchHandler();
QByteArray expanded;
QSet<QByteArray> expandedINames = handler->expandedINames();
QSetIterator<QByteArray> jt(expandedINames);
while (jt.hasNext()) {
expanded.append(jt.next());
expanded.append(',');
}
QByteArray expanded = handler->formatRequests();
if (expanded.isEmpty())
expanded.append("defaults,");
expanded.chop(1);
@@ -92,8 +86,8 @@ void GdbEngine::updateLocalsPython(const QByteArray &varList)
options += "defaults,";
options.chop(1);
postCommand("bb " + options + " @" + varList + ' '
+ expanded + ' ' + watchers.toHex(),
postCommand("bb options:" + options + " vars:" + varList + ' '
+ expanded + " watchers:" + watchers.toHex(),
WatchUpdate, CB(handleStackFramePython));
}