forked from qt-creator/qt-creator
Fixes: debugger: fix custom dumpers
Details: again...
This commit is contained in:
@@ -1096,8 +1096,8 @@ bool DebuggerManager::useFastStart() const
|
|||||||
|
|
||||||
void DebuggerManager::setUseCustomDumpers(bool on)
|
void DebuggerManager::setUseCustomDumpers(bool on)
|
||||||
{
|
{
|
||||||
//m_settings.m_useCustomDumpers = on;
|
m_settings.m_useCustomDumpers = on;
|
||||||
//engine()->setUseCustomDumpers(on);
|
engine()->setUseCustomDumpers(on);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::setUseFastStart(bool on)
|
void DebuggerManager::setUseFastStart(bool on)
|
||||||
|
@@ -253,6 +253,7 @@ void GdbEngine::init()
|
|||||||
m_gdbVersion = 100;
|
m_gdbVersion = 100;
|
||||||
m_shared = 0;
|
m_shared = 0;
|
||||||
m_outputCodec = QTextCodec::codecForLocale();
|
m_outputCodec = QTextCodec::codecForLocale();
|
||||||
|
m_dataDumperState = DataDumperUninitialized;
|
||||||
|
|
||||||
m_oldestAcceptableToken = -1;
|
m_oldestAcceptableToken = -1;
|
||||||
|
|
||||||
@@ -733,7 +734,7 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
|
|||||||
--m_pendingRequests;
|
--m_pendingRequests;
|
||||||
PENDING_DEBUG(" TYPE " << cmd.type << " DECREMENTS PENDING TO: "
|
PENDING_DEBUG(" TYPE " << cmd.type << " DECREMENTS PENDING TO: "
|
||||||
<< m_pendingRequests << cmd.command);
|
<< m_pendingRequests << cmd.command);
|
||||||
if (m_pendingRequests == 0)
|
if (m_pendingRequests <= 0)
|
||||||
updateWatchModel2();
|
updateWatchModel2();
|
||||||
} else {
|
} else {
|
||||||
PENDING_DEBUG(" UNKNOWN TYPE " << cmd.type << " LEAVES PENDING AT: "
|
PENDING_DEBUG(" UNKNOWN TYPE " << cmd.type << " LEAVES PENDING AT: "
|
||||||
@@ -2883,7 +2884,7 @@ static QString sizeofTypeExpression(const QString &type)
|
|||||||
|
|
||||||
void GdbEngine::setUseCustomDumpers(bool on)
|
void GdbEngine::setUseCustomDumpers(bool on)
|
||||||
{
|
{
|
||||||
qDebug() << "SWITCHING ON/OFF DUMPER DEBUGGING:" << on;
|
//qDebug() << "SWITCHING ON/OFF DUMPER DEBUGGING:" << on;
|
||||||
Q_UNUSED(on);
|
Q_UNUSED(on);
|
||||||
// FIXME: a bit too harsh, but otherwise the treeview sometimes look funny
|
// FIXME: a bit too harsh, but otherwise the treeview sometimes look funny
|
||||||
//m_expandedINames.clear();
|
//m_expandedINames.clear();
|
||||||
@@ -3052,15 +3053,15 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
|
|||||||
|
|
||||||
//qDebug() << "CMD: " << cmd;
|
//qDebug() << "CMD: " << cmd;
|
||||||
|
|
||||||
sendSynchronizedCommand(cmd, WatchDumpCustomValue1, QVariant::fromValue(data));
|
QVariant var;
|
||||||
|
var.setValue(data);
|
||||||
|
sendSynchronizedCommand(cmd, WatchDumpCustomValue1, var);
|
||||||
|
|
||||||
q->showStatusMessage(
|
q->showStatusMessage(
|
||||||
tr("Retrieving data for watch view (%1 requests pending)...")
|
tr("Retrieving data for watch view (%1 requests pending)...")
|
||||||
.arg(m_pendingRequests + 1), 10000);
|
.arg(m_pendingRequests + 1), 10000);
|
||||||
|
|
||||||
// retrieve response
|
// retrieve response
|
||||||
QVariant var;
|
|
||||||
var.setValue(data);
|
|
||||||
sendSynchronizedCommand("p (char*)qDumpOutBuffer", WatchDumpCustomValue2, var);
|
sendSynchronizedCommand("p (char*)qDumpOutBuffer", WatchDumpCustomValue2, var);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3268,7 +3269,7 @@ void GdbEngine::updateWatchModel2()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PENDING_DEBUG("REBUILDING MODEL")
|
PENDING_DEBUG("REBUILDING MODEL");
|
||||||
emit gdbInputAvailable(QString(),
|
emit gdbInputAvailable(QString(),
|
||||||
"[" + currentTime() + "] <Rebuild Watchmodel>");
|
"[" + currentTime() + "] <Rebuild Watchmodel>");
|
||||||
q->showStatusMessage(tr("Finished retrieving data."), 400);
|
q->showStatusMessage(tr("Finished retrieving data."), 400);
|
||||||
@@ -3454,7 +3455,7 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record,
|
|||||||
} else if (record.resultClass == GdbResultError) {
|
} else if (record.resultClass == GdbResultError) {
|
||||||
// Record an extra result, as the socket result will be lost
|
// Record an extra result, as the socket result will be lost
|
||||||
// in transmission
|
// in transmission
|
||||||
--m_pendingRequests;
|
//--m_pendingRequests;
|
||||||
QString msg = record.data.findChild("msg").data();
|
QString msg = record.data.findChild("msg").data();
|
||||||
//qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg;
|
//qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg;
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
@@ -3469,12 +3470,12 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (msg.startsWith("The program being debugged was sig"))
|
//if (msg.startsWith("The program being debugged was sig"))
|
||||||
msg = strNotInScope;
|
// msg = strNotInScope;
|
||||||
if (msg.startsWith("The program being debugged stopped while"))
|
//if (msg.startsWith("The program being debugged stopped while"))
|
||||||
msg = strNotInScope;
|
// msg = strNotInScope;
|
||||||
data.setError(msg);
|
//data.setError(msg);
|
||||||
insertData(data);
|
//insertData(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3485,34 +3486,36 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
|
|||||||
QTC_ASSERT(data.isValid(), return);
|
QTC_ASSERT(data.isValid(), return);
|
||||||
//qDebug() << "CUSTOM VALUE RESULT: " << record.toString();
|
//qDebug() << "CUSTOM VALUE RESULT: " << record.toString();
|
||||||
//qDebug() << "FOR DATA: " << data.toString() << record.resultClass;
|
//qDebug() << "FOR DATA: " << data.toString() << record.resultClass;
|
||||||
if (record.resultClass == GdbResultDone) {
|
if (record.resultClass != GdbResultDone) {
|
||||||
|
qDebug() << "STRANGE CUSTOM DUMPER RESULT DATA: " << data.toString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GdbMi output = record.data.findChild("consolestreamoutput");
|
GdbMi output = record.data.findChild("consolestreamoutput");
|
||||||
QByteArray out = output.data();
|
QByteArray out = output.data();
|
||||||
out = out.mid(out.indexOf('"') + 2); // + 1 is the 'success marker'
|
|
||||||
|
int markerPos = out.indexOf('"') + 1; // position of 'success marker'
|
||||||
|
if (markerPos == -1 || out.at(markerPos) == 'f') { // 't' or 'f'
|
||||||
|
// custom dumper produced no output
|
||||||
|
data.setError(strNotInScope);
|
||||||
|
insertData(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
out = out.mid(markerPos + 1);
|
||||||
out = out.left(out.lastIndexOf('"'));
|
out = out.left(out.lastIndexOf('"'));
|
||||||
//out.replace('\'', '"');
|
|
||||||
out.replace("\\", "");
|
out.replace("\\", "");
|
||||||
out = "dummy={" + out + "}";
|
out = "dummy={" + out + "}";
|
||||||
//qDebug() << "OUTPUT: " << out;
|
|
||||||
|
|
||||||
GdbMi contents;
|
GdbMi contents;
|
||||||
contents.fromString(out);
|
contents.fromString(out);
|
||||||
//qDebug() << "CONTENTS" << contents.toString(true);
|
//qDebug() << "CONTENTS" << contents.toString(true);
|
||||||
|
|
||||||
if (!contents.isValid()) {
|
if (!contents.isValid()) {
|
||||||
qDebug() << "INVALID";
|
data.setError(strNotInScope);
|
||||||
// custom dumper produced no output
|
|
||||||
if (data.isValueNeeded())
|
|
||||||
data.setValue("<unknown>");
|
|
||||||
if (data.isTypeNeeded())
|
|
||||||
data.setType("<unknown>");
|
|
||||||
if (data.isChildrenNeeded())
|
|
||||||
data.setChildCount(0);
|
|
||||||
if (data.isChildCountNeeded())
|
|
||||||
data.setChildCount(0);
|
|
||||||
data.setValueToolTip("<custom dumper produced no output>");
|
|
||||||
insertData(data);
|
insertData(data);
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setWatchDataType(data, contents.findChild("type"));
|
setWatchDataType(data, contents.findChild("type"));
|
||||||
setWatchDataValue(data, contents.findChild("value"),
|
setWatchDataValue(data, contents.findChild("value"),
|
||||||
contents.findChild("valueencoded").data().toInt());
|
contents.findChild("valueencoded").data().toInt());
|
||||||
@@ -3566,21 +3569,6 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
|
|||||||
insertData(data1);
|
insertData(data1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//qDebug() << "HANDLE CUSTOM VALUE CONTENTS: " << data.toString();
|
|
||||||
} else if (record.resultClass == GdbResultError) {
|
|
||||||
// FIXME: Should not happen here, i.e. could be removed
|
|
||||||
QString msg = record.data.findChild("msg").data();
|
|
||||||
//qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg;
|
|
||||||
if (msg.startsWith("The program being debugged was sig"))
|
|
||||||
msg = strNotInScope;
|
|
||||||
if (msg.startsWith("The program being debugged stopped while"))
|
|
||||||
msg = strNotInScope;
|
|
||||||
data.setError(msg);
|
|
||||||
insertData(data);
|
|
||||||
} else {
|
|
||||||
qDebug() << "STRANGE CUSTOM DUMPER RESULT DATA: " << data.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbEngine::updateLocals()
|
void GdbEngine::updateLocals()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user