forked from qt-creator/qt-creator
Debugger: Privatize GdbMi::m_children
Change-Id: I6e51290c4521be40f516a452f32bdc82a4c051e6 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -296,7 +296,7 @@ void BreakpointParameters::updateFromGdbOutput(const GdbMi &bkpt)
|
|||||||
enabled = true;
|
enabled = true;
|
||||||
pending = false;
|
pending = false;
|
||||||
condition.clear();
|
condition.clear();
|
||||||
for (const GdbMi &child : bkpt.children()) {
|
for (const GdbMi &child : bkpt) {
|
||||||
if (child.hasName("number")) {
|
if (child.hasName("number")) {
|
||||||
// Handled on caller side.
|
// Handled on caller side.
|
||||||
} else if (child.hasName("func")) {
|
} else if (child.hasName("func")) {
|
||||||
|
|||||||
@@ -1321,8 +1321,7 @@ void CdbEngine::showScriptMessages(const QString &message) const
|
|||||||
gdmiMessage.fromString(message);
|
gdmiMessage.fromString(message);
|
||||||
if (!gdmiMessage.isValid())
|
if (!gdmiMessage.isValid())
|
||||||
showMessage(message, LogMisc);
|
showMessage(message, LogMisc);
|
||||||
const GdbMi &messages = gdmiMessage["msg"];
|
for (const GdbMi &msg : gdmiMessage["msg"]) {
|
||||||
for (const GdbMi &msg : messages.children()) {
|
|
||||||
if (msg.name() == "bridgemessage")
|
if (msg.name() == "bridgemessage")
|
||||||
showMessage(msg["msg"].data(), LogMisc);
|
showMessage(msg["msg"].data(), LogMisc);
|
||||||
else
|
else
|
||||||
@@ -1529,7 +1528,7 @@ void CdbEngine::handleModules(const DebuggerResponse &response)
|
|||||||
if (response.data.type() == GdbMi::List) {
|
if (response.data.type() == GdbMi::List) {
|
||||||
ModulesHandler *handler = modulesHandler();
|
ModulesHandler *handler = modulesHandler();
|
||||||
handler->beginUpdateAll();
|
handler->beginUpdateAll();
|
||||||
foreach (const GdbMi &gdbmiModule, response.data.children()) {
|
for (const GdbMi &gdbmiModule : response.data) {
|
||||||
Module module;
|
Module module;
|
||||||
module.moduleName = gdbmiModule["name"].data();
|
module.moduleName = gdbmiModule["name"].data();
|
||||||
module.modulePath = gdbmiModule["image"].data();
|
module.modulePath = gdbmiModule["image"].data();
|
||||||
@@ -1555,7 +1554,7 @@ void CdbEngine::handleRegistersExt(const DebuggerResponse &response)
|
|||||||
if (response.resultClass == ResultDone) {
|
if (response.resultClass == ResultDone) {
|
||||||
if (response.data.type() == GdbMi::List) {
|
if (response.data.type() == GdbMi::List) {
|
||||||
RegisterHandler *handler = registerHandler();
|
RegisterHandler *handler = registerHandler();
|
||||||
foreach (const GdbMi &item, response.data.children()) {
|
for (const GdbMi &item : response.data) {
|
||||||
Register reg;
|
Register reg;
|
||||||
reg.name = item["name"].data();
|
reg.name = item["name"].data();
|
||||||
reg.description = item["description"].data();
|
reg.description = item["description"].data();
|
||||||
@@ -1593,8 +1592,8 @@ void CdbEngine::handleLocals(const DebuggerResponse &response, bool partialUpdat
|
|||||||
partial.m_data = QString::number(partialUpdate ? 1 : 0);
|
partial.m_data = QString::number(partialUpdate ? 1 : 0);
|
||||||
|
|
||||||
GdbMi all;
|
GdbMi all;
|
||||||
all.m_children.push_back(response.data);
|
all.addChild(response.data);
|
||||||
all.m_children.push_back(partial);
|
all.addChild(partial);
|
||||||
updateLocalsView(all);
|
updateLocalsView(all);
|
||||||
} else {
|
} else {
|
||||||
showMessage(response.data["msg"].data(), LogWarning);
|
showMessage(response.data["msg"].data(), LogWarning);
|
||||||
@@ -2141,7 +2140,7 @@ void CdbEngine::handleExtensionMessage(char t, int token, const QString &what, c
|
|||||||
msg.m_data = message;
|
msg.m_data = message;
|
||||||
msg.m_type = GdbMi::Tuple;
|
msg.m_type = GdbMi::Tuple;
|
||||||
response.data.m_type = GdbMi::Tuple;
|
response.data.m_type = GdbMi::Tuple;
|
||||||
response.data.m_children.push_back(msg);
|
response.data.addChild(msg);
|
||||||
}
|
}
|
||||||
command.callback(response);
|
command.callback(response);
|
||||||
return;
|
return;
|
||||||
@@ -2899,7 +2898,7 @@ void CdbEngine::handleBreakPoints(const DebuggerResponse &response)
|
|||||||
QString message;
|
QString message;
|
||||||
QTextStream str(&message);
|
QTextStream str(&message);
|
||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
foreach (const GdbMi &breakPointG, response.data.children()) {
|
for (const GdbMi &breakPointG : response.data) {
|
||||||
// Might not be valid if there is not id
|
// Might not be valid if there is not id
|
||||||
const QString responseId = breakPointG["id"].data();
|
const QString responseId = breakPointG["id"].data();
|
||||||
BreakpointParameters reportedResponse;
|
BreakpointParameters reportedResponse;
|
||||||
|
|||||||
@@ -267,15 +267,19 @@ static QString ind(int indent)
|
|||||||
|
|
||||||
void GdbMi::dumpChildren(QString * str, bool multiline, int indent) const
|
void GdbMi::dumpChildren(QString * str, bool multiline, int indent) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_children.size(); ++i) {
|
bool first = true;
|
||||||
if (i != 0) {
|
for (const GdbMi &child : *this) {
|
||||||
|
if (first) {
|
||||||
|
first = false;
|
||||||
|
} else {
|
||||||
*str += ',';
|
*str += ',';
|
||||||
if (multiline)
|
if (multiline)
|
||||||
*str += '\n';
|
*str += '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (multiline)
|
if (multiline)
|
||||||
*str += ind(indent);
|
*str += ind(indent);
|
||||||
*str += m_children.at(i).toString(multiline, indent);
|
*str += child.toString(multiline, indent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,9 +375,9 @@ void GdbMi::fromStringMultiple(const QString &ba)
|
|||||||
const GdbMi &GdbMi::operator[](const char *name) const
|
const GdbMi &GdbMi::operator[](const char *name) const
|
||||||
{
|
{
|
||||||
static GdbMi empty;
|
static GdbMi empty;
|
||||||
for (int i = 0, n = int(m_children.size()); i < n; ++i)
|
for (const GdbMi &child : *this)
|
||||||
if (m_children.at(i).m_name == QLatin1String(name))
|
if (child.m_name == QLatin1String(name))
|
||||||
return m_children.at(i);
|
return child;
|
||||||
return empty;
|
return empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,12 +131,13 @@ public:
|
|||||||
|
|
||||||
QString m_name;
|
QString m_name;
|
||||||
QString m_data;
|
QString m_data;
|
||||||
QVector<GdbMi> m_children;
|
|
||||||
|
|
||||||
|
using Children = QVector<GdbMi>;
|
||||||
enum Type { Invalid, Const, Tuple, List };
|
enum Type { Invalid, Const, Tuple, List };
|
||||||
|
|
||||||
Type m_type = Invalid;
|
Type m_type = Invalid;
|
||||||
|
|
||||||
|
void addChild(const GdbMi &child) { m_children.push_back(child); }
|
||||||
|
|
||||||
Type type() const { return m_type; }
|
Type type() const { return m_type; }
|
||||||
const QString &name() const { return m_name; }
|
const QString &name() const { return m_name; }
|
||||||
bool hasName(const QString &name) const { return m_name == name; }
|
bool hasName(const QString &name) const { return m_name == name; }
|
||||||
@@ -145,7 +146,8 @@ public:
|
|||||||
bool isList() const { return m_type == List; }
|
bool isList() const { return m_type == List; }
|
||||||
|
|
||||||
const QString &data() const { return m_data; }
|
const QString &data() const { return m_data; }
|
||||||
const QVector<GdbMi> &children() const { return m_children; }
|
Children::const_iterator begin() const { return m_children.begin(); }
|
||||||
|
Children::const_iterator end() const { return m_children.end(); }
|
||||||
int childCount() const { return int(m_children.size()); }
|
int childCount() const { return int(m_children.size()); }
|
||||||
|
|
||||||
const GdbMi &childAt(int index) const { return m_children[index]; }
|
const GdbMi &childAt(int index) const { return m_children[index]; }
|
||||||
@@ -169,6 +171,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void dumpChildren(QString *str, bool multiline, int indent) const;
|
void dumpChildren(QString *str, bool multiline, int indent) const;
|
||||||
|
Children m_children;
|
||||||
};
|
};
|
||||||
|
|
||||||
QString fromHex(const QString &str);
|
QString fromHex(const QString &str);
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ void GdbEngine::handleResponse(const QString &buff)
|
|||||||
data.parseResultOrValue(from, to);
|
data.parseResultOrValue(from, to);
|
||||||
if (data.isValid()) {
|
if (data.isValid()) {
|
||||||
//qDebug() << "parsed result:" << data.toString();
|
//qDebug() << "parsed result:" << data.toString();
|
||||||
result.m_children.push_back(data);
|
result.addChild(data);
|
||||||
result.m_type = GdbMi::Tuple;
|
result.m_type = GdbMi::Tuple;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -566,7 +566,7 @@ void GdbEngine::handleAsyncOutput(const QString &asyncClass, const GdbMi &result
|
|||||||
res.fromString(ba);
|
res.fromString(ba);
|
||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
Breakpoint bp;
|
Breakpoint bp;
|
||||||
for (const GdbMi &bkpt : res.children()) {
|
for (const GdbMi &bkpt : res) {
|
||||||
const QString nr = bkpt["number"].data();
|
const QString nr = bkpt["number"].data();
|
||||||
if (nr.contains('.')) {
|
if (nr.contains('.')) {
|
||||||
// A sub-breakpoint.
|
// A sub-breakpoint.
|
||||||
@@ -590,7 +590,7 @@ void GdbEngine::handleAsyncOutput(const QString &asyncClass, const GdbMi &result
|
|||||||
// {bkpt={number="2",type="hw watchpoint",disp="keep",enabled="y",
|
// {bkpt={number="2",type="hw watchpoint",disp="keep",enabled="y",
|
||||||
// what="*0xbfffed48",times="0",original-location="*0xbfffed48"}}
|
// what="*0xbfffed48",times="0",original-location="*0xbfffed48"}}
|
||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
for (const GdbMi &bkpt : result.children()) {
|
for (const GdbMi &bkpt : result) {
|
||||||
const QString nr = bkpt["number"].data();
|
const QString nr = bkpt["number"].data();
|
||||||
BreakpointParameters br;
|
BreakpointParameters br;
|
||||||
br.type = BreakpointByFileAndLine;
|
br.type = BreakpointByFileAndLine;
|
||||||
@@ -1064,8 +1064,7 @@ void GdbEngine::handleQuerySources(const DebuggerResponse &response)
|
|||||||
m_fullToShortName.clear();
|
m_fullToShortName.clear();
|
||||||
// "^done,files=[{file="../../../../bin/dumper/dumper.cpp",
|
// "^done,files=[{file="../../../../bin/dumper/dumper.cpp",
|
||||||
// fullname="/data5/dev/ide/main/bin/dumper/dumper.cpp"},
|
// fullname="/data5/dev/ide/main/bin/dumper/dumper.cpp"},
|
||||||
GdbMi files = response.data["files"];
|
for (const GdbMi &item : response.data["files"]) {
|
||||||
for (const GdbMi &item : files.children()) {
|
|
||||||
GdbMi fileName = item["file"];
|
GdbMi fileName = item["file"];
|
||||||
if (fileName.data().endsWith("<built-in>"))
|
if (fileName.data().endsWith("<built-in>"))
|
||||||
continue;
|
continue;
|
||||||
@@ -2240,7 +2239,7 @@ void GdbEngine::handleBkpt(const GdbMi &bkpt, const Breakpoint &bp)
|
|||||||
// http://permalink.gmane.org/gmane.comp.gdb.patches/83936
|
// http://permalink.gmane.org/gmane.comp.gdb.patches/83936
|
||||||
const GdbMi locations = bkpt["locations"];
|
const GdbMi locations = bkpt["locations"];
|
||||||
if (locations.isValid()) {
|
if (locations.isValid()) {
|
||||||
for (const GdbMi &location : locations.children()) {
|
for (const GdbMi &location : locations) {
|
||||||
// A sub-breakpoint.
|
// A sub-breakpoint.
|
||||||
const QString subnr = location["number"].data();
|
const QString subnr = location["number"].data();
|
||||||
SubBreakpoint sub = bp->findOrCreateSubBreakpoint(subnr);
|
SubBreakpoint sub = bp->findOrCreateSubBreakpoint(subnr);
|
||||||
@@ -2276,7 +2275,7 @@ void GdbEngine::handleBreakInsert1(const DebuggerResponse &response, const Break
|
|||||||
// the "main" entry. Use the "main" entry to retrieve the
|
// the "main" entry. Use the "main" entry to retrieve the
|
||||||
// already known data from the BreakpointManager, and then
|
// already known data from the BreakpointManager, and then
|
||||||
// iterate over all items to update main- and sub-data.
|
// iterate over all items to update main- and sub-data.
|
||||||
for (const GdbMi &bkpt : response.data.children())
|
for (const GdbMi &bkpt : response.data)
|
||||||
handleBkpt(bkpt, bp);
|
handleBkpt(bkpt, bp);
|
||||||
if (bp->needsChange()) {
|
if (bp->needsChange()) {
|
||||||
bp->gotoState(BreakpointUpdateRequested, BreakpointInsertionProceeding);
|
bp->gotoState(BreakpointUpdateRequested, BreakpointInsertionProceeding);
|
||||||
@@ -2819,7 +2818,7 @@ void GdbEngine::handleModulesList(const DebuggerResponse &response)
|
|||||||
// state="Y",path="/usr/lib/dyld",description="/usr/lib/dyld",
|
// state="Y",path="/usr/lib/dyld",description="/usr/lib/dyld",
|
||||||
// loaded_addr="0x8fe00000",slide="0x0",prefix="__dyld_"},
|
// loaded_addr="0x8fe00000",slide="0x0",prefix="__dyld_"},
|
||||||
// shlib-info={...}...
|
// shlib-info={...}...
|
||||||
for (const GdbMi &item : response.data.children()) {
|
for (const GdbMi &item : response.data) {
|
||||||
module.modulePath = item["path"].data();
|
module.modulePath = item["path"].data();
|
||||||
module.moduleName = nameFromPath(module.modulePath);
|
module.moduleName = nameFromPath(module.modulePath);
|
||||||
module.symbolsRead = (item["state"].data() == "Y")
|
module.symbolsRead = (item["state"].data() == "Y")
|
||||||
@@ -2861,8 +2860,7 @@ void GdbEngine::reloadSourceFiles()
|
|||||||
m_fullToShortName.clear();
|
m_fullToShortName.clear();
|
||||||
// "^done,files=[{file="../../../../bin/dumper/dumper.cpp",
|
// "^done,files=[{file="../../../../bin/dumper/dumper.cpp",
|
||||||
// fullname="/data5/dev/ide/main/bin/dumper/dumper.cpp"},
|
// fullname="/data5/dev/ide/main/bin/dumper/dumper.cpp"},
|
||||||
GdbMi files = response.data["files"];
|
for (const GdbMi &item : response.data["files"]) {
|
||||||
for (const GdbMi &item : files.children()) {
|
|
||||||
GdbMi fileName = item["file"];
|
GdbMi fileName = item["file"];
|
||||||
if (fileName.data().endsWith("<built-in>"))
|
if (fileName.data().endsWith("<built-in>"))
|
||||||
continue;
|
continue;
|
||||||
@@ -3013,8 +3011,7 @@ void GdbEngine::handleThreadListIds(const DebuggerResponse &response)
|
|||||||
// "72^done,{thread-ids={thread-id="2",thread-id="1"},number-of-threads="2"}
|
// "72^done,{thread-ids={thread-id="2",thread-id="1"},number-of-threads="2"}
|
||||||
// In gdb 7.1+ additionally: current-thread-id="1"
|
// In gdb 7.1+ additionally: current-thread-id="1"
|
||||||
ThreadsHandler *handler = threadsHandler();
|
ThreadsHandler *handler = threadsHandler();
|
||||||
const QVector<GdbMi> &items = response.data["thread-ids"].children();
|
for (const GdbMi &item : response.data["thread-ids"]) {
|
||||||
for (const GdbMi &item : items) {
|
|
||||||
ThreadData thread;
|
ThreadData thread;
|
||||||
thread.id = item.data();
|
thread.id = item.data();
|
||||||
handler->updateThread(thread);
|
handler->updateThread(thread);
|
||||||
@@ -3028,7 +3025,7 @@ void GdbEngine::handleThreadNames(const DebuggerResponse &response)
|
|||||||
ThreadsHandler *handler = threadsHandler();
|
ThreadsHandler *handler = threadsHandler();
|
||||||
GdbMi names;
|
GdbMi names;
|
||||||
names.fromString(response.consoleStreamOutput);
|
names.fromString(response.consoleStreamOutput);
|
||||||
for (const GdbMi &name : names.children()) {
|
for (const GdbMi &name : names) {
|
||||||
ThreadData thread;
|
ThreadData thread;
|
||||||
thread.id = name["id"].data();
|
thread.id = name["id"].data();
|
||||||
// Core is unavailable in core dump. Allow the user to provide it.
|
// Core is unavailable in core dump. Allow the user to provide it.
|
||||||
@@ -3180,10 +3177,9 @@ void GdbEngine::handleRegisterListNames(const DebuggerResponse &response)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdbMi names = response.data["register-names"];
|
|
||||||
m_registers.clear();
|
m_registers.clear();
|
||||||
int gdbRegisterNumber = 0;
|
int gdbRegisterNumber = 0;
|
||||||
for (const GdbMi &item : names.children()) {
|
for (const GdbMi &item : response.data["register-names"]) {
|
||||||
if (!item.data().isEmpty()) {
|
if (!item.data().isEmpty()) {
|
||||||
Register reg;
|
Register reg;
|
||||||
reg.name = item.data();
|
reg.name = item.data();
|
||||||
@@ -3228,8 +3224,7 @@ void GdbEngine::handleRegisterListValues(const DebuggerResponse &response)
|
|||||||
|
|
||||||
RegisterHandler *handler = registerHandler();
|
RegisterHandler *handler = registerHandler();
|
||||||
// 24^done,register-values=[{number="0",value="0xf423f"},...]
|
// 24^done,register-values=[{number="0",value="0xf423f"},...]
|
||||||
const GdbMi values = response.data["register-values"];
|
for (const GdbMi &item : response.data["register-values"]) {
|
||||||
for (const GdbMi &item : values.children()) {
|
|
||||||
const int number = item["number"].toInt();
|
const int number = item["number"].toInt();
|
||||||
Register reg = m_registers[number];
|
Register reg = m_registers[number];
|
||||||
QString data = item["value"].data();
|
QString data = item["value"].data();
|
||||||
@@ -3364,18 +3359,18 @@ void GdbEngine::handleFetchMemory(const DebuggerResponse &response, MemoryAgentC
|
|||||||
QTC_ASSERT(ac.agent, return);
|
QTC_ASSERT(ac.agent, return);
|
||||||
if (response.resultClass == ResultDone) {
|
if (response.resultClass == ResultDone) {
|
||||||
GdbMi memory = response.data["memory"];
|
GdbMi memory = response.data["memory"];
|
||||||
QTC_ASSERT(memory.children().size() <= 1, return);
|
QTC_ASSERT(memory.childCount() <= 1, return);
|
||||||
if (memory.children().empty())
|
if (memory.childCount() == 0)
|
||||||
return;
|
return;
|
||||||
GdbMi memory0 = memory.children().at(0); // we asked for only one 'row'
|
GdbMi memory0 = memory.childAt(0); // we asked for only one 'row'
|
||||||
GdbMi data = memory0["data"];
|
GdbMi data = memory0["data"];
|
||||||
for (int i = 0, n = int(data.children().size()); i != n; ++i) {
|
int i = 0;
|
||||||
const GdbMi &child = data.children().at(i);
|
for (const GdbMi &child : data) {
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
unsigned char c = '?';
|
unsigned char c = '?';
|
||||||
c = child.data().toUInt(&ok, 0);
|
c = child.data().toUInt(&ok, 0);
|
||||||
QTC_ASSERT(ok, return);
|
QTC_ASSERT(ok, return);
|
||||||
(*ac.accumulator)[ac.offset + i] = c;
|
(*ac.accumulator)[ac.offset + i++] = c;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// We have an error
|
// We have an error
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ void LldbEngine::handleResponse(const QString &response)
|
|||||||
GdbMi all;
|
GdbMi all;
|
||||||
all.fromStringMultiple(response);
|
all.fromStringMultiple(response);
|
||||||
|
|
||||||
foreach (const GdbMi &item, all.children()) {
|
for (const GdbMi &item : all) {
|
||||||
const QString name = item.name();
|
const QString name = item.name();
|
||||||
if (name == "result") {
|
if (name == "result") {
|
||||||
QString msg = item["status"].data();
|
QString msg = item["status"].data();
|
||||||
@@ -557,9 +557,9 @@ void LldbEngine::updateBreakpointData(const Breakpoint &bp, const GdbMi &bkpt, b
|
|||||||
bp->setLineNumber(bkpt["line"].toInt());
|
bp->setLineNumber(bkpt["line"].toInt());
|
||||||
|
|
||||||
GdbMi locations = bkpt["locations"];
|
GdbMi locations = bkpt["locations"];
|
||||||
const int numChild = int(locations.children().size());
|
const int numChild = locations.childCount();
|
||||||
if (numChild > 1) {
|
if (numChild > 1) {
|
||||||
for (const GdbMi &location : locations.children()) {
|
for (const GdbMi &location : locations) {
|
||||||
const QString locid = QString("%1.%2").arg(rid).arg(location["locid"].data());
|
const QString locid = QString("%1.%2").arg(rid).arg(location["locid"].data());
|
||||||
SubBreakpoint loc = bp->findOrCreateSubBreakpoint(locid);
|
SubBreakpoint loc = bp->findOrCreateSubBreakpoint(locid);
|
||||||
QTC_ASSERT(loc, continue);
|
QTC_ASSERT(loc, continue);
|
||||||
@@ -614,7 +614,7 @@ void LldbEngine::reloadModules()
|
|||||||
const GdbMi &modules = response.data["modules"];
|
const GdbMi &modules = response.data["modules"];
|
||||||
ModulesHandler *handler = modulesHandler();
|
ModulesHandler *handler = modulesHandler();
|
||||||
handler->beginUpdateAll();
|
handler->beginUpdateAll();
|
||||||
for (const GdbMi &item : modules.children()) {
|
for (const GdbMi &item : modules) {
|
||||||
Module module;
|
Module module;
|
||||||
module.modulePath = item["file"].data();
|
module.modulePath = item["file"].data();
|
||||||
module.moduleName = item["name"].data();
|
module.moduleName = item["name"].data();
|
||||||
@@ -636,7 +636,7 @@ void LldbEngine::requestModuleSymbols(const QString &moduleName)
|
|||||||
const GdbMi &symbols = response.data["symbols"];
|
const GdbMi &symbols = response.data["symbols"];
|
||||||
QString moduleName = response.data["module"].data();
|
QString moduleName = response.data["module"].data();
|
||||||
Symbols syms;
|
Symbols syms;
|
||||||
for (const GdbMi &item : symbols.children()) {
|
for (const GdbMi &item : symbols) {
|
||||||
Symbol symbol;
|
Symbol symbol;
|
||||||
symbol.address = item["address"].data();
|
symbol.address = item["address"].data();
|
||||||
symbol.name = item["name"].data();
|
symbol.name = item["name"].data();
|
||||||
@@ -914,8 +914,7 @@ void LldbEngine::reloadRegisters()
|
|||||||
DebuggerCommand cmd("fetchRegisters");
|
DebuggerCommand cmd("fetchRegisters");
|
||||||
cmd.callback = [this](const DebuggerResponse &response) {
|
cmd.callback = [this](const DebuggerResponse &response) {
|
||||||
RegisterHandler *handler = registerHandler();
|
RegisterHandler *handler = registerHandler();
|
||||||
GdbMi regs = response.data["registers"];
|
for (const GdbMi &item : response.data["registers"]) {
|
||||||
for (const GdbMi &item : regs.children()) {
|
|
||||||
Register reg;
|
Register reg;
|
||||||
reg.name = item["name"].data();
|
reg.name = item["name"].data();
|
||||||
reg.value.fromString(item["value"].data(), HexadecimalFormat);
|
reg.value.fromString(item["value"].data(), HexadecimalFormat);
|
||||||
@@ -953,7 +952,7 @@ void LldbEngine::fetchDisassembler(DisassemblerAgent *agent)
|
|||||||
DisassemblerLines result;
|
DisassemblerLines result;
|
||||||
QPointer<DisassemblerAgent> agent = m_disassemblerAgents.key(id);
|
QPointer<DisassemblerAgent> agent = m_disassemblerAgents.key(id);
|
||||||
if (!agent.isNull()) {
|
if (!agent.isNull()) {
|
||||||
for (const GdbMi &line : response.data["lines"].children()) {
|
for (const GdbMi &line : response.data["lines"]) {
|
||||||
DisassemblerLine dl;
|
DisassemblerLine dl;
|
||||||
dl.address = line["address"].toAddress();
|
dl.address = line["address"].toAddress();
|
||||||
//dl.data = line["data"].data();
|
//dl.data = line["data"].data();
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ void PdbEngine::refreshModules(const GdbMi &modules)
|
|||||||
{
|
{
|
||||||
ModulesHandler *handler = modulesHandler();
|
ModulesHandler *handler = modulesHandler();
|
||||||
handler->beginUpdateAll();
|
handler->beginUpdateAll();
|
||||||
for (const GdbMi &item : modules.children()) {
|
for (const GdbMi &item : modules) {
|
||||||
Module module;
|
Module module;
|
||||||
module.moduleName = item["name"].data();
|
module.moduleName = item["name"].data();
|
||||||
QString path = item["value"].data();
|
QString path = item["value"].data();
|
||||||
@@ -358,7 +358,7 @@ void PdbEngine::refreshSymbols(const GdbMi &symbols)
|
|||||||
{
|
{
|
||||||
QString moduleName = symbols["module"].data();
|
QString moduleName = symbols["module"].data();
|
||||||
Symbols syms;
|
Symbols syms;
|
||||||
for (const GdbMi &item : symbols["symbols"].children()) {
|
for (const GdbMi &item : symbols["symbols"]) {
|
||||||
Symbol symbol;
|
Symbol symbol;
|
||||||
symbol.name = item["name"].data();
|
symbol.name = item["name"].data();
|
||||||
syms.append(symbol);
|
syms.append(symbol);
|
||||||
@@ -524,7 +524,7 @@ void PdbEngine::refreshStack(const GdbMi &stack)
|
|||||||
{
|
{
|
||||||
StackHandler *handler = stackHandler();
|
StackHandler *handler = stackHandler();
|
||||||
StackFrames frames;
|
StackFrames frames;
|
||||||
for (const GdbMi &item : stack["frames"].children()) {
|
for (const GdbMi &item : stack["frames"]) {
|
||||||
StackFrame frame;
|
StackFrame frame;
|
||||||
frame.level = item["level"].data();
|
frame.level = item["level"].data();
|
||||||
frame.file = item["file"].data();
|
frame.file = item["file"].data();
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ QString StackFrame::toString() const
|
|||||||
QList<StackFrame> StackFrame::parseFrames(const GdbMi &data, const DebuggerRunParameters &rp)
|
QList<StackFrame> StackFrame::parseFrames(const GdbMi &data, const DebuggerRunParameters &rp)
|
||||||
{
|
{
|
||||||
StackFrames frames;
|
StackFrames frames;
|
||||||
frames.reserve(data.children().size());
|
frames.reserve(data.childCount());
|
||||||
for (const GdbMi &item : data.children())
|
for (const GdbMi &item : data)
|
||||||
frames.append(parseFrame(item, rp));
|
frames.append(parseFrame(item, rp));
|
||||||
return frames;
|
return frames;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -373,8 +373,8 @@ void ThreadsHandler::setThreads(const GdbMi &data)
|
|||||||
// file="/.../app.cpp",fullname="/../app.cpp",line="1175"},
|
// file="/.../app.cpp",fullname="/../app.cpp",line="1175"},
|
||||||
// state="stopped",core="0"}],current-thread-id="1"
|
// state="stopped",core="0"}],current-thread-id="1"
|
||||||
|
|
||||||
const QVector<GdbMi> &items = data["threads"].children();
|
const GdbMi &threads = data["threads"];
|
||||||
for (const GdbMi &item : items) {
|
for (const GdbMi &item : threads) {
|
||||||
const GdbMi &frame = item["frame"];
|
const GdbMi &frame = item["frame"];
|
||||||
ThreadData thread;
|
ThreadData thread;
|
||||||
thread.id = item["id"].data();
|
thread.id = item["id"].data();
|
||||||
@@ -395,7 +395,7 @@ void ThreadsHandler::setThreads(const GdbMi &data)
|
|||||||
const QString ¤tId = data["current-thread-id"].data();
|
const QString ¤tId = data["current-thread-id"].data();
|
||||||
m_currentThread = threadForId(currentId);
|
m_currentThread = threadForId(currentId);
|
||||||
|
|
||||||
if (!m_currentThread && !items.isEmpty())
|
if (!m_currentThread && threads.childCount() > 0)
|
||||||
m_currentThread = rootItem()->childAt(0);
|
m_currentThread = rootItem()->childAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -407,8 +407,9 @@ void WatchItem::parseHelper(const GdbMi &input, bool maySort)
|
|||||||
qulonglong addressBase = input["addrbase"].data().toULongLong(&ok, 0);
|
qulonglong addressBase = input["addrbase"].data().toULongLong(&ok, 0);
|
||||||
qulonglong addressStep = input["addrstep"].data().toULongLong(&ok, 0);
|
qulonglong addressStep = input["addrstep"].data().toULongLong(&ok, 0);
|
||||||
|
|
||||||
for (int i = 0, n = int(children.children().size()); i != n; ++i) {
|
int i = -1;
|
||||||
const GdbMi &subinput = children.children().at(i);
|
for (const GdbMi &subinput : children) {
|
||||||
|
++i;
|
||||||
auto child = new WatchItem;
|
auto child = new WatchItem;
|
||||||
if (childType.isValid())
|
if (childType.isValid())
|
||||||
child->type = childType.data();
|
child->type = childType.data();
|
||||||
|
|||||||
@@ -2007,7 +2007,7 @@ void WatchHandler::insertItems(const GdbMi &data)
|
|||||||
QSet<WatchItem *> itemsToSort;
|
QSet<WatchItem *> itemsToSort;
|
||||||
|
|
||||||
const bool sortStructMembers = boolSetting(SortStructMembers);
|
const bool sortStructMembers = boolSetting(SortStructMembers);
|
||||||
for (const GdbMi &child : data.children()) {
|
for (const GdbMi &child : data) {
|
||||||
auto item = new WatchItem;
|
auto item = new WatchItem;
|
||||||
item->parse(child, sortStructMembers);
|
item->parse(child, sortStructMembers);
|
||||||
const TypeInfo ti = m_model->m_reportedTypeInfo.value(item->type);
|
const TypeInfo ti = m_model->m_reportedTypeInfo.value(item->type);
|
||||||
@@ -2599,7 +2599,7 @@ void WatchHandler::appendWatchersAndTooltipRequests(DebuggerCommand *cmd)
|
|||||||
|
|
||||||
void WatchHandler::addDumpers(const GdbMi &dumpers)
|
void WatchHandler::addDumpers(const GdbMi &dumpers)
|
||||||
{
|
{
|
||||||
for (const GdbMi &dumper : dumpers.children()) {
|
for (const GdbMi &dumper : dumpers) {
|
||||||
DisplayFormats formats;
|
DisplayFormats formats;
|
||||||
formats.append(RawFormat);
|
formats.append(RawFormat);
|
||||||
QString reportedFormats = dumper["formats"].data();
|
QString reportedFormats = dumper["formats"].data();
|
||||||
@@ -2666,7 +2666,7 @@ QSet<QString> WatchHandler::expandedINames() const
|
|||||||
void WatchHandler::recordTypeInfo(const GdbMi &typeInfo)
|
void WatchHandler::recordTypeInfo(const GdbMi &typeInfo)
|
||||||
{
|
{
|
||||||
if (typeInfo.type() == GdbMi::List) {
|
if (typeInfo.type() == GdbMi::List) {
|
||||||
for (const GdbMi &s : typeInfo.children()) {
|
for (const GdbMi &s : typeInfo) {
|
||||||
QString typeName = fromHex(s["name"].data());
|
QString typeName = fromHex(s["name"].data());
|
||||||
TypeInfo ti(s["size"].data().toUInt());
|
TypeInfo ti(s["size"].data().toUInt());
|
||||||
m_model->m_reportedTypeInfo.insert(typeName, ti);
|
m_model->m_reportedTypeInfo.insert(typeName, ti);
|
||||||
|
|||||||
Reference in New Issue
Block a user