Commit d42a7e40 authored by hjk's avatar hjk
Browse files

debugger: small fixes for the gdb macro based QString and QStringList dumpers

parent 6200d188
...@@ -103,14 +103,13 @@ static inline QString _(const QByteArray &ba) ...@@ -103,14 +103,13 @@ static inline QString _(const QByteArray &ba)
return QString::fromLatin1(ba.data(), ba.size()); return QString::fromLatin1(ba.data(), ba.size());
} }
static const QString tooltipIName = _("tooltip");
static int &currentToken() static int &currentToken()
{ {
static int token = 0; static int token = 0;
return token; return token;
} }
static const QString tooltipIName = _("tooltip");
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// //
...@@ -154,6 +153,10 @@ void GdbEngine::initializeConnections() ...@@ -154,6 +153,10 @@ void GdbEngine::initializeConnections()
connect(&m_uploadProc, SIGNAL(error(QProcess::ProcessError)), connect(&m_uploadProc, SIGNAL(error(QProcess::ProcessError)),
this, SLOT(uploadProcError(QProcess::ProcessError))); this, SLOT(uploadProcError(QProcess::ProcessError)));
connect(&m_uploadProc, SIGNAL(readyReadStandardOutput()),
this, SLOT(readUploadStandardOutput()));
connect(&m_uploadProc, SIGNAL(readyReadStandardError()),
this, SLOT(readUploadStandardError()));
// Output // Output
connect(&m_outputCollector, SIGNAL(byteDelivery(QByteArray)), connect(&m_outputCollector, SIGNAL(byteDelivery(QByteArray)),
...@@ -273,6 +276,18 @@ void GdbEngine::uploadProcError(QProcess::ProcessError error) ...@@ -273,6 +276,18 @@ void GdbEngine::uploadProcError(QProcess::ProcessError error)
QMessageBox::critical(q->mainWindow(), tr("Error"), msg); QMessageBox::critical(q->mainWindow(), tr("Error"), msg);
} }
void GdbEngine::readUploadStandardOutput()
{
QByteArray ba = m_uploadProc.readAllStandardOutput();
gdbOutputAvailable(_("upload-out:"), QString::fromLocal8Bit(ba, ba.length()));
}
void GdbEngine::readUploadStandardError()
{
QByteArray ba = m_uploadProc.readAllStandardError();
gdbOutputAvailable(_("upload-err:"), QString::fromLocal8Bit(ba, ba.length()));
}
#if 0 #if 0
static void dump(const char *first, const char *middle, const QString & to) static void dump(const char *first, const char *middle, const QString & to)
{ {
...@@ -2751,6 +2766,7 @@ void GdbEngine::setToolTipExpression(const QPoint &pos, const QString &exp0) ...@@ -2751,6 +2766,7 @@ void GdbEngine::setToolTipExpression(const QPoint &pos, const QString &exp0)
static const QString strNotInScope = static const QString strNotInScope =
QApplication::translate("Debugger::Internal::GdbEngine", "<not in scope>"); QApplication::translate("Debugger::Internal::GdbEngine", "<not in scope>");
static void setWatchDataValue(WatchData &data, const GdbMi &mi, static void setWatchDataValue(WatchData &data, const GdbMi &mi,
int encoding = 0) int encoding = 0)
{ {
...@@ -2939,8 +2955,8 @@ void GdbEngine::updateSubItem(const WatchData &data0) ...@@ -2939,8 +2955,8 @@ void GdbEngine::updateSubItem(const WatchData &data0)
qDebug() << "FIXME: GdbEngine::updateSubItem:" qDebug() << "FIXME: GdbEngine::updateSubItem:"
<< data.toString() << "should not happen"; << data.toString() << "should not happen";
#else #else
data.setType("<out of scope>"); data.setType(strNotInScope);
data.setValue("<out of scope>"); data.setValue(strNotInScope);
data.setChildCount(0); data.setChildCount(0);
insertData(data); insertData(data);
return; return;
...@@ -3434,14 +3450,15 @@ void GdbEngine::handleDebuggingHelperValue3(const GdbResultRecord &record, ...@@ -3434,14 +3450,15 @@ void GdbEngine::handleDebuggingHelperValue3(const GdbResultRecord &record,
// << " STREAM:" << out; // << " STREAM:" << out;
if (list.isEmpty()) { if (list.isEmpty()) {
//: Value for variable //: Value for variable
data.setValue(tr("<unavailable>")); data.setValue(strNotInScope);
data.setAllUnneeded(); data.setAllUnneeded();
insertData(data); insertData(data);
} else if (data.type == __("QString") } else if (data.type == __("QString")
|| data.type.endsWith(__("::QString"))) { || data.type.endsWith(__("::QString"))) {
QList<QByteArray> list = out.split(' '); QList<QByteArray> list = out.split(' ');
QString str; QString str;
for (int i = 0; i < list.size(); ++i) int l = out.isEmpty() ? 0 : list.size();
for (int i = 0; i < l; ++i)
str.append(list.at(i).toInt()); str.append(list.at(i).toInt());
data.setValue(_c('"') + str + _c('"')); data.setValue(_c('"') + str + _c('"'));
data.setChildCount(0); data.setChildCount(0);
...@@ -3449,6 +3466,12 @@ void GdbEngine::handleDebuggingHelperValue3(const GdbResultRecord &record, ...@@ -3449,6 +3466,12 @@ void GdbEngine::handleDebuggingHelperValue3(const GdbResultRecord &record,
insertData(data); insertData(data);
} else if (data.type == __("QStringList") } else if (data.type == __("QStringList")
|| data.type.endsWith(__("::QStringList"))) { || data.type.endsWith(__("::QStringList"))) {
if (out.isEmpty()) {
data.setValue(tr("<0 items>"));
data.setChildCount(0);
data.setAllUnneeded();
insertData(data);
} else {
int l = list.size(); int l = list.size();
//: In string list //: In string list
data.setValue(tr("<%1 items>").arg(l)); data.setValue(tr("<%1 items>").arg(l));
...@@ -3469,15 +3492,16 @@ void GdbEngine::handleDebuggingHelperValue3(const GdbResultRecord &record, ...@@ -3469,15 +3492,16 @@ void GdbEngine::handleDebuggingHelperValue3(const GdbResultRecord &record,
var.setValue(data1); var.setValue(data1);
postCommand(cmd, WatchUpdate, CB(handleDebuggingHelperValue3), var); postCommand(cmd, WatchUpdate, CB(handleDebuggingHelperValue3), var);
} }
}
} else { } else {
//: Value for variable //: Value for variable
data.setValue(tr("<unavailable>")); data.setValue(strNotInScope);
data.setAllUnneeded(); data.setAllUnneeded();
insertData(data); insertData(data);
} }
} else if (record.resultClass == GdbResultError) { } else if (record.resultClass == GdbResultError) {
WatchData data = cookie.value<WatchData>(); WatchData data = cookie.value<WatchData>();
data.setValue(tr("<unavailable>")); data.setValue(strNotInScope);
data.setAllUnneeded(); data.setAllUnneeded();
insertData(data); insertData(data);
} }
......
...@@ -189,6 +189,8 @@ private slots: ...@@ -189,6 +189,8 @@ private slots:
void gdbProcError(QProcess::ProcessError error); void gdbProcError(QProcess::ProcessError error);
void readGdbStandardOutput(); void readGdbStandardOutput();
void readGdbStandardError(); void readGdbStandardError();
void readUploadStandardOutput();
void readUploadStandardError();
void readDebugeeOutput(const QByteArray &data); void readDebugeeOutput(const QByteArray &data);
void stubStarted(); void stubStarted();
void stubError(const QString &msg); void stubError(const QString &msg);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment