forked from qt-creator/qt-creator
Debugger: Replace GdbMi::findChild() with an operator[]
Less noise. Change-Id: I8e533c97207ff5b9c79182c4fb99993f1992154f Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -1821,14 +1821,14 @@ void CdbEngine::handlePid(const CdbExtensionCommandPtr &reply)
|
|||||||
static Register parseRegister(const GdbMi &gdbmiReg)
|
static Register parseRegister(const GdbMi &gdbmiReg)
|
||||||
{
|
{
|
||||||
Register reg;
|
Register reg;
|
||||||
reg.name = gdbmiReg.findChild("name").data();
|
reg.name = gdbmiReg["name"].data();
|
||||||
const GdbMi description = gdbmiReg.findChild("description");
|
const GdbMi description = gdbmiReg["description"];
|
||||||
if (description.type() != GdbMi::Invalid) {
|
if (description.type() != GdbMi::Invalid) {
|
||||||
reg.name += " (";
|
reg.name += " (";
|
||||||
reg.name += description.data();
|
reg.name += description.data();
|
||||||
reg.name += ')';
|
reg.name += ')';
|
||||||
}
|
}
|
||||||
reg.value = gdbmiReg.findChild("value").data();
|
reg.value = gdbmiReg["value"].data();
|
||||||
return reg;
|
return reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1842,11 +1842,11 @@ void CdbEngine::handleModules(const CdbExtensionCommandPtr &reply)
|
|||||||
modules.reserve(value.childCount());
|
modules.reserve(value.childCount());
|
||||||
foreach (const GdbMi &gdbmiModule, value.children()) {
|
foreach (const GdbMi &gdbmiModule, value.children()) {
|
||||||
Module module;
|
Module module;
|
||||||
module.moduleName = QString::fromLatin1(gdbmiModule.findChild("name").data());
|
module.moduleName = QString::fromLatin1(gdbmiModule["name"].data());
|
||||||
module.modulePath = QString::fromLatin1(gdbmiModule.findChild("image").data());
|
module.modulePath = QString::fromLatin1(gdbmiModule["image"].data());
|
||||||
module.startAddress = gdbmiModule.findChild("start").data().toULongLong(0, 0);
|
module.startAddress = gdbmiModule["start"].data().toULongLong(0, 0);
|
||||||
module.endAddress = gdbmiModule.findChild("end").data().toULongLong(0, 0);
|
module.endAddress = gdbmiModule["end"].data().toULongLong(0, 0);
|
||||||
if (gdbmiModule.findChild("deferred").type() == GdbMi::Invalid)
|
if (gdbmiModule["deferred"].type() == GdbMi::Invalid)
|
||||||
module.symbolsRead = Module::ReadOk;
|
module.symbolsRead = Module::ReadOk;
|
||||||
modules.push_back(module);
|
modules.push_back(module);
|
||||||
}
|
}
|
||||||
@@ -1902,8 +1902,8 @@ void CdbEngine::handleLocals(const CdbExtensionCommandPtr &reply)
|
|||||||
// Courtesy of GDB engine
|
// Courtesy of GDB engine
|
||||||
foreach (const GdbMi &child, root.children()) {
|
foreach (const GdbMi &child, root.children()) {
|
||||||
WatchData dummy;
|
WatchData dummy;
|
||||||
dummy.iname = child.findChild("iname").data();
|
dummy.iname = child["iname"].data();
|
||||||
dummy.name = QLatin1String(child.findChild("name").data());
|
dummy.name = QLatin1String(child["name"].data());
|
||||||
parseWatchData(watchHandler()->expandedINames(), dummy, child, &watchData);
|
parseWatchData(watchHandler()->expandedINames(), dummy, child, &watchData);
|
||||||
}
|
}
|
||||||
// Fix the names of watch data.
|
// Fix the names of watch data.
|
||||||
@@ -2023,7 +2023,7 @@ unsigned CdbEngine::examineStopReason(const GdbMi &stopReason,
|
|||||||
rc |= StopShutdownInProgress;
|
rc |= StopShutdownInProgress;
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug("%s", stopReason.toString(true, 4).constData());
|
qDebug("%s", stopReason.toString(true, 4).constData());
|
||||||
const QByteArray reason = stopReason.findChild("reason").data();
|
const QByteArray reason = stopReason["reason"].data();
|
||||||
if (reason.isEmpty()) {
|
if (reason.isEmpty()) {
|
||||||
*message = tr("Malformed stop response received.");
|
*message = tr("Malformed stop response received.");
|
||||||
rc |= StopReportParseError|StopNotifyStop;
|
rc |= StopReportParseError|StopNotifyStop;
|
||||||
@@ -2036,12 +2036,12 @@ unsigned CdbEngine::examineStopReason(const GdbMi &stopReason,
|
|||||||
rc |= StopReportLog;
|
rc |= StopReportLog;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
const int threadId = stopReason.findChild("threadId").data().toInt();
|
const int threadId = stopReason["threadId"].data().toInt();
|
||||||
if (reason == "breakpoint") {
|
if (reason == "breakpoint") {
|
||||||
// Note: Internal breakpoints (run to line) are reported with id=0.
|
// Note: Internal breakpoints (run to line) are reported with id=0.
|
||||||
// Step out creates temporary breakpoints with id 10000.
|
// Step out creates temporary breakpoints with id 10000.
|
||||||
int number = 0;
|
int number = 0;
|
||||||
BreakpointModelId id = cdbIdToBreakpointModelId(stopReason.findChild("breakpointId"));
|
BreakpointModelId id = cdbIdToBreakpointModelId(stopReason["breakpointId"]);
|
||||||
if (id.isValid()) {
|
if (id.isValid()) {
|
||||||
if (breakHandler()->engineBreakpointIds(this).contains(id)) {
|
if (breakHandler()->engineBreakpointIds(this).contains(id)) {
|
||||||
const BreakpointResponse parameters = breakHandler()->response(id);
|
const BreakpointResponse parameters = breakHandler()->response(id);
|
||||||
@@ -2211,7 +2211,7 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
|
|||||||
// Re-fetch stack again.
|
// Re-fetch stack again.
|
||||||
postCommandSequence(CommandListStack);
|
postCommandSequence(CommandListStack);
|
||||||
} else {
|
} else {
|
||||||
const GdbMi stack = stopReason.findChild("stack");
|
const GdbMi stack = stopReason["stack"];
|
||||||
if (stack.isValid()) {
|
if (stack.isValid()) {
|
||||||
switch (parseStackTrace(stack, sourceStepInto)) {
|
switch (parseStackTrace(stack, sourceStepInto)) {
|
||||||
case ParseStackStepInto: // Hit on a frame while step into, see parseStackTrace().
|
case ParseStackStepInto: // Hit on a frame while step into, see parseStackTrace().
|
||||||
@@ -2222,16 +2222,16 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showMessage(QString::fromLatin1(stopReason.findChild("stackerror").data()), LogError);
|
showMessage(QString::fromLatin1(stopReason["stackerror"].data()), LogError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const GdbMi threads = stopReason.findChild("threads");
|
const GdbMi threads = stopReason["threads"];
|
||||||
if (threads.isValid()) {
|
if (threads.isValid()) {
|
||||||
threadsHandler()->updateThreads(threads);
|
threadsHandler()->updateThreads(threads);
|
||||||
if (forcedThreadId.isValid())
|
if (forcedThreadId.isValid())
|
||||||
threadsHandler()->setCurrentThread(forcedThreadId);
|
threadsHandler()->setCurrentThread(forcedThreadId);
|
||||||
} else {
|
} else {
|
||||||
showMessage(QString::fromLatin1(stopReason.findChild("threaderror").data()), LogError);
|
showMessage(QString::fromLatin1(stopReason["threaderror"].data()), LogError);
|
||||||
}
|
}
|
||||||
// Fire off remaining commands asynchronously
|
// Fire off remaining commands asynchronously
|
||||||
if (!m_pendingBreakpointMap.isEmpty())
|
if (!m_pendingBreakpointMap.isEmpty())
|
||||||
@@ -2839,15 +2839,15 @@ static StackFrames parseFrames(const GdbMi &gdbmi, bool *incomplete = 0)
|
|||||||
}
|
}
|
||||||
StackFrame frame;
|
StackFrame frame;
|
||||||
frame.level = i;
|
frame.level = i;
|
||||||
const GdbMi fullName = frameMi.findChild("fullname");
|
const GdbMi fullName = frameMi["fullname"];
|
||||||
if (fullName.isValid()) {
|
if (fullName.isValid()) {
|
||||||
frame.file = QFile::decodeName(fullName.data());
|
frame.file = QFile::decodeName(fullName.data());
|
||||||
frame.line = frameMi.findChild("line").data().toInt();
|
frame.line = frameMi["line"].data().toInt();
|
||||||
frame.usable = false; // To be decided after source path mapping.
|
frame.usable = false; // To be decided after source path mapping.
|
||||||
}
|
}
|
||||||
frame.function = QLatin1String(frameMi.findChild("func").data());
|
frame.function = QLatin1String(frameMi["func"].data());
|
||||||
frame.from = QLatin1String(frameMi.findChild("from").data());
|
frame.from = QLatin1String(frameMi["from"].data());
|
||||||
frame.address = frameMi.findChild("addr").data().toULongLong(0, 16);
|
frame.address = frameMi["addr"].data().toULongLong(0, 16);
|
||||||
rc.push_back(frame);
|
rc.push_back(frame);
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ static inline bool parseThread(QByteArray line, ThreadData *thread, bool *curren
|
|||||||
// Helper to retrieve an int child from GDBMI
|
// Helper to retrieve an int child from GDBMI
|
||||||
static inline bool gdbmiChildToInt(const GdbMi &parent, const char *childName, int *target)
|
static inline bool gdbmiChildToInt(const GdbMi &parent, const char *childName, int *target)
|
||||||
{
|
{
|
||||||
const GdbMi childBA = parent.findChild(childName);
|
const GdbMi childBA = parent[childName];
|
||||||
if (childBA.isValid()) {
|
if (childBA.isValid()) {
|
||||||
bool ok;
|
bool ok;
|
||||||
const int v = childBA.data().toInt(&ok);
|
const int v = childBA.data().toInt(&ok);
|
||||||
@@ -313,7 +313,7 @@ static inline bool gdbmiChildToInt(const GdbMi &parent, const char *childName, i
|
|||||||
// Helper to retrieve an bool child from GDBMI
|
// Helper to retrieve an bool child from GDBMI
|
||||||
static inline bool gdbmiChildToBool(const GdbMi &parent, const char *childName, bool *target)
|
static inline bool gdbmiChildToBool(const GdbMi &parent, const char *childName, bool *target)
|
||||||
{
|
{
|
||||||
const GdbMi childBA = parent.findChild(childName);
|
const GdbMi childBA = parent[childName];
|
||||||
if (childBA.isValid()) {
|
if (childBA.isValid()) {
|
||||||
*target = childBA.data() == "true";
|
*target = childBA.data() == "true";
|
||||||
return true;
|
return true;
|
||||||
@@ -331,16 +331,16 @@ void parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r,
|
|||||||
gdbmiChildToBool(gdbmi, "deferred", &(r->pending));
|
gdbmiChildToBool(gdbmi, "deferred", &(r->pending));
|
||||||
r->id = BreakpointResponseId();
|
r->id = BreakpointResponseId();
|
||||||
// Might not be valid if there is not id
|
// Might not be valid if there is not id
|
||||||
r->id = cdbIdToBreakpointResponseId(gdbmi.findChild("id"));
|
r->id = cdbIdToBreakpointResponseId(gdbmi["id"]);
|
||||||
const GdbMi moduleG = gdbmi.findChild("module");
|
const GdbMi moduleG = gdbmi["module"];
|
||||||
if (moduleG.isValid())
|
if (moduleG.isValid())
|
||||||
r->module = QString::fromLocal8Bit(moduleG.data());
|
r->module = QString::fromLocal8Bit(moduleG.data());
|
||||||
if (expression) {
|
if (expression) {
|
||||||
const GdbMi expressionG = gdbmi.findChild("expression");
|
const GdbMi expressionG = gdbmi["expression"];
|
||||||
if (expressionG.isValid())
|
if (expressionG.isValid())
|
||||||
*expression = QString::fromLocal8Bit(expressionG.data());
|
*expression = QString::fromLocal8Bit(expressionG.data());
|
||||||
}
|
}
|
||||||
const GdbMi addressG = gdbmi.findChild("address");
|
const GdbMi addressG = gdbmi["address"];
|
||||||
if (addressG.isValid())
|
if (addressG.isValid())
|
||||||
r->address = addressG.data().toULongLong(0, 0);
|
r->address = addressG.data().toULongLong(0, 0);
|
||||||
if (gdbmiChildToInt(gdbmi, "passcount", &(r->ignoreCount)))
|
if (gdbmiChildToInt(gdbmi, "passcount", &(r->ignoreCount)))
|
||||||
@@ -410,23 +410,23 @@ WinException::WinException() :
|
|||||||
|
|
||||||
void WinException::fromGdbMI(const GdbMi &gdbmi)
|
void WinException::fromGdbMI(const GdbMi &gdbmi)
|
||||||
{
|
{
|
||||||
exceptionCode = gdbmi.findChild("exceptionCode").data().toUInt();
|
exceptionCode = gdbmi["exceptionCode"].data().toUInt();
|
||||||
exceptionFlags = gdbmi.findChild("exceptionFlags").data().toUInt();
|
exceptionFlags = gdbmi["exceptionFlags"].data().toUInt();
|
||||||
exceptionAddress = gdbmi.findChild("exceptionAddress").data().toULongLong();
|
exceptionAddress = gdbmi["exceptionAddress"].data().toULongLong();
|
||||||
firstChance = gdbmi.findChild("firstChance").data() != "0";
|
firstChance = gdbmi["firstChance"].data() != "0";
|
||||||
const GdbMi ginfo1 = gdbmi.findChild("exceptionInformation0");
|
const GdbMi ginfo1 = gdbmi["exceptionInformation0"];
|
||||||
if (ginfo1.isValid()) {
|
if (ginfo1.isValid()) {
|
||||||
info1 = ginfo1.data().toULongLong();
|
info1 = ginfo1.data().toULongLong();
|
||||||
const GdbMi ginfo2 = gdbmi.findChild("exceptionInformation1");
|
const GdbMi ginfo2 = gdbmi["exceptionInformation1"];
|
||||||
if (ginfo2.isValid())
|
if (ginfo2.isValid())
|
||||||
info2 = ginfo1.data().toULongLong();
|
info2 = ginfo1.data().toULongLong();
|
||||||
}
|
}
|
||||||
const GdbMi gLineNumber = gdbmi.findChild("exceptionLine");
|
const GdbMi gLineNumber = gdbmi["exceptionLine"];
|
||||||
if (gLineNumber.isValid()) {
|
if (gLineNumber.isValid()) {
|
||||||
lineNumber = gLineNumber.data().toInt();
|
lineNumber = gLineNumber.data().toInt();
|
||||||
file = gdbmi.findChild("exceptionFile").data();
|
file = gdbmi["exceptionFile"].data();
|
||||||
}
|
}
|
||||||
function = gdbmi.findChild("exceptionFunction").data();
|
function = gdbmi["exceptionFunction"].data();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString WinException::toString(bool includeLocation) const
|
QString WinException::toString(bool includeLocation) const
|
||||||
|
|||||||
@@ -331,9 +331,9 @@ void GdbMi::fromStringMultiple(const QByteArray &ba)
|
|||||||
parseTuple_helper(from, to);
|
parseTuple_helper(from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
GdbMi GdbMi::findChild(const char *name) const
|
GdbMi GdbMi::operator[](const char *name) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_children.size(); ++i)
|
for (int i = 0, n = m_children.size(); i < n; ++i)
|
||||||
if (m_children.at(i).m_name == name)
|
if (m_children.at(i).m_name == name)
|
||||||
return m_children.at(i);
|
return m_children.at(i);
|
||||||
return GdbMi();
|
return GdbMi();
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public:
|
|||||||
|
|
||||||
const GdbMi &childAt(int index) const { return m_children[index]; }
|
const GdbMi &childAt(int index) const { return m_children[index]; }
|
||||||
GdbMi &childAt(int index) { return m_children[index]; }
|
GdbMi &childAt(int index) { return m_children[index]; }
|
||||||
GdbMi findChild(const char *name) const;
|
GdbMi operator[](const char *name) const;
|
||||||
|
|
||||||
QByteArray toString(bool multiline = false, int indent = 0) const;
|
QByteArray toString(bool multiline = false, int indent = 0) const;
|
||||||
qulonglong toAddress() const;
|
qulonglong toAddress() const;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ void GdbAbstractPlainEngine::handleFileExecAndSymbols(const GdbResponse &respons
|
|||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
handleInferiorPrepared();
|
handleInferiorPrepared();
|
||||||
} else {
|
} else {
|
||||||
QByteArray ba = response.data.findChild("msg").data();
|
QByteArray ba = response.data["msg"].data();
|
||||||
QString msg = fromLocalEncoding(ba);
|
QString msg = fromLocalEncoding(ba);
|
||||||
// Extend the message a bit in unknown cases.
|
// Extend the message a bit in unknown cases.
|
||||||
if (!ba.endsWith("File format not recognized"))
|
if (!ba.endsWith("File format not recognized"))
|
||||||
@@ -92,7 +92,7 @@ void GdbAbstractPlainEngine::handleExecRun(const GdbResponse &response)
|
|||||||
if (debuggerCore()->boolSetting(EnableReverseDebugging))
|
if (debuggerCore()->boolSetting(EnableReverseDebugging))
|
||||||
postCommand("target record");
|
postCommand("target record");
|
||||||
} else {
|
} else {
|
||||||
QString msg = fromLocalEncoding(response.data.findChild("msg").data());
|
QString msg = fromLocalEncoding(response.data["msg"].data());
|
||||||
//QTC_CHECK(status() == InferiorRunOk);
|
//QTC_CHECK(status() == InferiorRunOk);
|
||||||
//interruptInferior();
|
//interruptInferior();
|
||||||
showMessage(msg);
|
showMessage(msg);
|
||||||
|
|||||||
@@ -96,13 +96,13 @@ void GdbAttachEngine::handleAttach(const GdbResponse &response)
|
|||||||
handleInferiorPrepared();
|
handleInferiorPrepared();
|
||||||
break;
|
break;
|
||||||
case GdbResultError:
|
case GdbResultError:
|
||||||
if (response.data.findChild("msg").data() == "ptrace: Operation not permitted.") {
|
if (response.data["msg"].data() == "ptrace: Operation not permitted.") {
|
||||||
notifyInferiorSetupFailed(DumperHelper::msgPtraceError(startParameters().startMode));
|
notifyInferiorSetupFailed(DumperHelper::msgPtraceError(startParameters().startMode));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// if msg != "ptrace: ..." fall through
|
// if msg != "ptrace: ..." fall through
|
||||||
default:
|
default:
|
||||||
QString msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
|
QString msg = QString::fromLocal8Bit(response.data["msg"].data());
|
||||||
notifyInferiorSetupFailed(msg);
|
notifyInferiorSetupFailed(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ static QByteArray qClassName(const QByteArray &qtNamespace, const char *classNam
|
|||||||
|
|
||||||
static double getDumperVersion(const GdbMi &contents)
|
static double getDumperVersion(const GdbMi &contents)
|
||||||
{
|
{
|
||||||
const GdbMi dumperVersionG = contents.findChild("dumperversion");
|
const GdbMi dumperVersionG = contents["dumperversion"];
|
||||||
if (dumperVersionG.type() != GdbMi::Invalid) {
|
if (dumperVersionG.type() != GdbMi::Invalid) {
|
||||||
bool ok;
|
bool ok;
|
||||||
const double v = QString::fromLatin1(dumperVersionG.data()).toDouble(&ok);
|
const double v = QString::fromLatin1(dumperVersionG.data()).toDouble(&ok);
|
||||||
@@ -302,10 +302,10 @@ bool DumperHelper::parseQuery(const GdbMi &contents)
|
|||||||
qDebug() << "parseQuery" << contents.toString(true, 2);
|
qDebug() << "parseQuery" << contents.toString(true, 2);
|
||||||
|
|
||||||
// Common info, dumper version, etc
|
// Common info, dumper version, etc
|
||||||
QByteArray ns = contents.findChild("namespace").data();
|
QByteArray ns = contents["namespace"].data();
|
||||||
setQtNamespace(ns);
|
setQtNamespace(ns);
|
||||||
int qtv = 0;
|
int qtv = 0;
|
||||||
const GdbMi qtversion = contents.findChild("qtversion");
|
const GdbMi qtversion = contents["qtversion"];
|
||||||
if (qtversion.children().size() == 3) {
|
if (qtversion.children().size() == 3) {
|
||||||
qtv = (qtversion.childAt(0).data().toInt() << 16)
|
qtv = (qtversion.childAt(0).data().toInt() << 16)
|
||||||
+ (qtversion.childAt(1).data().toInt() << 8)
|
+ (qtversion.childAt(1).data().toInt() << 8)
|
||||||
@@ -314,7 +314,7 @@ bool DumperHelper::parseQuery(const GdbMi &contents)
|
|||||||
m_qtVersion = qtv;
|
m_qtVersion = qtv;
|
||||||
// Get list of helpers
|
// Get list of helpers
|
||||||
QByteArrayList availableSimpleDebuggingHelpers;
|
QByteArrayList availableSimpleDebuggingHelpers;
|
||||||
foreach (const GdbMi &item, contents.findChild("dumpers").children())
|
foreach (const GdbMi &item, contents["dumpers"].children())
|
||||||
availableSimpleDebuggingHelpers.append(item.data());
|
availableSimpleDebuggingHelpers.append(item.data());
|
||||||
|
|
||||||
// Parse types
|
// Parse types
|
||||||
@@ -326,7 +326,7 @@ bool DumperHelper::parseQuery(const GdbMi &contents)
|
|||||||
|
|
||||||
m_dumperVersion = getDumperVersion(contents);
|
m_dumperVersion = getDumperVersion(contents);
|
||||||
// Parse sizes
|
// Parse sizes
|
||||||
foreach (const GdbMi &sizesList, contents.findChild("sizes").children()) {
|
foreach (const GdbMi &sizesList, contents["sizes"].children()) {
|
||||||
const int childCount = sizesList.childCount();
|
const int childCount = sizesList.childCount();
|
||||||
if (childCount > 1) {
|
if (childCount > 1) {
|
||||||
const int size = sizesList.childAt(0).data().toInt();
|
const int size = sizesList.childAt(0).data().toInt();
|
||||||
@@ -335,7 +335,7 @@ bool DumperHelper::parseQuery(const GdbMi &contents)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Parse expressions
|
// Parse expressions
|
||||||
foreach (const GdbMi &exprList, contents.findChild("expressions").children())
|
foreach (const GdbMi &exprList, contents["expressions"].children())
|
||||||
if (exprList.childCount() == 2)
|
if (exprList.childCount() == 2)
|
||||||
m_expressionCache.insert(exprList.childAt(0).data(),
|
m_expressionCache.insert(exprList.childAt(0).data(),
|
||||||
exprList.childAt(1).data());
|
exprList.childAt(1).data());
|
||||||
@@ -1011,8 +1011,8 @@ void GdbEngine::handleDebuggingHelperValue2Classic(const GdbResponse &response)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.updateType(response.data.findChild("type"));
|
data.updateType(response.data["type"]);
|
||||||
data.updateDisplayedType(response.data.findChild("displaytype"));
|
data.updateDisplayedType(response.data["displaytype"]);
|
||||||
QList<WatchData> list;
|
QList<WatchData> list;
|
||||||
parseWatchData(watchHandler()->expandedINames(), data, contents, &list);
|
parseWatchData(watchHandler()->expandedINames(), data, contents, &list);
|
||||||
//for (int i = 0; i != list.size(); ++i)
|
//for (int i = 0; i != list.size(); ++i)
|
||||||
@@ -1198,9 +1198,9 @@ void GdbEngine::handleStackListArgumentsClassic(const GdbResponse &response)
|
|||||||
// is ok.
|
// is ok.
|
||||||
m_currentFunctionArgs.clear();
|
m_currentFunctionArgs.clear();
|
||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
const GdbMi list = response.data.findChild("stack-args");
|
const GdbMi list = response.data["stack-args"];
|
||||||
const GdbMi frame = list.findChild("frame");
|
const GdbMi frame = list["frame"];
|
||||||
const GdbMi args = frame.findChild("args");
|
const GdbMi args = frame["args"];
|
||||||
m_currentFunctionArgs = args.children();
|
m_currentFunctionArgs = args.children();
|
||||||
} else {
|
} else {
|
||||||
// Seems to occur on "RedHat 4 based Linux" gdb 7.0.1:
|
// Seems to occur on "RedHat 4 based Linux" gdb 7.0.1:
|
||||||
@@ -1215,7 +1215,7 @@ void GdbEngine::handleStackListLocalsClassic(const GdbResponse &response)
|
|||||||
// stage 2/2
|
// stage 2/2
|
||||||
|
|
||||||
// There could be shadowed variables
|
// There could be shadowed variables
|
||||||
QList<GdbMi> locals = response.data.findChild("locals").children();
|
QList<GdbMi> locals = response.data["locals"].children();
|
||||||
locals += m_currentFunctionArgs;
|
locals += m_currentFunctionArgs;
|
||||||
QMap<QByteArray, int> seen;
|
QMap<QByteArray, int> seen;
|
||||||
// If desired, retrieve list of uninitialized variables looking at
|
// If desired, retrieve list of uninitialized variables looking at
|
||||||
@@ -1346,7 +1346,7 @@ void GdbEngine::handleQueryDebuggingHelperClassic(const GdbResponse &response)
|
|||||||
void GdbEngine::handleDebuggingHelperVersionCheckClassic(const GdbResponse &response)
|
void GdbEngine::handleDebuggingHelperVersionCheckClassic(const GdbResponse &response)
|
||||||
{
|
{
|
||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
QString value = _(response.data.findChild("value").data());
|
QString value = _(response.data["value"].data());
|
||||||
QString debuggeeQtVersion = value.section(QLatin1Char('"'), 1, 1);
|
QString debuggeeQtVersion = value.section(QLatin1Char('"'), 1, 1);
|
||||||
QString dumperQtVersion = QLatin1String(m_dumperHelper.qtVersionString());
|
QString dumperQtVersion = QLatin1String(m_dumperHelper.qtVersionString());
|
||||||
if (debuggeeQtVersion.isEmpty()) {
|
if (debuggeeQtVersion.isEmpty()) {
|
||||||
@@ -1375,8 +1375,8 @@ void GdbEngine::handleVarListChildrenHelperClassic(const GdbMi &item,
|
|||||||
{
|
{
|
||||||
//qDebug() << "VAR_LIST_CHILDREN: PARENT" << parent.toString();
|
//qDebug() << "VAR_LIST_CHILDREN: PARENT" << parent.toString();
|
||||||
//qDebug() << "VAR_LIST_CHILDREN: ITEM" << item.toString();
|
//qDebug() << "VAR_LIST_CHILDREN: ITEM" << item.toString();
|
||||||
QByteArray exp = item.findChild("exp").data();
|
QByteArray exp = item["exp"].data();
|
||||||
QByteArray name = item.findChild("name").data();
|
QByteArray name = item["name"].data();
|
||||||
if (isAccessSpecifier(exp)) {
|
if (isAccessSpecifier(exp)) {
|
||||||
// Suppress 'private'/'protected'/'public' level.
|
// Suppress 'private'/'protected'/'public' level.
|
||||||
WatchData data;
|
WatchData data;
|
||||||
@@ -1393,15 +1393,15 @@ void GdbEngine::handleVarListChildrenHelperClassic(const GdbMi &item,
|
|||||||
postCommand(cmd, Discardable,
|
postCommand(cmd, Discardable,
|
||||||
CB(handleVarListChildrenClassic), QVariant::fromValue(data));
|
CB(handleVarListChildrenClassic), QVariant::fromValue(data));
|
||||||
} else if (!startsWithDigit(QLatin1String(exp))
|
} else if (!startsWithDigit(QLatin1String(exp))
|
||||||
&& item.findChild("numchild").data() == "0") {
|
&& item["numchild"].data() == "0") {
|
||||||
// Happens for structs without data, e.g. interfaces.
|
// Happens for structs without data, e.g. interfaces.
|
||||||
WatchData data;
|
WatchData data;
|
||||||
data.name = _(exp);
|
data.name = _(exp);
|
||||||
data.iname = parent.iname + '.' + data.name.toLatin1();
|
data.iname = parent.iname + '.' + data.name.toLatin1();
|
||||||
data.variable = name;
|
data.variable = name;
|
||||||
data.updateType(item.findChild("type"));
|
data.updateType(item["type"]);
|
||||||
data.updateValue(item);
|
data.updateValue(item);
|
||||||
data.updateAddress(item.findChild("addr"));
|
data.updateAddress(item["addr"]);
|
||||||
data.setHasChildren(false);
|
data.setHasChildren(false);
|
||||||
insertData(data);
|
insertData(data);
|
||||||
} else if (parent.iname.endsWith('.')) {
|
} else if (parent.iname.endsWith('.')) {
|
||||||
@@ -1423,10 +1423,10 @@ void GdbEngine::handleVarListChildrenHelperClassic(const GdbMi &item,
|
|||||||
data.iname = parent.iname + '.' + exp;
|
data.iname = parent.iname + '.' + exp;
|
||||||
data.variable = name;
|
data.variable = name;
|
||||||
data.sortId = sortId;
|
data.sortId = sortId;
|
||||||
data.updateType(item.findChild("type"));
|
data.updateType(item["type"]);
|
||||||
data.updateValue(item);
|
data.updateValue(item);
|
||||||
data.updateAddress(item.findChild("addr"));
|
data.updateAddress(item["addr"]);
|
||||||
data.updateChildCount(item.findChild("numchild"));
|
data.updateChildCount(item["numchild"]);
|
||||||
if (!watchHandler()->isExpandedIName(data.iname))
|
if (!watchHandler()->isExpandedIName(data.iname))
|
||||||
data.setChildrenUnneeded();
|
data.setChildrenUnneeded();
|
||||||
|
|
||||||
@@ -1481,7 +1481,7 @@ void GdbEngine::handleVarListChildrenClassic(const GdbResponse &response)
|
|||||||
return;
|
return;
|
||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
//qDebug() << "VAR_LIST_CHILDREN: PARENT" << data.toString();
|
//qDebug() << "VAR_LIST_CHILDREN: PARENT" << data.toString();
|
||||||
QList<GdbMi> children = response.data.findChild("children").children();
|
QList<GdbMi> children = response.data["children"].children();
|
||||||
|
|
||||||
if (children.isEmpty()) {
|
if (children.isEmpty()) {
|
||||||
// happens e.g. if no debug information is present or
|
// happens e.g. if no debug information is present or
|
||||||
@@ -1509,7 +1509,7 @@ void GdbEngine::handleVarListChildrenClassic(const GdbResponse &response)
|
|||||||
handleVarListChildrenHelperClassic(children.at(i), data, i);
|
handleVarListChildrenHelperClassic(children.at(i), data, i);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
data.setError(QString::fromLocal8Bit(response.data.findChild("msg").data()));
|
data.setError(QString::fromLocal8Bit(response.data["msg"].data()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1523,7 +1523,7 @@ void GdbEngine::handleEvaluateExpressionClassic(const GdbResponse &response)
|
|||||||
//else
|
//else
|
||||||
data.updateValue(response.data);
|
data.updateValue(response.data);
|
||||||
} else {
|
} else {
|
||||||
data.setError(QString::fromLocal8Bit(response.data.findChild("msg").data()));
|
data.setError(QString::fromLocal8Bit(response.data["msg"].data()));
|
||||||
}
|
}
|
||||||
//qDebug() << "HANDLE EVALUATE EXPRESSION:" << data.toString();
|
//qDebug() << "HANDLE EVALUATE EXPRESSION:" << data.toString();
|
||||||
insertData(data);
|
insertData(data);
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ void GdbCoreEngine::handleTargetCore(const GdbResponse &response)
|
|||||||
}
|
}
|
||||||
QString msg = tr("Attach to core \"%1\" failed:\n")
|
QString msg = tr("Attach to core \"%1\" failed:\n")
|
||||||
.arg(startParameters().coreFile)
|
.arg(startParameters().coreFile)
|
||||||
+ QString::fromLocal8Bit(response.data.findChild("msg").data());
|
+ QString::fromLocal8Bit(response.data["msg"].data());
|
||||||
notifyInferiorSetupFailed(msg);
|
notifyInferiorSetupFailed(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -451,7 +451,7 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
|||||||
m_pendingLogStreamOutput.clear();
|
m_pendingLogStreamOutput.clear();
|
||||||
m_pendingConsoleStreamOutput.clear();
|
m_pendingConsoleStreamOutput.clear();
|
||||||
} else if (asyncClass == "running") {
|
} else if (asyncClass == "running") {
|
||||||
GdbMi threads = result.findChild("thread-id");
|
GdbMi threads = result["thread-id"];
|
||||||
threadsHandler()->notifyRunning(threads.data());
|
threadsHandler()->notifyRunning(threads.data());
|
||||||
if (state() == InferiorRunOk || state() == InferiorSetupRequested) {
|
if (state() == InferiorRunOk || state() == InferiorSetupRequested) {
|
||||||
// We get multiple *running after thread creation and in Windows terminals.
|
// We get multiple *running after thread creation and in Windows terminals.
|
||||||
@@ -470,7 +470,7 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
|||||||
// target-name="/lib/i386-linux-gnu/libc.so.6"
|
// target-name="/lib/i386-linux-gnu/libc.so.6"
|
||||||
// host-name="/lib/i386-linux-gnu/libc.so.6"
|
// host-name="/lib/i386-linux-gnu/libc.so.6"
|
||||||
// symbols-loaded="0",thread-group="i1"
|
// symbols-loaded="0",thread-group="i1"
|
||||||
QByteArray id = result.findChild("id").data();
|
QByteArray id = result["id"].data();
|
||||||
if (!id.isEmpty())
|
if (!id.isEmpty())
|
||||||
showStatusMessage(tr("Library %1 loaded").arg(_(id)), 1000);
|
showStatusMessage(tr("Library %1 loaded").arg(_(id)), 1000);
|
||||||
progressPing();
|
progressPing();
|
||||||
@@ -478,15 +478,15 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
|||||||
Module module;
|
Module module;
|
||||||
module.startAddress = 0;
|
module.startAddress = 0;
|
||||||
module.endAddress = 0;
|
module.endAddress = 0;
|
||||||
module.hostPath = _(result.findChild("host-name").data());
|
module.hostPath = _(result["host-name"].data());
|
||||||
module.modulePath = _(result.findChild("target-name").data());
|
module.modulePath = _(result["target-name"].data());
|
||||||
module.moduleName = QFileInfo(module.hostPath).baseName();
|
module.moduleName = QFileInfo(module.hostPath).baseName();
|
||||||
modulesHandler()->updateModule(module);
|
modulesHandler()->updateModule(module);
|
||||||
} else if (asyncClass == "library-unloaded") {
|
} else if (asyncClass == "library-unloaded") {
|
||||||
// Archer has 'id="/usr/lib/libdrm.so.2",
|
// Archer has 'id="/usr/lib/libdrm.so.2",
|
||||||
// target-name="/usr/lib/libdrm.so.2",
|
// target-name="/usr/lib/libdrm.so.2",
|
||||||
// host-name="/usr/lib/libdrm.so.2"
|
// host-name="/usr/lib/libdrm.so.2"
|
||||||
QByteArray id = result.findChild("id").data();
|
QByteArray id = result["id"].data();
|
||||||
progressPing();
|
progressPing();
|
||||||
showStatusMessage(tr("Library %1 unloaded").arg(_(id)), 1000);
|
showStatusMessage(tr("Library %1 unloaded").arg(_(id)), 1000);
|
||||||
invalidateSourcesList();
|
invalidateSourcesList();
|
||||||
@@ -499,11 +499,11 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
|||||||
// 7.0.x, there was a *-created instead.
|
// 7.0.x, there was a *-created instead.
|
||||||
progressPing();
|
progressPing();
|
||||||
// 7.1.50 has thread-group-started,id="i1",pid="3529"
|
// 7.1.50 has thread-group-started,id="i1",pid="3529"
|
||||||
QByteArray id = result.findChild("id").data();
|
QByteArray id = result["id"].data();
|
||||||
showStatusMessage(tr("Thread group %1 created").arg(_(id)), 1000);
|
showStatusMessage(tr("Thread group %1 created").arg(_(id)), 1000);
|
||||||
int pid = id.toInt();
|
int pid = id.toInt();
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
id = result.findChild("pid").data();
|
id = result["pid"].data();
|
||||||
pid = id.toInt();
|
pid = id.toInt();
|
||||||
}
|
}
|
||||||
if (pid)
|
if (pid)
|
||||||
@@ -511,26 +511,26 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
|||||||
handleThreadGroupCreated(result);
|
handleThreadGroupCreated(result);
|
||||||
} else if (asyncClass == "thread-created") {
|
} else if (asyncClass == "thread-created") {
|
||||||
//"{id="1",group-id="28902"}"
|
//"{id="1",group-id="28902"}"
|
||||||
QByteArray id = result.findChild("id").data();
|
QByteArray id = result["id"].data();
|
||||||
showStatusMessage(tr("Thread %1 created").arg(_(id)), 1000);
|
showStatusMessage(tr("Thread %1 created").arg(_(id)), 1000);
|
||||||
ThreadData thread;
|
ThreadData thread;
|
||||||
thread.id = ThreadId(id.toLong());
|
thread.id = ThreadId(id.toLong());
|
||||||
thread.groupId = result.findChild("group-id").data();
|
thread.groupId = result["group-id"].data();
|
||||||
threadsHandler()->updateThread(thread);
|
threadsHandler()->updateThread(thread);
|
||||||
} else if (asyncClass == "thread-group-exited") {
|
} else if (asyncClass == "thread-group-exited") {
|
||||||
// Archer has "{id="28902"}"
|
// Archer has "{id="28902"}"
|
||||||
QByteArray id = result.findChild("id").data();
|
QByteArray id = result["id"].data();
|
||||||
showStatusMessage(tr("Thread group %1 exited").arg(_(id)), 1000);
|
showStatusMessage(tr("Thread group %1 exited").arg(_(id)), 1000);
|
||||||
handleThreadGroupExited(result);
|
handleThreadGroupExited(result);
|
||||||
} else if (asyncClass == "thread-exited") {
|
} else if (asyncClass == "thread-exited") {
|
||||||
//"{id="1",group-id="28902"}"
|
//"{id="1",group-id="28902"}"
|
||||||
QByteArray id = result.findChild("id").data();
|
QByteArray id = result["id"].data();
|
||||||
QByteArray groupid = result.findChild("group-id").data();
|
QByteArray groupid = result["group-id"].data();
|
||||||
showStatusMessage(tr("Thread %1 in group %2 exited")
|
showStatusMessage(tr("Thread %1 in group %2 exited")
|
||||||
.arg(_(id)).arg(_(groupid)), 1000);
|
.arg(_(id)).arg(_(groupid)), 1000);
|
||||||
threadsHandler()->removeThread(ThreadId(id.toLong()));
|
threadsHandler()->removeThread(ThreadId(id.toLong()));
|
||||||
} else if (asyncClass == "thread-selected") {
|
} else if (asyncClass == "thread-selected") {
|
||||||
QByteArray id = result.findChild("id").data();
|
QByteArray id = result["id"].data();
|
||||||
showStatusMessage(tr("Thread %1 selected").arg(_(id)), 1000);
|
showStatusMessage(tr("Thread %1 selected").arg(_(id)), 1000);
|
||||||
//"{id="2"}"
|
//"{id="2"}"
|
||||||
} else if (m_isMacGdb && asyncClass == "shlibs-updated") {
|
} else if (m_isMacGdb && asyncClass == "shlibs-updated") {
|
||||||
@@ -550,8 +550,8 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
|||||||
// bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
|
// bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
|
||||||
// addr="0x0000000115cc3ddf",func="foo()",file="../foo.cpp",
|
// addr="0x0000000115cc3ddf",func="foo()",file="../foo.cpp",
|
||||||
// line="1584",shlib="/../libFoo_debug.dylib",times="0"}
|
// line="1584",shlib="/../libFoo_debug.dylib",times="0"}
|
||||||
const GdbMi bkpt = result.findChild("bkpt");
|
const GdbMi bkpt = result["bkpt"];
|
||||||
const BreakpointResponseId rid(bkpt.findChild("number").data());
|
const BreakpointResponseId rid(bkpt["number"].data());
|
||||||
if (!isQmlStepBreakpoint(rid)) {
|
if (!isQmlStepBreakpoint(rid)) {
|
||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
BreakpointModelId id = handler->findBreakpointByResponseId(rid);
|
BreakpointModelId id = handler->findBreakpointByResponseId(rid);
|
||||||
@@ -584,7 +584,7 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
|||||||
BreakpointModelId id;
|
BreakpointModelId id;
|
||||||
BreakpointResponse br;
|
BreakpointResponse br;
|
||||||
foreach (const GdbMi &bkpt, result.children()) {
|
foreach (const GdbMi &bkpt, result.children()) {
|
||||||
const QByteArray nr = bkpt.findChild("number").data();
|
const QByteArray nr = bkpt["number"].data();
|
||||||
BreakpointResponseId rid(nr);
|
BreakpointResponseId rid(nr);
|
||||||
if (!isHiddenBreakpoint(rid)) {
|
if (!isHiddenBreakpoint(rid)) {
|
||||||
if (nr.contains('.')) {
|
if (nr.contains('.')) {
|
||||||
@@ -625,7 +625,7 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
|||||||
// "breakpoint-deleted" "{id="1"}"
|
// "breakpoint-deleted" "{id="1"}"
|
||||||
// New in FSF gdb since 2011-04-27.
|
// New in FSF gdb since 2011-04-27.
|
||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
QByteArray nr = result.findChild("id").data();
|
QByteArray nr = result["id"].data();
|
||||||
BreakpointResponseId rid(nr);
|
BreakpointResponseId rid(nr);
|
||||||
BreakpointModelId id = handler->findBreakpointByResponseId(rid);
|
BreakpointModelId id = handler->findBreakpointByResponseId(rid);
|
||||||
if (id.isValid()) {
|
if (id.isValid()) {
|
||||||
@@ -1088,7 +1088,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
|
|||||||
"TWO RESPONSES FOR ONE COMMAND?").arg(token).
|
"TWO RESPONSES FOR ONE COMMAND?").arg(token).
|
||||||
arg(QString::fromLatin1(stateName(state()))));
|
arg(QString::fromLatin1(stateName(state()))));
|
||||||
if (response->resultClass == GdbResultError) {
|
if (response->resultClass == GdbResultError) {
|
||||||
QByteArray msg = response->data.findChild("msg").data();
|
QByteArray msg = response->data["msg"].data();
|
||||||
if (msg == "Cannot find new threads: generic error") {
|
if (msg == "Cannot find new threads: generic error") {
|
||||||
// Handle a case known to occur on Linux/gdb 6.8 when debugging moc
|
// Handle a case known to occur on Linux/gdb 6.8 when debugging moc
|
||||||
// with helpers enabled. In this case we get a second response with
|
// with helpers enabled. In this case we get a second response with
|
||||||
@@ -1283,12 +1283,12 @@ void GdbEngine::handleQuerySources(const GdbResponse &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.findChild("files");
|
GdbMi files = response.data["files"];
|
||||||
foreach (const GdbMi &item, files.children()) {
|
foreach (const GdbMi &item, files.children()) {
|
||||||
GdbMi fileName = item.findChild("file");
|
GdbMi fileName = item["file"];
|
||||||
if (fileName.data().endsWith("<built-in>"))
|
if (fileName.data().endsWith("<built-in>"))
|
||||||
continue;
|
continue;
|
||||||
GdbMi fullName = item.findChild("fullname");
|
GdbMi fullName = item["fullname"];
|
||||||
QString file = QString::fromLocal8Bit(fileName.data());
|
QString file = QString::fromLocal8Bit(fileName.data());
|
||||||
QString full;
|
QString full;
|
||||||
if (fullName.isValid()) {
|
if (fullName.isValid()) {
|
||||||
@@ -1394,10 +1394,10 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdbMi threads = data.findChild("stopped-thread");
|
GdbMi threads = data["stopped-thread"];
|
||||||
threadsHandler()->notifyStopped(threads.data());
|
threadsHandler()->notifyStopped(threads.data());
|
||||||
|
|
||||||
const QByteArray reason = data.findChild("reason").data();
|
const QByteArray reason = data["reason"].data();
|
||||||
|
|
||||||
if (isExitedReason(reason)) {
|
if (isExitedReason(reason)) {
|
||||||
// // The user triggered a stop, but meanwhile the app simply exited ...
|
// // The user triggered a stop, but meanwhile the app simply exited ...
|
||||||
@@ -1407,10 +1407,10 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
|
|||||||
QString msg;
|
QString msg;
|
||||||
if (reason == "exited") {
|
if (reason == "exited") {
|
||||||
msg = tr("Application exited with exit code %1")
|
msg = tr("Application exited with exit code %1")
|
||||||
.arg(_(data.findChild("exit-code").toString()));
|
.arg(_(data["exit-code"].toString()));
|
||||||
} else if (reason == "exited-signalled" || reason == "signal-received") {
|
} else if (reason == "exited-signalled" || reason == "signal-received") {
|
||||||
msg = tr("Application exited after receiving signal %1")
|
msg = tr("Application exited after receiving signal %1")
|
||||||
.arg(_(data.findChild("signal-name").toString()));
|
.arg(_(data["signal-name"].toString()));
|
||||||
} else {
|
} else {
|
||||||
msg = tr("Application exited normally");
|
msg = tr("Application exited normally");
|
||||||
}
|
}
|
||||||
@@ -1429,18 +1429,18 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
|
|||||||
gotoHandleStop1 = false;
|
gotoHandleStop1 = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BreakpointResponseId rid(data.findChild("bkptno").data());
|
BreakpointResponseId rid(data["bkptno"].data());
|
||||||
const GdbMi frame = data.findChild("frame");
|
const GdbMi frame = data["frame"];
|
||||||
|
|
||||||
int lineNumber = 0;
|
int lineNumber = 0;
|
||||||
QString fullName;
|
QString fullName;
|
||||||
if (frame.isValid()) {
|
if (frame.isValid()) {
|
||||||
const GdbMi lineNumberG = frame.findChild("line");
|
const GdbMi lineNumberG = frame["line"];
|
||||||
if (lineNumberG.isValid()) {
|
if (lineNumberG.isValid()) {
|
||||||
lineNumber = lineNumberG.data().toInt();
|
lineNumber = lineNumberG.data().toInt();
|
||||||
fullName = cleanupFullName(QString::fromLocal8Bit(frame.findChild("fullname").data()));
|
fullName = cleanupFullName(QString::fromLocal8Bit(frame["fullname"].data()));
|
||||||
if (fullName.isEmpty())
|
if (fullName.isEmpty())
|
||||||
fullName = QString::fromLocal8Bit(frame.findChild("file").data());
|
fullName = QString::fromLocal8Bit(frame["file"].data());
|
||||||
} // found line number
|
} // found line number
|
||||||
} else {
|
} else {
|
||||||
showMessage(_("INVALID STOPPED REASON"), LogWarning);
|
showMessage(_("INVALID STOPPED REASON"), LogWarning);
|
||||||
@@ -1533,8 +1533,8 @@ void GdbEngine::handleStop1(const GdbMi &data)
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
||||||
QTC_ASSERT(!isDying(), return);
|
QTC_ASSERT(!isDying(), return);
|
||||||
const GdbMi frame = data.findChild("frame");
|
const GdbMi frame = data["frame"];
|
||||||
const QByteArray reason = data.findChild("reason").data();
|
const QByteArray reason = data["reason"].data();
|
||||||
|
|
||||||
// This was seen on XP after removing a breakpoint while running
|
// This was seen on XP after removing a breakpoint while running
|
||||||
// >945*stopped,reason="signal-received",signal-name="SIGTRAP",
|
// >945*stopped,reason="signal-received",signal-name="SIGTRAP",
|
||||||
@@ -1558,8 +1558,8 @@ void GdbEngine::handleStop1(const GdbMi &data)
|
|||||||
if (debuggerCore()->boolSetting(SkipKnownFrames)) {
|
if (debuggerCore()->boolSetting(SkipKnownFrames)) {
|
||||||
if (reason == "end-stepping-range" || reason == "function-finished") {
|
if (reason == "end-stepping-range" || reason == "function-finished") {
|
||||||
//showMessage(frame.toString());
|
//showMessage(frame.toString());
|
||||||
QString funcName = _(frame.findChild("func").data());
|
QString funcName = _(frame["func"].data());
|
||||||
QString fileName = QString::fromLocal8Bit(frame.findChild("file").data());
|
QString fileName = QString::fromLocal8Bit(frame["file"].data());
|
||||||
if (isLeavableFunction(funcName, fileName)) {
|
if (isLeavableFunction(funcName, fileName)) {
|
||||||
//showMessage(_("LEAVING ") + funcName);
|
//showMessage(_("LEAVING ") + funcName);
|
||||||
++stepCounter;
|
++stepCounter;
|
||||||
@@ -1584,7 +1584,7 @@ void GdbEngine::handleStop1(const GdbMi &data)
|
|||||||
// fullname="/../app.cpp",line="1611"},gdb-result-var="$1",
|
// fullname="/../app.cpp",line="1611"},gdb-result-var="$1",
|
||||||
// return-value="{d = 0x808d998}",thread-id="1",stopped-threads="all",
|
// return-value="{d = 0x808d998}",thread-id="1",stopped-threads="all",
|
||||||
// core="1"
|
// core="1"
|
||||||
GdbMi resultVar = data.findChild("gdb-result-var");
|
GdbMi resultVar = data["gdb-result-var"];
|
||||||
if (resultVar.isValid())
|
if (resultVar.isValid())
|
||||||
m_resultVarName = resultVar.data();
|
m_resultVarName = resultVar.data();
|
||||||
else
|
else
|
||||||
@@ -1603,7 +1603,7 @@ void GdbEngine::handleStop1(const GdbMi &data)
|
|||||||
if (initHelpers
|
if (initHelpers
|
||||||
&& dumperHandling() != DumperLoadedByGdbPreload
|
&& dumperHandling() != DumperLoadedByGdbPreload
|
||||||
&& reason == "signal-received") {
|
&& reason == "signal-received") {
|
||||||
const QByteArray name = data.findChild("signal-name").data();
|
const QByteArray name = data["signal-name"].data();
|
||||||
const DebuggerStartParameters &sp = startParameters();
|
const DebuggerStartParameters &sp = startParameters();
|
||||||
if (name != stopSignal(sp.toolChainAbi))
|
if (name != stopSignal(sp.toolChainAbi))
|
||||||
initHelpers = false;
|
initHelpers = false;
|
||||||
@@ -1656,15 +1656,15 @@ void GdbEngine::handleStop2(const GdbMi &data)
|
|||||||
// dNOTE: INFERIOR STOP OK
|
// dNOTE: INFERIOR STOP OK
|
||||||
// dState changed from InferiorStopRequested(13) to InferiorStopOk(14).
|
// dState changed from InferiorStopRequested(13) to InferiorStopOk(14).
|
||||||
|
|
||||||
const QByteArray reason = data.findChild("reason").data();
|
const QByteArray reason = data["reason"].data();
|
||||||
const QByteArray func = data.findChild("frame").findChild("from").data();
|
const QByteArray func = data["frame"]["from"].data();
|
||||||
const DebuggerStartParameters &sp = startParameters();
|
const DebuggerStartParameters &sp = startParameters();
|
||||||
|
|
||||||
bool isStopperThread = false;
|
bool isStopperThread = false;
|
||||||
|
|
||||||
if (sp.useTerminal
|
if (sp.useTerminal
|
||||||
&& reason == "signal-received"
|
&& reason == "signal-received"
|
||||||
&& data.findChild("signal-name").data() == "SIGSTOP"
|
&& data["signal-name"].data() == "SIGSTOP"
|
||||||
&& (func.endsWith("/ld-linux.so.2")
|
&& (func.endsWith("/ld-linux.so.2")
|
||||||
|| func.endsWith("/ld-linux-x86-64.so.2")))
|
|| func.endsWith("/ld-linux-x86-64.so.2")))
|
||||||
{
|
{
|
||||||
@@ -1677,7 +1677,7 @@ void GdbEngine::handleStop2(const GdbMi &data)
|
|||||||
if (sp.toolChainAbi.os() == Abi::WindowsOS
|
if (sp.toolChainAbi.os() == Abi::WindowsOS
|
||||||
&& sp.useTerminal
|
&& sp.useTerminal
|
||||||
&& reason == "signal-received"
|
&& reason == "signal-received"
|
||||||
&& data.findChild("signal-name").data() == "SIGTRAP")
|
&& data["signal-name"].data() == "SIGTRAP")
|
||||||
{
|
{
|
||||||
// This is the stopper thread. That also means that the
|
// This is the stopper thread. That also means that the
|
||||||
// reported thread is not the one we'd like to expose
|
// reported thread is not the one we'd like to expose
|
||||||
@@ -1700,19 +1700,19 @@ void GdbEngine::handleStop2(const GdbMi &data)
|
|||||||
// func="QScopedPointer",args=[{name="this",value="0xbfffed40"},
|
// func="QScopedPointer",args=[{name="this",value="0xbfffed40"},
|
||||||
// {name="p",value="0x0"}],file="x.h",fullname="/home/.../x.h",line="95"},
|
// {name="p",value="0x0"}],file="x.h",fullname="/home/.../x.h",line="95"},
|
||||||
// thread-id="1",stopped-threads="all",core="2"
|
// thread-id="1",stopped-threads="all",core="2"
|
||||||
const GdbMi wpt = data.findChild("wpt");
|
const GdbMi wpt = data["wpt"];
|
||||||
const BreakpointResponseId rid(wpt.findChild("number").data());
|
const BreakpointResponseId rid(wpt["number"].data());
|
||||||
const BreakpointModelId id = breakHandler()->findBreakpointByResponseId(rid);
|
const BreakpointModelId id = breakHandler()->findBreakpointByResponseId(rid);
|
||||||
const quint64 bpAddress = wpt.findChild("exp").data().mid(1).toULongLong(0, 0);
|
const quint64 bpAddress = wpt["exp"].data().mid(1).toULongLong(0, 0);
|
||||||
QString msg;
|
QString msg;
|
||||||
if (id && breakHandler()->type(id) == WatchpointAtExpression)
|
if (id && breakHandler()->type(id) == WatchpointAtExpression)
|
||||||
msg = msgWatchpointByExpressionTriggered(id, rid.majorPart(),
|
msg = msgWatchpointByExpressionTriggered(id, rid.majorPart(),
|
||||||
breakHandler()->expression(id));
|
breakHandler()->expression(id));
|
||||||
if (id && breakHandler()->type(id) == WatchpointAtAddress)
|
if (id && breakHandler()->type(id) == WatchpointAtAddress)
|
||||||
msg = msgWatchpointByAddressTriggered(id, rid.majorPart(), bpAddress);
|
msg = msgWatchpointByAddressTriggered(id, rid.majorPart(), bpAddress);
|
||||||
GdbMi value = data.findChild("value");
|
GdbMi value = data["value"];
|
||||||
GdbMi oldValue = value.findChild("old");
|
GdbMi oldValue = value["old"];
|
||||||
GdbMi newValue = value.findChild("new");
|
GdbMi newValue = value["new"];
|
||||||
if (oldValue.isValid() && newValue.isValid()) {
|
if (oldValue.isValid() && newValue.isValid()) {
|
||||||
msg += QLatin1Char(' ');
|
msg += QLatin1Char(' ');
|
||||||
msg += tr("Value changed from %1 to %2.")
|
msg += tr("Value changed from %1 to %2.")
|
||||||
@@ -1720,19 +1720,19 @@ void GdbEngine::handleStop2(const GdbMi &data)
|
|||||||
}
|
}
|
||||||
showStatusMessage(msg);
|
showStatusMessage(msg);
|
||||||
} else if (reason == "breakpoint-hit") {
|
} else if (reason == "breakpoint-hit") {
|
||||||
GdbMi gNumber = data.findChild("bkptno"); // 'number' or 'bkptno'?
|
GdbMi gNumber = data["bkptno"]; // 'number' or 'bkptno'?
|
||||||
if (!gNumber.isValid())
|
if (!gNumber.isValid())
|
||||||
gNumber = data.findChild("number");
|
gNumber = data["number"];
|
||||||
const BreakpointResponseId rid(gNumber.data());
|
const BreakpointResponseId rid(gNumber.data());
|
||||||
const QByteArray threadId = data.findChild("thread-id").data();
|
const QByteArray threadId = data["thread-id"].data();
|
||||||
const BreakpointModelId id = breakHandler()->findBreakpointByResponseId(rid);
|
const BreakpointModelId id = breakHandler()->findBreakpointByResponseId(rid);
|
||||||
showStatusMessage(msgBreakpointTriggered(id, rid.majorPart(), _(threadId)));
|
showStatusMessage(msgBreakpointTriggered(id, rid.majorPart(), _(threadId)));
|
||||||
m_currentThread = threadId;
|
m_currentThread = threadId;
|
||||||
} else {
|
} else {
|
||||||
QString reasontr = msgStopped(_(reason));
|
QString reasontr = msgStopped(_(reason));
|
||||||
if (reason == "signal-received") {
|
if (reason == "signal-received") {
|
||||||
QByteArray name = data.findChild("signal-name").data();
|
QByteArray name = data["signal-name"].data();
|
||||||
QByteArray meaning = data.findChild("signal-meaning").data();
|
QByteArray meaning = data["signal-meaning"].data();
|
||||||
// Ignore these as they are showing up regularly when
|
// Ignore these as they are showing up regularly when
|
||||||
// stopping debugging.
|
// stopping debugging.
|
||||||
if (name == stopSignal(sp.toolChainAbi)) {
|
if (name == stopSignal(sp.toolChainAbi)) {
|
||||||
@@ -1848,12 +1848,12 @@ void GdbEngine::handlePythonSetup(const GdbResponse &response)
|
|||||||
m_hasPython = true;
|
m_hasPython = true;
|
||||||
GdbMi data;
|
GdbMi data;
|
||||||
data.fromStringMultiple(response.consoleStreamOutput);
|
data.fromStringMultiple(response.consoleStreamOutput);
|
||||||
const GdbMi dumpers = data.findChild("dumpers");
|
const GdbMi dumpers = data["dumpers"];
|
||||||
foreach (const GdbMi &dumper, dumpers.children()) {
|
foreach (const GdbMi &dumper, dumpers.children()) {
|
||||||
QByteArray type = dumper.findChild("type").data();
|
QByteArray type = dumper["type"].data();
|
||||||
QStringList formats(tr("Raw structure"));
|
QStringList formats(tr("Raw structure"));
|
||||||
foreach (const QByteArray &format,
|
foreach (const QByteArray &format,
|
||||||
dumper.findChild("formats").data().split(',')) {
|
dumper["formats"].data().split(',')) {
|
||||||
if (format == "Normal")
|
if (format == "Normal")
|
||||||
formats.append(tr("Normal"));
|
formats.append(tr("Normal"));
|
||||||
else if (format == "Displayed")
|
else if (format == "Displayed")
|
||||||
@@ -1863,7 +1863,7 @@ void GdbEngine::handlePythonSetup(const GdbResponse &response)
|
|||||||
}
|
}
|
||||||
watchHandler()->addTypeFormats(type, formats);
|
watchHandler()->addTypeFormats(type, formats);
|
||||||
}
|
}
|
||||||
const GdbMi hasInferiorThreadList = data.findChild("hasInferiorThreadList");
|
const GdbMi hasInferiorThreadList = data["hasInferiorThreadList"];
|
||||||
m_hasInferiorThreadList = (hasInferiorThreadList.data().toInt() != 0);
|
m_hasInferiorThreadList = (hasInferiorThreadList.data().toInt() != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1900,7 +1900,7 @@ void GdbEngine::handleExecuteContinue(const GdbResponse &response)
|
|||||||
notifyInferiorRunOk(); // Only needed for gdb < 7.0.
|
notifyInferiorRunOk(); // Only needed for gdb < 7.0.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QByteArray msg = response.data.findChild("msg").data();
|
QByteArray msg = response.data["msg"].data();
|
||||||
if (msg.startsWith("Cannot find bounds of current function")) {
|
if (msg.startsWith("Cannot find bounds of current function")) {
|
||||||
notifyInferiorRunFailed();
|
notifyInferiorRunFailed();
|
||||||
if (isDying())
|
if (isDying())
|
||||||
@@ -2015,7 +2015,7 @@ void GdbEngine::handleInferiorShutdown(const GdbResponse &response)
|
|||||||
notifyInferiorShutdownOk();
|
notifyInferiorShutdownOk();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QByteArray ba = response.data.findChild("msg").data();
|
QByteArray ba = response.data["msg"].data();
|
||||||
if (ba.contains(": No such file or directory.")) {
|
if (ba.contains(": No such file or directory.")) {
|
||||||
// This happens when someone removed the binary behind our back.
|
// This happens when someone removed the binary behind our back.
|
||||||
// It is not really an error from a user's point of view.
|
// It is not really an error from a user's point of view.
|
||||||
@@ -2066,7 +2066,7 @@ void GdbEngine::handleGdbExit(const GdbResponse &response)
|
|||||||
//notifyEngineShutdownOk();
|
//notifyEngineShutdownOk();
|
||||||
} else {
|
} else {
|
||||||
QString msg = msgGdbStopFailed(
|
QString msg = msgGdbStopFailed(
|
||||||
QString::fromLocal8Bit(response.data.findChild("msg").data()));
|
QString::fromLocal8Bit(response.data["msg"].data()));
|
||||||
qDebug() << (_("GDB WON'T EXIT (%1); KILLING IT").arg(msg));
|
qDebug() << (_("GDB WON'T EXIT (%1); KILLING IT").arg(msg));
|
||||||
showMessage(_("GDB WON'T EXIT (%1); KILLING IT").arg(msg));
|
showMessage(_("GDB WON'T EXIT (%1); KILLING IT").arg(msg));
|
||||||
gdbProc()->kill();
|
gdbProc()->kill();
|
||||||
@@ -2089,15 +2089,18 @@ void GdbEngine::handleDetach(const GdbResponse &response)
|
|||||||
|
|
||||||
void GdbEngine::handleThreadGroupCreated(const GdbMi &result)
|
void GdbEngine::handleThreadGroupCreated(const GdbMi &result)
|
||||||
{
|
{
|
||||||
QByteArray id = result.findChild("id").data();
|
Q_UNUSED(result);
|
||||||
QByteArray pid = result.findChild("pid").data();
|
// QByteArray id = result["id"].data();
|
||||||
Q_UNUSED(id);
|
// QByteArray pid = result["pid"].data();
|
||||||
Q_UNUSED(pid);
|
// Q_UNUSED(id);
|
||||||
|
// Q_UNUSED(pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::handleThreadGroupExited(const GdbMi &result)
|
void GdbEngine::handleThreadGroupExited(const GdbMi &result)
|
||||||
{
|
{
|
||||||
QByteArray id = result.findChild("id").data();
|
Q_UNUSED(result);
|
||||||
|
// QByteArray id = result["id"].data();
|
||||||
|
// Q_UNUSED(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GdbEngine::currentFrame() const
|
int GdbEngine::currentFrame() const
|
||||||
@@ -2199,7 +2202,7 @@ void GdbEngine::handleExecuteStep(const GdbResponse &response)
|
|||||||
notifyInferiorRunOk(); // Only needed for gdb < 7.0.
|
notifyInferiorRunOk(); // Only needed for gdb < 7.0.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QByteArray msg = response.data.findChild("msg").data();
|
QByteArray msg = response.data["msg"].data();
|
||||||
if (msg.startsWith("Cannot find bounds of current function")
|
if (msg.startsWith("Cannot find bounds of current function")
|
||||||
|| msg.contains("Error accessing memory address")
|
|| msg.contains("Error accessing memory address")
|
||||||
|| msg.startsWith("Cannot access memory at address")) {
|
|| msg.startsWith("Cannot access memory at address")) {
|
||||||
@@ -2276,7 +2279,7 @@ void GdbEngine::handleExecuteNext(const GdbResponse &response)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
||||||
QByteArray msg = response.data.findChild("msg").data();
|
QByteArray msg = response.data["msg"].data();
|
||||||
if (msg.startsWith("Cannot find bounds of current function")
|
if (msg.startsWith("Cannot find bounds of current function")
|
||||||
|| msg.contains("Error accessing memory address ")) {
|
|| msg.contains("Error accessing memory address ")) {
|
||||||
if (!m_commandsToRunOnTemporaryBreak.isEmpty())
|
if (!m_commandsToRunOnTemporaryBreak.isEmpty())
|
||||||
@@ -2498,7 +2501,7 @@ void GdbEngine::updateResponse(BreakpointResponse &response, const GdbMi &bkpt)
|
|||||||
if (child.data().contains("tracepoint")) {
|
if (child.data().contains("tracepoint")) {
|
||||||
response.tracepoint = true;
|
response.tracepoint = true;
|
||||||
} else if (child.data() == "hw watchpoint" || child.data() == "watchpoint") {
|
} else if (child.data() == "hw watchpoint" || child.data() == "watchpoint") {
|
||||||
QByteArray what = bkpt.findChild("what").data();
|
QByteArray what = bkpt["what"].data();
|
||||||
if (what.startsWith("*0x")) {
|
if (what.startsWith("*0x")) {
|
||||||
response.type = WatchpointAtAddress;
|
response.type = WatchpointAtAddress;
|
||||||
response.address = what.mid(1).toULongLong(0, 0);
|
response.address = what.mid(1).toULongLong(0, 0);
|
||||||
@@ -2623,12 +2626,12 @@ void GdbEngine::handleWatchInsert(const GdbResponse &response)
|
|||||||
BreakpointResponse br = handler->response(id);
|
BreakpointResponse br = handler->response(id);
|
||||||
// "Hardware watchpoint 2: *0xbfffed40\n"
|
// "Hardware watchpoint 2: *0xbfffed40\n"
|
||||||
QByteArray ba = response.consoleStreamOutput;
|
QByteArray ba = response.consoleStreamOutput;
|
||||||
GdbMi wpt = response.data.findChild("wpt");
|
GdbMi wpt = response.data["wpt"];
|
||||||
if (wpt.isValid()) {
|
if (wpt.isValid()) {
|
||||||
// Mac yields:
|
// Mac yields:
|
||||||
//>32^done,wpt={number="4",exp="*4355182176"}
|
//>32^done,wpt={number="4",exp="*4355182176"}
|
||||||
br.id = BreakpointResponseId(wpt.findChild("number").data());
|
br.id = BreakpointResponseId(wpt["number"].data());
|
||||||
QByteArray exp = wpt.findChild("exp").data();
|
QByteArray exp = wpt["exp"].data();
|
||||||
if (exp.startsWith('*'))
|
if (exp.startsWith('*'))
|
||||||
br.address = exp.mid(1).toULongLong(0, 0);
|
br.address = exp.mid(1).toULongLong(0, 0);
|
||||||
handler->setResponse(id, br);
|
handler->setResponse(id, br);
|
||||||
@@ -2683,7 +2686,7 @@ void GdbEngine::handleBkpt(const GdbMi &bkpt, const BreakpointModelId &id)
|
|||||||
{
|
{
|
||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
BreakpointResponse br = handler->response(id);
|
BreakpointResponse br = handler->response(id);
|
||||||
const QByteArray nr = bkpt.findChild("number").data();
|
const QByteArray nr = bkpt["number"].data();
|
||||||
const BreakpointResponseId rid(nr);
|
const BreakpointResponseId rid(nr);
|
||||||
QTC_ASSERT(rid.isValid(), return);
|
QTC_ASSERT(rid.isValid(), return);
|
||||||
if (nr.contains('.')) {
|
if (nr.contains('.')) {
|
||||||
@@ -2698,11 +2701,11 @@ void GdbEngine::handleBkpt(const GdbMi &bkpt, const BreakpointModelId &id)
|
|||||||
|
|
||||||
// The MI output format might change, see
|
// The MI output format might change, see
|
||||||
// http://permalink.gmane.org/gmane.comp.gdb.patches/83936
|
// http://permalink.gmane.org/gmane.comp.gdb.patches/83936
|
||||||
const GdbMi locations = bkpt.findChild("locations");
|
const GdbMi locations = bkpt["locations"];
|
||||||
if (locations.isValid()) {
|
if (locations.isValid()) {
|
||||||
foreach (const GdbMi &loc, locations.children()) {
|
foreach (const GdbMi &loc, locations.children()) {
|
||||||
// A sub-breakpoint.
|
// A sub-breakpoint.
|
||||||
const QByteArray subnr = loc.findChild("number").data();
|
const QByteArray subnr = loc["number"].data();
|
||||||
const BreakpointResponseId subrid(subnr);
|
const BreakpointResponseId subrid(subnr);
|
||||||
BreakpointResponse sub;
|
BreakpointResponse sub;
|
||||||
updateResponse(sub, loc);
|
updateResponse(sub, loc);
|
||||||
@@ -2725,9 +2728,9 @@ void GdbEngine::handleBreakInsert1(const GdbResponse &response)
|
|||||||
if (handler->state(id) == BreakpointRemoveRequested) {
|
if (handler->state(id) == BreakpointRemoveRequested) {
|
||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
// This delete was defered. Act now.
|
// This delete was defered. Act now.
|
||||||
const GdbMi mainbkpt = response.data.findChild("bkpt");
|
const GdbMi mainbkpt = response.data["bkpt"];
|
||||||
handler->notifyBreakpointRemoveProceeding(id);
|
handler->notifyBreakpointRemoveProceeding(id);
|
||||||
QByteArray nr = mainbkpt.findChild("number").data();
|
QByteArray nr = mainbkpt["number"].data();
|
||||||
postCommand("-break-delete " + nr,
|
postCommand("-break-delete " + nr,
|
||||||
NeedsStop | RebuildBreakpointModel);
|
NeedsStop | RebuildBreakpointModel);
|
||||||
handler->notifyBreakpointRemoveOk(id);
|
handler->notifyBreakpointRemoveOk(id);
|
||||||
@@ -2740,8 +2743,8 @@ void GdbEngine::handleBreakInsert1(const GdbResponse &response)
|
|||||||
// 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.
|
||||||
const GdbMi mainbkpt = response.data.findChild("bkpt");
|
const GdbMi mainbkpt = response.data["bkpt"];
|
||||||
const QByteArray mainnr = mainbkpt.findChild("number").data();
|
const QByteArray mainnr = mainbkpt["number"].data();
|
||||||
const BreakpointResponseId mainrid(mainnr);
|
const BreakpointResponseId mainrid(mainnr);
|
||||||
if (!isHiddenBreakpoint(mainrid)) {
|
if (!isHiddenBreakpoint(mainrid)) {
|
||||||
foreach (const GdbMi &bkpt, response.data.children())
|
foreach (const GdbMi &bkpt, response.data.children())
|
||||||
@@ -2760,7 +2763,7 @@ void GdbEngine::handleBreakInsert1(const GdbResponse &response)
|
|||||||
NeedsStop, CB(handleBreakListMultiple),
|
NeedsStop, CB(handleBreakListMultiple),
|
||||||
QVariant::fromValue(id));
|
QVariant::fromValue(id));
|
||||||
}
|
}
|
||||||
} else if (response.data.findChild("msg").data().contains("Unknown option")) {
|
} else if (response.data["msg"].data().contains("Unknown option")) {
|
||||||
// Older version of gdb don't know the -a option to set tracepoints
|
// Older version of gdb don't know the -a option to set tracepoints
|
||||||
// ^error,msg="mi_cmd_break_insert: Unknown option ``a''"
|
// ^error,msg="mi_cmd_break_insert: Unknown option ``a''"
|
||||||
const QString fileName = handler->fileName(id);
|
const QString fileName = handler->fileName(id);
|
||||||
@@ -2824,7 +2827,7 @@ void GdbEngine::handleBreakList(const GdbResponse &response)
|
|||||||
// addr="<PENDING>",pending="plugin.cpp:7",times="0"}] ... }
|
// addr="<PENDING>",pending="plugin.cpp:7",times="0"}] ... }
|
||||||
|
|
||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
GdbMi table = response.data.findChild("BreakpointTable");
|
GdbMi table = response.data["BreakpointTable"];
|
||||||
if (table.isValid())
|
if (table.isValid())
|
||||||
handleBreakList(table);
|
handleBreakList(table);
|
||||||
}
|
}
|
||||||
@@ -2832,7 +2835,7 @@ void GdbEngine::handleBreakList(const GdbResponse &response)
|
|||||||
|
|
||||||
void GdbEngine::handleBreakList(const GdbMi &table)
|
void GdbEngine::handleBreakList(const GdbMi &table)
|
||||||
{
|
{
|
||||||
const GdbMi body = table.findChild("body");
|
const GdbMi body = table["body"];
|
||||||
QList<GdbMi> bkpts;
|
QList<GdbMi> bkpts;
|
||||||
if (body.isValid()) {
|
if (body.isValid()) {
|
||||||
// Non-Mac
|
// Non-Mac
|
||||||
@@ -2842,7 +2845,7 @@ void GdbEngine::handleBreakList(const GdbMi &table)
|
|||||||
bkpts = table.children();
|
bkpts = table.children();
|
||||||
// Remove the 'hdr' and artificial items.
|
// Remove the 'hdr' and artificial items.
|
||||||
for (int i = bkpts.size(); --i >= 0; ) {
|
for (int i = bkpts.size(); --i >= 0; ) {
|
||||||
int num = bkpts.at(i).findChild("number").data().toInt();
|
int num = bkpts.at(i)["number"].data().toInt();
|
||||||
if (num <= 0)
|
if (num <= 0)
|
||||||
bkpts.removeAt(i);
|
bkpts.removeAt(i);
|
||||||
}
|
}
|
||||||
@@ -2851,7 +2854,7 @@ void GdbEngine::handleBreakList(const GdbMi &table)
|
|||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
foreach (const GdbMi &bkpt, bkpts) {
|
foreach (const GdbMi &bkpt, bkpts) {
|
||||||
BreakpointResponse needle;
|
BreakpointResponse needle;
|
||||||
needle.id = BreakpointResponseId(bkpt.findChild("number").data());
|
needle.id = BreakpointResponseId(bkpt["number"].data());
|
||||||
if (isQmlStepBreakpoint2(needle.id))
|
if (isQmlStepBreakpoint2(needle.id))
|
||||||
continue;
|
continue;
|
||||||
if (isQFatalBreakpoint(needle.id))
|
if (isQFatalBreakpoint(needle.id))
|
||||||
@@ -3555,12 +3558,12 @@ void GdbEngine::handleModulesList(const GdbResponse &response)
|
|||||||
// shlib-info={...}...
|
// shlib-info={...}...
|
||||||
foreach (const GdbMi &item, response.data.children()) {
|
foreach (const GdbMi &item, response.data.children()) {
|
||||||
module.modulePath =
|
module.modulePath =
|
||||||
QString::fromLocal8Bit(item.findChild("path").data());
|
QString::fromLocal8Bit(item["path"].data());
|
||||||
module.moduleName = nameFromPath(module.modulePath);
|
module.moduleName = nameFromPath(module.modulePath);
|
||||||
module.symbolsRead = (item.findChild("state").data() == "Y")
|
module.symbolsRead = (item["state"].data() == "Y")
|
||||||
? Module::ReadOk : Module::ReadFailed;
|
? Module::ReadOk : Module::ReadFailed;
|
||||||
module.startAddress =
|
module.startAddress =
|
||||||
item.findChild("loaded_addr").data().toULongLong(0, 0);
|
item["loaded_addr"].data().toULongLong(0, 0);
|
||||||
module.endAddress = 0; // FIXME: End address not easily available.
|
module.endAddress = 0; // FIXME: End address not easily available.
|
||||||
handler->updateModule(module);
|
handler->updateModule(module);
|
||||||
}
|
}
|
||||||
@@ -3653,15 +3656,15 @@ StackFrame GdbEngine::parseStackFrame(const GdbMi &frameMi, int level)
|
|||||||
//qDebug() << "HANDLING FRAME:" << frameMi.toString();
|
//qDebug() << "HANDLING FRAME:" << frameMi.toString();
|
||||||
StackFrame frame;
|
StackFrame frame;
|
||||||
frame.level = level;
|
frame.level = level;
|
||||||
GdbMi fullName = frameMi.findChild("fullname");
|
GdbMi fullName = frameMi["fullname"];
|
||||||
if (fullName.isValid())
|
if (fullName.isValid())
|
||||||
frame.file = cleanupFullName(QFile::decodeName(fullName.data()));
|
frame.file = cleanupFullName(QFile::decodeName(fullName.data()));
|
||||||
else
|
else
|
||||||
frame.file = QFile::decodeName(frameMi.findChild("file").data());
|
frame.file = QFile::decodeName(frameMi["file"].data());
|
||||||
frame.function = _(frameMi.findChild("func").data());
|
frame.function = _(frameMi["func"].data());
|
||||||
frame.from = _(frameMi.findChild("from").data());
|
frame.from = _(frameMi["from"].data());
|
||||||
frame.line = frameMi.findChild("line").data().toInt();
|
frame.line = frameMi["line"].data().toInt();
|
||||||
frame.address = frameMi.findChild("addr").toAddress();
|
frame.address = frameMi["addr"].toAddress();
|
||||||
frame.usable = QFileInfo(frame.file).isReadable();
|
frame.usable = QFileInfo(frame.file).isReadable();
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
@@ -3681,7 +3684,7 @@ void GdbEngine::handleStackListFrames(const GdbResponse &response)
|
|||||||
StackCookie cookie = response.cookie.value<StackCookie>();
|
StackCookie cookie = response.cookie.value<StackCookie>();
|
||||||
QList<StackFrame> stackFrames;
|
QList<StackFrame> stackFrames;
|
||||||
|
|
||||||
GdbMi stack = response.data.findChild("stack");
|
GdbMi stack = response.data["stack"];
|
||||||
if (!stack.isValid()) {
|
if (!stack.isValid()) {
|
||||||
qDebug() << "FIXME: stack:" << stack.toString();
|
qDebug() << "FIXME: stack:" << stack.toString();
|
||||||
return;
|
return;
|
||||||
@@ -3789,7 +3792,7 @@ void GdbEngine::handleThreadListIds(const GdbResponse &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 QList<GdbMi> items = response.data.findChild("thread-ids").children();
|
const QList<GdbMi> items = response.data["thread-ids"].children();
|
||||||
for (int index = 0, n = items.size(); index != n; ++index) {
|
for (int index = 0, n = items.size(); index != n; ++index) {
|
||||||
ThreadData thread;
|
ThreadData thread;
|
||||||
thread.id = ThreadId(items.at(index).data().toInt());
|
thread.id = ThreadId(items.at(index).data().toInt());
|
||||||
@@ -3806,9 +3809,9 @@ void GdbEngine::handleThreadNames(const GdbResponse &response)
|
|||||||
names.fromString(response.consoleStreamOutput);
|
names.fromString(response.consoleStreamOutput);
|
||||||
foreach (const GdbMi &name, names.children()) {
|
foreach (const GdbMi &name, names.children()) {
|
||||||
ThreadData thread;
|
ThreadData thread;
|
||||||
thread.id = ThreadId(name.findChild("id").data().toInt());
|
thread.id = ThreadId(name["id"].data().toInt());
|
||||||
thread.name = decodeData(name.findChild("value").data(),
|
thread.name = decodeData(name["value"].data(),
|
||||||
name.findChild("valueencoded").data().toInt());
|
name["valueencoded"].data().toInt());
|
||||||
handler->updateThread(thread);
|
handler->updateThread(thread);
|
||||||
}
|
}
|
||||||
updateViews();
|
updateViews();
|
||||||
@@ -3854,7 +3857,7 @@ void GdbEngine::handleMakeSnapshot(const GdbResponse &response)
|
|||||||
sp.isSnapshot = true;
|
sp.isSnapshot = true;
|
||||||
DebuggerRunControlFactory::createAndScheduleRun(sp);
|
DebuggerRunControlFactory::createAndScheduleRun(sp);
|
||||||
} else {
|
} else {
|
||||||
QByteArray msg = response.data.findChild("msg").data();
|
QByteArray msg = response.data["msg"].data();
|
||||||
showMessageBox(QMessageBox::Critical, tr("Snapshot Creation Error"),
|
showMessageBox(QMessageBox::Critical, tr("Snapshot Creation Error"),
|
||||||
tr("Cannot create snapshot:\n") + QString::fromLocal8Bit(msg));
|
tr("Cannot create snapshot:\n") + QString::fromLocal8Bit(msg));
|
||||||
}
|
}
|
||||||
@@ -3903,7 +3906,7 @@ void GdbEngine::handleRegisterListNames(const GdbResponse &response)
|
|||||||
// This both handles explicitly having space for all the registers and
|
// This both handles explicitly having space for all the registers and
|
||||||
// initializes all indices to 0, giving missing registers a sane default
|
// initializes all indices to 0, giving missing registers a sane default
|
||||||
// in the event of something wacky.
|
// in the event of something wacky.
|
||||||
GdbMi names = response.data.findChild("register-names");
|
GdbMi names = response.data["register-names"];
|
||||||
m_registerNumbers.resize(names.childCount());
|
m_registerNumbers.resize(names.childCount());
|
||||||
foreach (const GdbMi &item, names.children()) {
|
foreach (const GdbMi &item, names.children()) {
|
||||||
// Since we throw away missing registers to eliminate empty rows
|
// Since we throw away missing registers to eliminate empty rows
|
||||||
@@ -3929,12 +3932,12 @@ void GdbEngine::handleRegisterListValues(const GdbResponse &response)
|
|||||||
const int gdbRegisterCount = m_registerNumbers.size();
|
const int gdbRegisterCount = m_registerNumbers.size();
|
||||||
|
|
||||||
// 24^done,register-values=[{number="0",value="0xf423f"},...]
|
// 24^done,register-values=[{number="0",value="0xf423f"},...]
|
||||||
const GdbMi values = response.data.findChild("register-values");
|
const GdbMi values = response.data["register-values"];
|
||||||
QTC_ASSERT(registerCount == values.children().size(), return);
|
QTC_ASSERT(registerCount == values.children().size(), return);
|
||||||
foreach (const GdbMi &item, values.children()) {
|
foreach (const GdbMi &item, values.children()) {
|
||||||
const int number = item.findChild("number").data().toInt();
|
const int number = item["number"].data().toInt();
|
||||||
if (number >= 0 && number < gdbRegisterCount)
|
if (number >= 0 && number < gdbRegisterCount)
|
||||||
registers[m_registerNumbers[number]].value = item.findChild("value").data();
|
registers[m_registerNumbers[number]].value = item["value"].data();
|
||||||
}
|
}
|
||||||
registerHandler()->setAndMarkRegisters(registers);
|
registerHandler()->setAndMarkRegisters(registers);
|
||||||
}
|
}
|
||||||
@@ -4199,16 +4202,16 @@ void GdbEngine::handleVarCreate(const GdbResponse &response)
|
|||||||
//qDebug() << "HANDLE VARIABLE CREATION:" << data.toString();
|
//qDebug() << "HANDLE VARIABLE CREATION:" << data.toString();
|
||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
data.variable = data.iname;
|
data.variable = data.iname;
|
||||||
data.updateType(response.data.findChild("type"));
|
data.updateType(response.data["type"]);
|
||||||
if (watchHandler()->isExpandedIName(data.iname)
|
if (watchHandler()->isExpandedIName(data.iname)
|
||||||
&& !response.data.findChild("children").isValid())
|
&& !response.data["children"].isValid())
|
||||||
data.setChildrenNeeded();
|
data.setChildrenNeeded();
|
||||||
else
|
else
|
||||||
data.setChildrenUnneeded();
|
data.setChildrenUnneeded();
|
||||||
data.updateChildCount(response.data.findChild("numchild"));
|
data.updateChildCount(response.data["numchild"]);
|
||||||
insertData(data);
|
insertData(data);
|
||||||
} else {
|
} else {
|
||||||
data.setError(QString::fromLocal8Bit(response.data.findChild("msg").data()));
|
data.setError(QString::fromLocal8Bit(response.data["msg"].data()));
|
||||||
if (data.isWatcher()) {
|
if (data.isWatcher()) {
|
||||||
data.value = WatchData::msgNotInScope();
|
data.value = WatchData::msgNotInScope();
|
||||||
data.type = " ";
|
data.type = " ";
|
||||||
@@ -4225,7 +4228,7 @@ void GdbEngine::handleDebuggingHelperSetup(const GdbResponse &response)
|
|||||||
{
|
{
|
||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
} else {
|
} else {
|
||||||
QString msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
|
QString msg = QString::fromLocal8Bit(response.data["msg"].data());
|
||||||
showStatusMessage(tr("Custom dumper setup: %1").arg(msg), 10000);
|
showStatusMessage(tr("Custom dumper setup: %1").arg(msg), 10000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4256,9 +4259,9 @@ WatchData GdbEngine::localVariable(const GdbMi &item,
|
|||||||
numExps += int(child.name() == "exp");
|
numExps += int(child.name() == "exp");
|
||||||
if (numExps > 1)
|
if (numExps > 1)
|
||||||
return WatchData();
|
return WatchData();
|
||||||
name = item.findChild("exp").data();
|
name = item["exp"].data();
|
||||||
} else {
|
} else {
|
||||||
name = item.findChild("name").data();
|
name = item["name"].data();
|
||||||
}
|
}
|
||||||
const QMap<QByteArray, int>::iterator it = seen->find(name);
|
const QMap<QByteArray, int>::iterator it = seen->find(name);
|
||||||
if (it != seen->end()) {
|
if (it != seen->end()) {
|
||||||
@@ -4285,7 +4288,7 @@ WatchData GdbEngine::localVariable(const GdbMi &item,
|
|||||||
data.iname = "local." + name;
|
data.iname = "local." + name;
|
||||||
data.name = nam;
|
data.name = nam;
|
||||||
data.exp = name;
|
data.exp = name;
|
||||||
data.updateType(item.findChild("type"));
|
data.updateType(item["type"]);
|
||||||
if (uninitializedVariables.contains(data.name)) {
|
if (uninitializedVariables.contains(data.name)) {
|
||||||
data.setError(WatchData::msgNotInScope());
|
data.setError(WatchData::msgNotInScope());
|
||||||
return data;
|
return data;
|
||||||
@@ -4305,7 +4308,7 @@ WatchData GdbEngine::localVariable(const GdbMi &item,
|
|||||||
if (!watchHandler()->isExpandedIName(data.iname))
|
if (!watchHandler()->isExpandedIName(data.iname))
|
||||||
data.setChildrenUnneeded();
|
data.setChildrenUnneeded();
|
||||||
|
|
||||||
GdbMi t = item.findChild("numchild");
|
GdbMi t = item["numchild"];
|
||||||
if (t.isValid())
|
if (t.isValid())
|
||||||
data.setHasChildren(t.data().toInt() > 0);
|
data.setHasChildren(t.data().toInt() > 0);
|
||||||
else if (isPointerType(data.type) || data.name == QLatin1String("this"))
|
else if (isPointerType(data.type) || data.name == QLatin1String("this"))
|
||||||
@@ -4435,12 +4438,12 @@ void GdbEngine::handleFetchMemory(const GdbResponse &response)
|
|||||||
MemoryAgentCookie ac = response.cookie.value<MemoryAgentCookie>();
|
MemoryAgentCookie ac = response.cookie.value<MemoryAgentCookie>();
|
||||||
QTC_ASSERT(ac.agent, return);
|
QTC_ASSERT(ac.agent, return);
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
GdbMi memory = response.data.findChild("memory");
|
GdbMi memory = response.data["memory"];
|
||||||
QTC_ASSERT(memory.children().size() <= 1, return);
|
QTC_ASSERT(memory.children().size() <= 1, return);
|
||||||
if (memory.children().isEmpty())
|
if (memory.children().isEmpty())
|
||||||
return;
|
return;
|
||||||
GdbMi memory0 = memory.children().at(0); // we asked for only one 'row'
|
GdbMi memory0 = memory.children().at(0); // we asked for only one 'row'
|
||||||
GdbMi data = memory0.findChild("data");
|
GdbMi data = memory0["data"];
|
||||||
foreach (const GdbMi &child, data.children()) {
|
foreach (const GdbMi &child, data.children()) {
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
unsigned char c = '?';
|
unsigned char c = '?';
|
||||||
@@ -4592,11 +4595,11 @@ void GdbEngine::fetchDisassemblerByCliRangePlain(const DisassemblerAgentCookie &
|
|||||||
static DisassemblerLine parseLine(const GdbMi &line)
|
static DisassemblerLine parseLine(const GdbMi &line)
|
||||||
{
|
{
|
||||||
DisassemblerLine dl;
|
DisassemblerLine dl;
|
||||||
QByteArray address = line.findChild("address").data();
|
QByteArray address = line["address"].data();
|
||||||
dl.address = address.toULongLong(0, 0);
|
dl.address = address.toULongLong(0, 0);
|
||||||
dl.data = _(line.findChild("inst").data());
|
dl.data = _(line["inst"].data());
|
||||||
dl.function = _(line.findChild("func-name").data());
|
dl.function = _(line["func-name"].data());
|
||||||
dl.offset = line.findChild("offset").data().toUInt();
|
dl.offset = line["offset"].data().toUInt();
|
||||||
return dl;
|
return dl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4621,10 +4624,10 @@ DisassemblerLines GdbEngine::parseMiDisassembler(const GdbMi &lines)
|
|||||||
// FIXME: Performance?
|
// FIXME: Performance?
|
||||||
foreach (const GdbMi &child, lines.children()) {
|
foreach (const GdbMi &child, lines.children()) {
|
||||||
if (child.hasName("src_and_asm_line")) {
|
if (child.hasName("src_and_asm_line")) {
|
||||||
const QString fileName = QFile::decodeName(child.findChild("file").data());
|
const QString fileName = QFile::decodeName(child["file"].data());
|
||||||
const uint line = child.findChild("line").data().toUInt();
|
const uint line = child["line"].data().toUInt();
|
||||||
result.appendSourceLine(fileName, line);
|
result.appendSourceLine(fileName, line);
|
||||||
GdbMi insn = child.findChild("line_asm_insn");
|
GdbMi insn = child["line_asm_insn"];
|
||||||
foreach (const GdbMi &item, insn.children())
|
foreach (const GdbMi &item, insn.children())
|
||||||
result.appendLine(parseLine(item));
|
result.appendLine(parseLine(item));
|
||||||
} else {
|
} else {
|
||||||
@@ -4651,7 +4654,7 @@ DisassemblerLines GdbEngine::parseDisassembler(const GdbResponse &response)
|
|||||||
// FIXME: Check whether wrapping this into -interpreter-exec console
|
// FIXME: Check whether wrapping this into -interpreter-exec console
|
||||||
// (i.e. usgind the 'ConsoleCommand' GdbCommandFlag makes a
|
// (i.e. usgind the 'ConsoleCommand' GdbCommandFlag makes a
|
||||||
// difference.
|
// difference.
|
||||||
GdbMi lines = response.data.findChild("asm_insns");
|
GdbMi lines = response.data["asm_insns"];
|
||||||
if (lines.isValid())
|
if (lines.isValid())
|
||||||
return parseMiDisassembler(lines);
|
return parseMiDisassembler(lines);
|
||||||
return parseCliDisassembler(response.consoleStreamOutput);
|
return parseCliDisassembler(response.consoleStreamOutput);
|
||||||
@@ -4736,7 +4739,7 @@ void GdbEngine::handleFetchDisassemblerByCliRangePlain(const GdbResponse &respon
|
|||||||
//76^error,msg="No function contains program counter for selected..."
|
//76^error,msg="No function contains program counter for selected..."
|
||||||
//76^error,msg="No function contains specified address."
|
//76^error,msg="No function contains specified address."
|
||||||
//>568^error,msg="Line number 0 out of range;
|
//>568^error,msg="Line number 0 out of range;
|
||||||
QByteArray msg = response.data.findChild("msg").data();
|
QByteArray msg = response.data["msg"].data();
|
||||||
showStatusMessage(tr("Disassembler failed: %1")
|
showStatusMessage(tr("Disassembler failed: %1")
|
||||||
.arg(QString::fromLocal8Bit(msg)), 5000);
|
.arg(QString::fromLocal8Bit(msg)), 5000);
|
||||||
}
|
}
|
||||||
@@ -5207,8 +5210,8 @@ void GdbEngine::handleNamespaceExtraction(const GdbResponse &response)
|
|||||||
void GdbEngine::handleBreakOnQFatal(const GdbResponse &response)
|
void GdbEngine::handleBreakOnQFatal(const GdbResponse &response)
|
||||||
{
|
{
|
||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
GdbMi bkpt = response.data.findChild("bkpt");
|
GdbMi bkpt = response.data["bkpt"];
|
||||||
GdbMi number = bkpt.findChild("number");
|
GdbMi number = bkpt["number"];
|
||||||
BreakpointResponseId rid(number.data());
|
BreakpointResponseId rid(number.data());
|
||||||
if (rid.isValid()) {
|
if (rid.isValid()) {
|
||||||
m_qFatalBreakpointResponseId = rid;
|
m_qFatalBreakpointResponseId = rid;
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
|
|||||||
}
|
}
|
||||||
GdbMi all;
|
GdbMi all;
|
||||||
all.fromStringMultiple(out);
|
all.fromStringMultiple(out);
|
||||||
GdbMi data = all.findChild("data");
|
GdbMi data = all["data"];
|
||||||
|
|
||||||
WatchHandler *handler = watchHandler();
|
WatchHandler *handler = watchHandler();
|
||||||
QList<WatchData> list;
|
QList<WatchData> list;
|
||||||
@@ -161,23 +161,23 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
|
|||||||
|
|
||||||
foreach (const GdbMi &child, data.children()) {
|
foreach (const GdbMi &child, data.children()) {
|
||||||
WatchData dummy;
|
WatchData dummy;
|
||||||
dummy.iname = child.findChild("iname").data();
|
dummy.iname = child["iname"].data();
|
||||||
GdbMi wname = child.findChild("wname");
|
GdbMi wname = child["wname"];
|
||||||
if (wname.isValid()) {
|
if (wname.isValid()) {
|
||||||
// Happens (only) for watched expressions. They are encoded as
|
// Happens (only) for watched expressions. They are encoded as
|
||||||
// base64 encoded 8 bit data, without quotes
|
// base64 encoded 8 bit data, without quotes
|
||||||
dummy.name = decodeData(wname.data(), Base64Encoded8Bit);
|
dummy.name = decodeData(wname.data(), Base64Encoded8Bit);
|
||||||
dummy.exp = dummy.name.toUtf8();
|
dummy.exp = dummy.name.toUtf8();
|
||||||
} else {
|
} else {
|
||||||
dummy.name = _(child.findChild("name").data());
|
dummy.name = _(child["name"].data());
|
||||||
}
|
}
|
||||||
parseWatchData(handler->expandedINames(), dummy, child, &list);
|
parseWatchData(handler->expandedINames(), dummy, child, &list);
|
||||||
}
|
}
|
||||||
const GdbMi typeInfo = all.findChild("typeinfo");
|
const GdbMi typeInfo = all["typeinfo"];
|
||||||
if (typeInfo.type() == GdbMi::List) {
|
if (typeInfo.type() == GdbMi::List) {
|
||||||
foreach (const GdbMi &s, typeInfo.children()) {
|
foreach (const GdbMi &s, typeInfo.children()) {
|
||||||
const GdbMi name = s.findChild("name");
|
const GdbMi name = s["name"];
|
||||||
const GdbMi size = s.findChild("size");
|
const GdbMi size = s["size"];
|
||||||
if (name.isValid() && size.isValid())
|
if (name.isValid() && size.isValid())
|
||||||
m_typeInfoCache.insert(QByteArray::fromBase64(name.data()),
|
m_typeInfoCache.insert(QByteArray::fromBase64(name.data()),
|
||||||
TypeInfo(size.data().toUInt()));
|
TypeInfo(size.data().toUInt()));
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ void GdbRemoteServerEngine::handleFileExecAndSymbols(const GdbResponse &response
|
|||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
callTargetRemote();
|
callTargetRemote();
|
||||||
} else {
|
} else {
|
||||||
QByteArray reason = response.data.findChild("msg").data();
|
QByteArray reason = response.data["msg"].data();
|
||||||
QString msg = tr("Reading debug information failed:\n");
|
QString msg = tr("Reading debug information failed:\n");
|
||||||
msg += QString::fromLocal8Bit(reason);
|
msg += QString::fromLocal8Bit(reason);
|
||||||
if (reason.endsWith("No such file or directory.")) {
|
if (reason.endsWith("No such file or directory.")) {
|
||||||
@@ -300,7 +300,7 @@ void GdbRemoteServerEngine::handleTargetRemote(const GdbResponse &response)
|
|||||||
} else {
|
} else {
|
||||||
// 16^error,msg="hd:5555: Connection timed out."
|
// 16^error,msg="hd:5555: Connection timed out."
|
||||||
QString msg = msgConnectRemoteServerFailed(
|
QString msg = msgConnectRemoteServerFailed(
|
||||||
QString::fromLocal8Bit(response.data.findChild("msg").data()));
|
QString::fromLocal8Bit(response.data["msg"].data()));
|
||||||
notifyInferiorSetupFailed(msg);
|
notifyInferiorSetupFailed(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -320,7 +320,7 @@ void GdbRemoteServerEngine::handleTargetExtendedRemote(const GdbResponse &respon
|
|||||||
postCommand("attach " + QByteArray::number(m_targetPid), CB(handleTargetExtendedAttach));
|
postCommand("attach " + QByteArray::number(m_targetPid), CB(handleTargetExtendedAttach));
|
||||||
} else {
|
} else {
|
||||||
QString msg = msgConnectRemoteServerFailed(
|
QString msg = msgConnectRemoteServerFailed(
|
||||||
QString::fromLocal8Bit(response.data.findChild("msg").data()));
|
QString::fromLocal8Bit(response.data["msg"].data()));
|
||||||
notifyInferiorSetupFailed(msg);
|
notifyInferiorSetupFailed(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -333,7 +333,7 @@ void GdbRemoteServerEngine::handleTargetExtendedAttach(const GdbResponse &respon
|
|||||||
handleInferiorPrepared();
|
handleInferiorPrepared();
|
||||||
} else {
|
} else {
|
||||||
QString msg = msgConnectRemoteServerFailed(
|
QString msg = msgConnectRemoteServerFailed(
|
||||||
QString::fromLocal8Bit(response.data.findChild("msg").data()));
|
QString::fromLocal8Bit(response.data["msg"].data()));
|
||||||
notifyInferiorSetupFailed(msg);
|
notifyInferiorSetupFailed(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -361,7 +361,7 @@ void GdbRemoteServerEngine::handleTargetQnx(const GdbResponse &response)
|
|||||||
} else {
|
} else {
|
||||||
// 16^error,msg="hd:5555: Connection timed out."
|
// 16^error,msg="hd:5555: Connection timed out."
|
||||||
QString msg = msgConnectRemoteServerFailed(
|
QString msg = msgConnectRemoteServerFailed(
|
||||||
QString::fromLocal8Bit(response.data.findChild("msg").data()));
|
QString::fromLocal8Bit(response.data["msg"].data()));
|
||||||
notifyInferiorSetupFailed(msg);
|
notifyInferiorSetupFailed(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -378,13 +378,13 @@ void GdbRemoteServerEngine::handleAttach(const GdbResponse &response)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GdbResultError:
|
case GdbResultError:
|
||||||
if (response.data.findChild("msg").data() == "ptrace: Operation not permitted.") {
|
if (response.data["msg"].data() == "ptrace: Operation not permitted.") {
|
||||||
notifyInferiorSetupFailed(DumperHelper::msgPtraceError(startParameters().startMode));
|
notifyInferiorSetupFailed(DumperHelper::msgPtraceError(startParameters().startMode));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// if msg != "ptrace: ..." fall through
|
// if msg != "ptrace: ..." fall through
|
||||||
default:
|
default:
|
||||||
QString msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
|
QString msg = QString::fromLocal8Bit(response.data["msg"].data());
|
||||||
notifyInferiorSetupFailed(msg);
|
notifyInferiorSetupFailed(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -418,7 +418,7 @@ void GdbRemoteServerEngine::handleExecRun(const GdbResponse &response)
|
|||||||
showMessage(_("INFERIOR STARTED"));
|
showMessage(_("INFERIOR STARTED"));
|
||||||
showMessage(msgInferiorSetupOk(), StatusBar);
|
showMessage(msgInferiorSetupOk(), StatusBar);
|
||||||
} else {
|
} else {
|
||||||
QString msg = QString::fromLocal8Bit(response.data.findChild("msg").data());
|
QString msg = QString::fromLocal8Bit(response.data["msg"].data());
|
||||||
showMessage(msg);
|
showMessage(msg);
|
||||||
notifyEngineRunFailed();
|
notifyEngineRunFailed();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,11 +168,11 @@ void GdbTermEngine::handleStubAttached(const GdbResponse &response)
|
|||||||
handleInferiorPrepared();
|
handleInferiorPrepared();
|
||||||
break;
|
break;
|
||||||
case GdbResultError:
|
case GdbResultError:
|
||||||
if (response.data.findChild("msg").data() == "ptrace: Operation not permitted.") {
|
if (response.data["msg"].data() == "ptrace: Operation not permitted.") {
|
||||||
notifyInferiorSetupFailed(DumperHelper::msgPtraceError(startParameters().startMode));
|
notifyInferiorSetupFailed(DumperHelper::msgPtraceError(startParameters().startMode));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
notifyInferiorSetupFailed(QString::fromLocal8Bit(response.data.findChild("msg").data()));
|
notifyInferiorSetupFailed(QString::fromLocal8Bit(response.data["msg"].data()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
notifyInferiorSetupFailed(QString::fromLatin1("Invalid response %1").arg(response.resultClass));
|
notifyInferiorSetupFailed(QString::fromLatin1("Invalid response %1").arg(response.resultClass));
|
||||||
|
|||||||
@@ -411,36 +411,36 @@ void LldbEngine::attemptBreakpointSynchronization()
|
|||||||
void LldbEngine::updateBreakpointData(const GdbMi &bkpt, bool added)
|
void LldbEngine::updateBreakpointData(const GdbMi &bkpt, bool added)
|
||||||
{
|
{
|
||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
BreakpointModelId id = BreakpointModelId(bkpt.findChild("modelid").data());
|
BreakpointModelId id = BreakpointModelId(bkpt["modelid"].data());
|
||||||
BreakpointResponse response = handler->response(id);
|
BreakpointResponse response = handler->response(id);
|
||||||
BreakpointResponseId rid = BreakpointResponseId(bkpt.findChild("lldbid").data());
|
BreakpointResponseId rid = BreakpointResponseId(bkpt["lldbid"].data());
|
||||||
if (added)
|
if (added)
|
||||||
response.id = rid;
|
response.id = rid;
|
||||||
QTC_CHECK(response.id == rid);
|
QTC_CHECK(response.id == rid);
|
||||||
response.address = 0;
|
response.address = 0;
|
||||||
response.enabled = bkpt.findChild("enabled").data().toInt();
|
response.enabled = bkpt["enabled"].data().toInt();
|
||||||
response.ignoreCount = bkpt.findChild("ignorecount").data().toInt();
|
response.ignoreCount = bkpt["ignorecount"].data().toInt();
|
||||||
response.condition = bkpt.findChild("condition").data();
|
response.condition = bkpt["condition"].data();
|
||||||
response.hitCount = bkpt.findChild("hitcount").data().toInt();
|
response.hitCount = bkpt["hitcount"].data().toInt();
|
||||||
|
|
||||||
if (added) {
|
if (added) {
|
||||||
// Added.
|
// Added.
|
||||||
GdbMi locations = bkpt.findChild("locations");
|
GdbMi locations = bkpt["locations"];
|
||||||
const int numChild = locations.children().size();
|
const int numChild = locations.children().size();
|
||||||
if (numChild > 1) {
|
if (numChild > 1) {
|
||||||
foreach (const GdbMi &location, locations.children()) {
|
foreach (const GdbMi &location, locations.children()) {
|
||||||
BreakpointResponse sub;
|
BreakpointResponse sub;
|
||||||
sub.id = BreakpointResponseId(rid.majorPart(),
|
sub.id = BreakpointResponseId(rid.majorPart(),
|
||||||
location.findChild("subid").data().toUShort());
|
location["subid"].data().toUShort());
|
||||||
sub.type = response.type;
|
sub.type = response.type;
|
||||||
sub.address = location.findChild("addr").toAddress();
|
sub.address = location["addr"].toAddress();
|
||||||
sub.functionName = QString::fromUtf8(location.findChild("func").data());
|
sub.functionName = QString::fromUtf8(location["func"].data());
|
||||||
handler->insertSubBreakpoint(id, sub);
|
handler->insertSubBreakpoint(id, sub);
|
||||||
}
|
}
|
||||||
} else if (numChild == 1) {
|
} else if (numChild == 1) {
|
||||||
const GdbMi location = locations.childAt(0);
|
const GdbMi location = locations.childAt(0);
|
||||||
response.address = location.findChild("addr").toAddress();
|
response.address = location["addr"].toAddress();
|
||||||
response.functionName = QString::fromUtf8(location.findChild("func").data());
|
response.functionName = QString::fromUtf8(location["func"].data());
|
||||||
} else {
|
} else {
|
||||||
QTC_CHECK(false);
|
QTC_CHECK(false);
|
||||||
}
|
}
|
||||||
@@ -459,11 +459,11 @@ void LldbEngine::refreshDisassembly(const GdbMi &lines)
|
|||||||
|
|
||||||
foreach (const GdbMi &line, lines.children()) {
|
foreach (const GdbMi &line, lines.children()) {
|
||||||
DisassemblerLine dl;
|
DisassemblerLine dl;
|
||||||
QByteArray address = line.findChild("address").data();
|
QByteArray address = line["address"].data();
|
||||||
dl.address = address.toULongLong(0, 0);
|
dl.address = address.toULongLong(0, 0);
|
||||||
dl.data = _(line.findChild("inst").data());
|
dl.data = _(line["inst"].data());
|
||||||
dl.function = _(line.findChild("func-name").data());
|
dl.function = _(line["func-name"].data());
|
||||||
dl.offset = line.findChild("offset").data().toUInt();
|
dl.offset = line["offset"].data().toUInt();
|
||||||
result.appendLine(dl);
|
result.appendLine(dl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,21 +475,21 @@ void LldbEngine::refreshDisassembly(const GdbMi &lines)
|
|||||||
void LldbEngine::refreshBreakpoints(const GdbMi &bkpts)
|
void LldbEngine::refreshBreakpoints(const GdbMi &bkpts)
|
||||||
{
|
{
|
||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
GdbMi added = bkpts.findChild("added");
|
GdbMi added = bkpts["added"];
|
||||||
GdbMi changed = bkpts.findChild("changed");
|
GdbMi changed = bkpts["changed"];
|
||||||
GdbMi removed = bkpts.findChild("removed");
|
GdbMi removed = bkpts["removed"];
|
||||||
foreach (const GdbMi &bkpt, added.children()) {
|
foreach (const GdbMi &bkpt, added.children()) {
|
||||||
BreakpointModelId id = BreakpointModelId(bkpt.findChild("modelid").data());
|
BreakpointModelId id = BreakpointModelId(bkpt["modelid"].data());
|
||||||
QTC_CHECK(handler->state(id) == BreakpointInsertProceeding);
|
QTC_CHECK(handler->state(id) == BreakpointInsertProceeding);
|
||||||
updateBreakpointData(bkpt, true);
|
updateBreakpointData(bkpt, true);
|
||||||
}
|
}
|
||||||
foreach (const GdbMi &bkpt, changed.children()) {
|
foreach (const GdbMi &bkpt, changed.children()) {
|
||||||
BreakpointModelId id = BreakpointModelId(bkpt.findChild("modelid").data());
|
BreakpointModelId id = BreakpointModelId(bkpt["modelid"].data());
|
||||||
QTC_CHECK(handler->state(id) == BreakpointChangeProceeding);
|
QTC_CHECK(handler->state(id) == BreakpointChangeProceeding);
|
||||||
updateBreakpointData(bkpt, false);
|
updateBreakpointData(bkpt, false);
|
||||||
}
|
}
|
||||||
foreach (const GdbMi &bkpt, removed.children()) {
|
foreach (const GdbMi &bkpt, removed.children()) {
|
||||||
BreakpointModelId id = BreakpointModelId(bkpt.findChild("modelid").data());
|
BreakpointModelId id = BreakpointModelId(bkpt["modelid"].data());
|
||||||
QTC_CHECK(handler->state(id) == BreakpointRemoveProceeding);
|
QTC_CHECK(handler->state(id) == BreakpointRemoveProceeding);
|
||||||
handler->notifyBreakpointRemoveOk(id);
|
handler->notifyBreakpointRemoveOk(id);
|
||||||
}
|
}
|
||||||
@@ -514,8 +514,8 @@ void LldbEngine::refreshModules(const GdbMi &modules)
|
|||||||
Modules mods;
|
Modules mods;
|
||||||
foreach (const GdbMi &item, modules.children()) {
|
foreach (const GdbMi &item, modules.children()) {
|
||||||
Module module;
|
Module module;
|
||||||
module.modulePath = QString::fromUtf8(item.findChild("file").data());
|
module.modulePath = QString::fromUtf8(item["file"].data());
|
||||||
module.moduleName = QString::fromUtf8(item.findChild("name").data());
|
module.moduleName = QString::fromUtf8(item["name"].data());
|
||||||
module.symbolsRead = Module::UnknownReadState;
|
module.symbolsRead = Module::UnknownReadState;
|
||||||
module.startAddress = 0;
|
module.startAddress = 0;
|
||||||
// item.findChild("loaded_addr").data().toULongLong(0, 0);
|
// item.findChild("loaded_addr").data().toULongLong(0, 0);
|
||||||
@@ -816,15 +816,15 @@ void LldbEngine::refreshLocals(const GdbMi &vars)
|
|||||||
|
|
||||||
foreach (const GdbMi &child, vars.children()) {
|
foreach (const GdbMi &child, vars.children()) {
|
||||||
WatchData dummy;
|
WatchData dummy;
|
||||||
dummy.iname = child.findChild("iname").data();
|
dummy.iname = child["iname"].data();
|
||||||
GdbMi wname = child.findChild("wname");
|
GdbMi wname = child["wname"];
|
||||||
if (wname.isValid()) {
|
if (wname.isValid()) {
|
||||||
// Happens (only) for watched expressions. They are encoded as
|
// Happens (only) for watched expressions. They are encoded as
|
||||||
// base64 encoded 8 bit data, without quotes
|
// base64 encoded 8 bit data, without quotes
|
||||||
dummy.name = decodeData(wname.data(), Base64Encoded8Bit);
|
dummy.name = decodeData(wname.data(), Base64Encoded8Bit);
|
||||||
dummy.exp = dummy.name.toUtf8();
|
dummy.exp = dummy.name.toUtf8();
|
||||||
} else {
|
} else {
|
||||||
dummy.name = _(child.findChild("name").data());
|
dummy.name = _(child["name"].data());
|
||||||
}
|
}
|
||||||
parseWatchData(handler->expandedINames(), dummy, child, &list);
|
parseWatchData(handler->expandedINames(), dummy, child, &list);
|
||||||
}
|
}
|
||||||
@@ -837,18 +837,18 @@ void LldbEngine::refreshStack(const GdbMi &stack)
|
|||||||
// emit stackFrameCompleted();
|
// emit stackFrameCompleted();
|
||||||
StackHandler *handler = stackHandler();
|
StackHandler *handler = stackHandler();
|
||||||
StackFrames frames;
|
StackFrames frames;
|
||||||
foreach (const GdbMi &item, stack.findChild("frames").children()) {
|
foreach (const GdbMi &item, stack["frames"].children()) {
|
||||||
StackFrame frame;
|
StackFrame frame;
|
||||||
frame.level = item.findChild("level").data().toInt();
|
frame.level = item["level"].data().toInt();
|
||||||
frame.file = QString::fromLatin1(item.findChild("file").data());
|
frame.file = QString::fromLatin1(item["file"].data());
|
||||||
frame.function = QString::fromLatin1(item.findChild("func").data());
|
frame.function = QString::fromLatin1(item["func"].data());
|
||||||
frame.from = QString::fromLatin1(item.findChild("func").data());
|
frame.from = QString::fromLatin1(item["func"].data());
|
||||||
frame.line = item.findChild("line").data().toInt();
|
frame.line = item["line"].data().toInt();
|
||||||
frame.address = item.findChild("addr").toAddress();
|
frame.address = item["addr"].toAddress();
|
||||||
frame.usable = QFileInfo(frame.file).isReadable();
|
frame.usable = QFileInfo(frame.file).isReadable();
|
||||||
frames.append(frame);
|
frames.append(frame);
|
||||||
}
|
}
|
||||||
bool canExpand = stack.findChild("hasmore").data().toInt();
|
bool canExpand = stack["hasmore"].data().toInt();
|
||||||
debuggerCore()->action(ExpandStack)->setEnabled(canExpand);
|
debuggerCore()->action(ExpandStack)->setEnabled(canExpand);
|
||||||
handler->setFrames(frames);
|
handler->setFrames(frames);
|
||||||
}
|
}
|
||||||
@@ -859,8 +859,8 @@ void LldbEngine::refreshRegisters(const GdbMi ®isters)
|
|||||||
Registers regs;
|
Registers regs;
|
||||||
foreach (const GdbMi &item, registers.children()) {
|
foreach (const GdbMi &item, registers.children()) {
|
||||||
Register reg;
|
Register reg;
|
||||||
reg.name = item.findChild("name").data();
|
reg.name = item["name"].data();
|
||||||
reg.value = item.findChild("value").data();
|
reg.value = item["value"].data();
|
||||||
//reg.type = item.findChild("type").data();
|
//reg.type = item.findChild("type").data();
|
||||||
regs.append(reg);
|
regs.append(reg);
|
||||||
}
|
}
|
||||||
@@ -925,8 +925,8 @@ void LldbEngine::refreshState(const GdbMi &reportedState)
|
|||||||
|
|
||||||
void LldbEngine::refreshLocation(const GdbMi &reportedLocation)
|
void LldbEngine::refreshLocation(const GdbMi &reportedLocation)
|
||||||
{
|
{
|
||||||
QByteArray file = reportedLocation.findChild("file").data();
|
QByteArray file = reportedLocation["file"].data();
|
||||||
int line = reportedLocation.findChild("line").data().toInt();
|
int line = reportedLocation["line"].data().toInt();
|
||||||
gotoLocation(Location(QString::fromUtf8(file), line));
|
gotoLocation(Location(QString::fromUtf8(file), line));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -404,8 +404,8 @@ void PdbEngine::handleListModules(const PdbResponse &response)
|
|||||||
Modules modules;
|
Modules modules;
|
||||||
foreach (const GdbMi &item, out.children()) {
|
foreach (const GdbMi &item, out.children()) {
|
||||||
Module module;
|
Module module;
|
||||||
module.moduleName = _(item.findChild("name").data());
|
module.moduleName = _(item["name"].data());
|
||||||
QString path = _(item.findChild("value").data());
|
QString path = _(item["value"].data());
|
||||||
int pos = path.indexOf(_("' from '"));
|
int pos = path.indexOf(_("' from '"));
|
||||||
if (pos != -1) {
|
if (pos != -1) {
|
||||||
path = path.mid(pos + 8);
|
path = path.mid(pos + 8);
|
||||||
@@ -435,7 +435,7 @@ void PdbEngine::handleListSymbols(const PdbResponse &response)
|
|||||||
QString moduleName = response.cookie.toString();
|
QString moduleName = response.cookie.toString();
|
||||||
foreach (const GdbMi &item, out.children()) {
|
foreach (const GdbMi &item, out.children()) {
|
||||||
Symbol symbol;
|
Symbol symbol;
|
||||||
symbol.name = _(item.findChild("name").data());
|
symbol.name = _(item["name"].data());
|
||||||
symbols.append(symbol);
|
symbols.append(symbol);
|
||||||
}
|
}
|
||||||
debuggerCore()->showModuleSymbols(moduleName, symbols);
|
debuggerCore()->showModuleSymbols(moduleName, symbols);
|
||||||
@@ -819,8 +819,8 @@ void PdbEngine::handleListLocals(const PdbResponse &response)
|
|||||||
WatchHandler *handler = watchHandler();
|
WatchHandler *handler = watchHandler();
|
||||||
foreach (const GdbMi &child, all.children()) {
|
foreach (const GdbMi &child, all.children()) {
|
||||||
WatchData dummy;
|
WatchData dummy;
|
||||||
dummy.iname = child.findChild("iname").data();
|
dummy.iname = child["iname"].data();
|
||||||
dummy.name = _(child.findChild("name").data());
|
dummy.name = _(child["name"].data());
|
||||||
//qDebug() << "CHILD: " << child.toString();
|
//qDebug() << "CHILD: " << child.toString();
|
||||||
parseWatchData(handler->expandedINames(), dummy, child, &list);
|
parseWatchData(handler->expandedINames(), dummy, child, &list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -424,30 +424,30 @@ void ThreadsHandler::updateThreads(const GdbMi &data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ThreadId currentId;
|
ThreadId currentId;
|
||||||
const GdbMi current = data.findChild("current-thread-id");
|
const GdbMi current = data["current-thread-id"];
|
||||||
if (current.isValid())
|
if (current.isValid())
|
||||||
currentId = ThreadId(current.data().toLongLong());
|
currentId = ThreadId(current.data().toLongLong());
|
||||||
|
|
||||||
const QList<GdbMi> items = data.findChild("threads").children();
|
const QList<GdbMi> items = data["threads"].children();
|
||||||
const int n = items.size();
|
const int n = items.size();
|
||||||
for (int index = 0; index != n; ++index) {
|
for (int index = 0; index != n; ++index) {
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const GdbMi item = items.at(index);
|
const GdbMi item = items.at(index);
|
||||||
const GdbMi frame = item.findChild("frame");
|
const GdbMi frame = item["frame"];
|
||||||
ThreadData thread;
|
ThreadData thread;
|
||||||
thread.id = ThreadId(item.findChild("id").data().toInt());
|
thread.id = ThreadId(item["id"].data().toInt());
|
||||||
thread.targetId = QString::fromLatin1(item.findChild("target-id").data());
|
thread.targetId = QString::fromLatin1(item["target-id"].data());
|
||||||
thread.details = QString::fromLatin1(item.findChild("details").data());
|
thread.details = QString::fromLatin1(item["details"].data());
|
||||||
thread.core = QString::fromLatin1(item.findChild("core").data());
|
thread.core = QString::fromLatin1(item["core"].data());
|
||||||
thread.state = QString::fromLatin1(item.findChild("state").data());
|
thread.state = QString::fromLatin1(item["state"].data());
|
||||||
thread.address = frame.findChild("addr").data().toULongLong(&ok, 0);
|
thread.address = frame["addr"].data().toULongLong(&ok, 0);
|
||||||
thread.function = QString::fromLatin1(frame.findChild("func").data());
|
thread.function = QString::fromLatin1(frame["func"].data());
|
||||||
thread.fileName = QString::fromLatin1(frame.findChild("fullname").data());
|
thread.fileName = QString::fromLatin1(frame["fullname"].data());
|
||||||
thread.lineNumber = frame.findChild("line").data().toInt();
|
thread.lineNumber = frame["line"].data().toInt();
|
||||||
thread.module = QString::fromLocal8Bit(frame.findChild("from").data());
|
thread.module = QString::fromLocal8Bit(frame["from"].data());
|
||||||
thread.stopped = true;
|
thread.stopped = true;
|
||||||
// Non-GDB (Cdb2) output name here.
|
// Non-GDB (Cdb2) output name here.
|
||||||
thread.name = QString::fromLatin1(frame.findChild("name").data());
|
thread.name = QString::fromLatin1(frame["name"].data());
|
||||||
if (thread.state == QLatin1String("running"))
|
if (thread.state == QLatin1String("running"))
|
||||||
thread.stopped = false;
|
thread.stopped = false;
|
||||||
if (thread.id == currentId)
|
if (thread.id == currentId)
|
||||||
|
|||||||
@@ -415,9 +415,9 @@ QByteArray WatchData::hexAddress() const
|
|||||||
|
|
||||||
void WatchData::updateValue(const GdbMi &item)
|
void WatchData::updateValue(const GdbMi &item)
|
||||||
{
|
{
|
||||||
GdbMi value = item.findChild("value");
|
GdbMi value = item["value"];
|
||||||
if (value.isValid()) {
|
if (value.isValid()) {
|
||||||
int encoding = item.findChild("valueencoded").data().toInt();
|
int encoding = item["valueencoded"].data().toInt();
|
||||||
setValue(decodeData(value.data(), encoding));
|
setValue(decodeData(value.data(), encoding));
|
||||||
} else {
|
} else {
|
||||||
setValueNeeded();
|
setValueNeeded();
|
||||||
@@ -578,63 +578,63 @@ void parseWatchData(const QSet<QByteArray> &expandedINames,
|
|||||||
if (!isExpanded)
|
if (!isExpanded)
|
||||||
data.setChildrenUnneeded();
|
data.setChildrenUnneeded();
|
||||||
|
|
||||||
GdbMi children = item.findChild("children");
|
GdbMi children = item["children"];
|
||||||
if (children.isValid() || !isExpanded)
|
if (children.isValid() || !isExpanded)
|
||||||
data.setChildrenUnneeded();
|
data.setChildrenUnneeded();
|
||||||
|
|
||||||
data.updateType(item.findChild("type"));
|
data.updateType(item["type"]);
|
||||||
GdbMi mi = item.findChild("editvalue");
|
GdbMi mi = item["editvalue"];
|
||||||
if (mi.isValid())
|
if (mi.isValid())
|
||||||
data.editvalue = mi.data();
|
data.editvalue = mi.data();
|
||||||
|
|
||||||
mi = item.findChild("editformat");
|
mi = item["editformat"];
|
||||||
if (mi.isValid())
|
if (mi.isValid())
|
||||||
data.editformat = mi.data().toInt();
|
data.editformat = mi.data().toInt();
|
||||||
|
|
||||||
mi = item.findChild("typeformats");
|
mi = item["typeformats"];
|
||||||
if (mi.isValid())
|
if (mi.isValid())
|
||||||
data.typeFormats = QString::fromUtf8(mi.data());
|
data.typeFormats = QString::fromUtf8(mi.data());
|
||||||
|
|
||||||
mi = item.findChild("bitpos");
|
mi = item["bitpos"];
|
||||||
if (mi.isValid())
|
if (mi.isValid())
|
||||||
data.bitpos = mi.data().toInt();
|
data.bitpos = mi.data().toInt();
|
||||||
|
|
||||||
mi = item.findChild("bitsize");
|
mi = item["bitsize"];
|
||||||
if (mi.isValid())
|
if (mi.isValid())
|
||||||
data.bitsize = mi.data().toInt();
|
data.bitsize = mi.data().toInt();
|
||||||
|
|
||||||
mi = item.findChild("origaddr");
|
mi = item["origaddr"];
|
||||||
if (mi.isValid())
|
if (mi.isValid())
|
||||||
data.origaddr = mi.toAddress();
|
data.origaddr = mi.toAddress();
|
||||||
|
|
||||||
data.updateAddress(item.findChild("addr"));
|
data.updateAddress(item["addr"]);
|
||||||
data.updateValue(item);
|
data.updateValue(item);
|
||||||
|
|
||||||
setWatchDataSize(data, item.findChild("size"));
|
setWatchDataSize(data, item["size"]);
|
||||||
|
|
||||||
mi = item.findChild("exp");
|
mi = item["exp"];
|
||||||
if (mi.isValid())
|
if (mi.isValid())
|
||||||
data.exp = mi.data();
|
data.exp = mi.data();
|
||||||
|
|
||||||
setWatchDataValueEnabled(data, item.findChild("valueenabled"));
|
setWatchDataValueEnabled(data, item["valueenabled"]);
|
||||||
setWatchDataValueEditable(data, item.findChild("valueeditable"));
|
setWatchDataValueEditable(data, item["valueeditable"]);
|
||||||
data.updateChildCount(item.findChild("numchild"));
|
data.updateChildCount(item["numchild"]);
|
||||||
//qDebug() << "\nAPPEND TO LIST: " << data.toString() << "\n";
|
//qDebug() << "\nAPPEND TO LIST: " << data.toString() << "\n";
|
||||||
list->append(data);
|
list->append(data);
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
qulonglong addressBase = item.findChild("addrbase").data().toULongLong(&ok, 0);
|
qulonglong addressBase = item["addrbase"].data().toULongLong(&ok, 0);
|
||||||
qulonglong addressStep = item.findChild("addrstep").data().toULongLong(&ok, 0);
|
qulonglong addressStep = item["addrstep"].data().toULongLong(&ok, 0);
|
||||||
|
|
||||||
// Try not to repeat data too often.
|
// Try not to repeat data too often.
|
||||||
WatchData childtemplate;
|
WatchData childtemplate;
|
||||||
childtemplate.updateType(item.findChild("childtype"));
|
childtemplate.updateType(item["childtype"]);
|
||||||
childtemplate.updateChildCount(item.findChild("childnumchild"));
|
childtemplate.updateChildCount(item["childnumchild"]);
|
||||||
//qDebug() << "CHILD TEMPLATE:" << childtemplate.toString();
|
//qDebug() << "CHILD TEMPLATE:" << childtemplate.toString();
|
||||||
|
|
||||||
mi = item.findChild("arraydata");
|
mi = item["arraydata"];
|
||||||
if (mi.isValid()) {
|
if (mi.isValid()) {
|
||||||
int encoding = item.findChild("arrayencoding").data().toInt();
|
int encoding = item["arrayencoding"].data().toInt();
|
||||||
childtemplate.iname = data.iname + '.';
|
childtemplate.iname = data.iname + '.';
|
||||||
childtemplate.address = addressBase;
|
childtemplate.address = addressBase;
|
||||||
decodeArray(list, childtemplate, mi.data(), encoding);
|
decodeArray(list, childtemplate, mi.data(), encoding);
|
||||||
@@ -643,12 +643,12 @@ void parseWatchData(const QSet<QByteArray> &expandedINames,
|
|||||||
const GdbMi &child = children.children().at(i);
|
const GdbMi &child = children.children().at(i);
|
||||||
WatchData data1 = childtemplate;
|
WatchData data1 = childtemplate;
|
||||||
data1.sortId = i;
|
data1.sortId = i;
|
||||||
GdbMi name = child.findChild("name");
|
GdbMi name = child["name"];
|
||||||
if (name.isValid())
|
if (name.isValid())
|
||||||
data1.name = QString::fromLatin1(name.data());
|
data1.name = QString::fromLatin1(name.data());
|
||||||
else
|
else
|
||||||
data1.name = QString::number(i);
|
data1.name = QString::number(i);
|
||||||
GdbMi iname = child.findChild("iname");
|
GdbMi iname = child["iname"];
|
||||||
if (iname.isValid()) {
|
if (iname.isValid()) {
|
||||||
data1.iname = iname.data();
|
data1.iname = iname.data();
|
||||||
} else {
|
} else {
|
||||||
@@ -662,9 +662,9 @@ void parseWatchData(const QSet<QByteArray> &expandedINames,
|
|||||||
setWatchDataAddress(data1, addressBase);
|
setWatchDataAddress(data1, addressBase);
|
||||||
addressBase += addressStep;
|
addressBase += addressStep;
|
||||||
}
|
}
|
||||||
QByteArray key = child.findChild("key").data();
|
QByteArray key = child["key"].data();
|
||||||
if (!key.isEmpty()) {
|
if (!key.isEmpty()) {
|
||||||
int encoding = child.findChild("keyencoded").data().toInt();
|
int encoding = child["keyencoded"].data().toInt();
|
||||||
QString skey = decodeData(key, encoding);
|
QString skey = decodeData(key, encoding);
|
||||||
if (skey.size() > 13) {
|
if (skey.size() > 13) {
|
||||||
skey = skey.left(12);
|
skey = skey.left(12);
|
||||||
|
|||||||
@@ -724,10 +724,10 @@ void tst_Dumpers::dumper()
|
|||||||
QList<WatchData> list;
|
QList<WatchData> list;
|
||||||
foreach (const GdbMi &child, actual.children()) {
|
foreach (const GdbMi &child, actual.children()) {
|
||||||
WatchData dummy;
|
WatchData dummy;
|
||||||
dummy.iname = child.findChild("iname").data();
|
dummy.iname = child["iname").data();
|
||||||
dummy.name = QLatin1String(child.findChild("name").data());
|
dummy.name = QLatin1String(child["name").data());
|
||||||
if (dummy.iname == "local.qtversion")
|
if (dummy.iname == "local.qtversion")
|
||||||
context.qtVersion = child.findChild("value").data().toInt();
|
context.qtVersion = child["value").data().toInt();
|
||||||
else
|
else
|
||||||
parseWatchData(expandedINames, dummy, child, &list);
|
parseWatchData(expandedINames, dummy, child, &list);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user