Commit 78b1b042 authored by hjk's avatar hjk Committed by hjk

debugger: replace artificial "{console,log}streamoutput" member in GdbMi

Use proper QByteArray member in GdbResponse instead. Less magic, and
does not break array-style reponses where all children are assumed to
be of the same "type".

Change-Id: Ief1efdeb0412f59836e1b2d6f4cb751ddef3216e
Reviewed-on: http://codereview.qt.nokia.com/1184Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@nokia.com>
parent 1070da91
......@@ -120,7 +120,7 @@ void AbstractPlainGdbAdapter::handleInfoTarget(const GdbResponse &response)
// [some leading stdout here]
// >&" Entry point: 0x80831f0 0x08048134 - 0x08048147 is .interp\n"
// [some trailing stdout here]
QString msg = _(response.data.findChild("consolestreamoutput").data());
QString msg = _(response.consoleStreamOutput);
QRegExp needle(_("\\bEntry point: 0x([0-9a-f]+)\\b"));
if (needle.indexIn(msg) != -1) {
m_engine->m_entryPoint =
......
......@@ -676,8 +676,7 @@ static bool isAccessSpecifier(const QByteArray &ba)
// reads a MI-encoded item frome the consolestream
static bool parseConsoleStream(const GdbResponse &response, GdbMi *contents)
{
GdbMi output = response.data.findChild("consolestreamoutput");
QByteArray out = output.data();
QByteArray out = response.consoleStreamOutput;
int markerPos = out.indexOf('"') + 1; // position of 'success marker'
if (markerPos == 0 || out.at(markerPos) == 'f') { // 't' or 'f'
......@@ -1016,7 +1015,7 @@ void GdbEngine::handleDebuggingHelperValue3Classic(const GdbResponse &response)
{
if (response.resultClass == GdbResultDone) {
WatchData data = response.cookie.value<WatchData>();
QByteArray out = response.data.findChild("consolestreamoutput").data();
QByteArray out = response.consoleStreamOutput;
while (out.endsWith(' ') || out.endsWith('\n'))
out.chop(1);
QList<QByteArray> list = out.split(' ');
......
......@@ -124,16 +124,16 @@ void CoreGdbAdapter::handleTemporaryTargetCore(const GdbResponse &response)
return;
}
GdbMi console = response.data.findChild("consolestreamoutput");
int pos1 = console.data().indexOf('`');
int pos2 = console.data().indexOf('\'');
QByteArray console = response.consoleStreamOutput;
int pos1 = console.indexOf('`');
int pos2 = console.indexOf('\'');
if (pos1 == -1 || pos2 == -1) {
showMessage(tr("Attach to core failed."), StatusBar);
m_engine->notifyEngineSetupFailed();
return;
}
m_executable = console.data().mid(pos1 + 1, pos2 - pos1 - 1);
m_executable = console.mid(pos1 + 1, pos2 - pos1 - 1);
// Strip off command line arguments. FIXME: make robust.
int idx = m_executable.indexOf(_c(' '));
if (idx >= 0)
......
This diff is collapsed.
......@@ -568,9 +568,9 @@ private: ////////// View & Data Stuff //////////
//void handleFetchDisassemblerByMiRangePlain(const GdbResponse &response);
void handleDisassemblerCheck(const GdbResponse &response);
void handleBreakOnQFatal(const GdbResponse &response);
DisassemblerLines parseDisassembler(const GdbMi &data);
DisassemblerLines parseCliDisassembler(const GdbMi &lines);
DisassemblerLines parseMiDisassembler(const GdbMi &lines);
DisassemblerLines parseDisassembler(const GdbResponse &response);
DisassemblerLines parseCliDisassembler(const QByteArray &response);
DisassemblerLines parseMiDisassembler(const GdbMi &response);
bool m_disassembleUsesComma;
......
......@@ -228,19 +228,6 @@ void GdbMi::parseList(const char *&from, const char *to)
}
}
void GdbMi::setStreamOutput(const QByteArray &name, const QByteArray &content)
{
if (content.isEmpty())
return;
GdbMi child;
child.m_type = Const;
child.m_name = name;
child.m_data = content;
m_children += child;
if (m_type == Invalid)
m_type = Tuple;
}
static QByteArray ind(int indent)
{
return QByteArray(2 * indent, ' ');
......
......@@ -130,7 +130,6 @@ public:
qulonglong toAddress() const;
void fromString(const QByteArray &str);
void fromStringMultiple(const QByteArray &str);
void setStreamOutput(const QByteArray &name, const QByteArray &content);
private:
friend class GdbResponse;
......@@ -170,6 +169,8 @@ public:
GdbResultClass resultClass;
GdbMi data;
QVariant cookie;
QByteArray logStreamOutput;
QByteArray consoleStreamOutput;
};
void extractGdbVersion(const QString &msg,
......
......@@ -135,7 +135,7 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
PRECONDITION;
if (response.resultClass == GdbResultDone) {
const bool partial = response.cookie.toBool();
QByteArray out = response.data.findChild("consolestreamoutput").data();
QByteArray out = response.consoleStreamOutput;
while (out.endsWith(' ') || out.endsWith('\n'))
out.chop(1);
int pos = out.indexOf("data=");
......
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