本文整理汇总了C++中GdbMi类的典型用法代码示例。如果您正苦于以下问题:C++ GdbMi类的具体用法?C++ GdbMi怎么用?C++ GdbMi使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GdbMi类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: breakHandler
void LldbEngine::updateBreakpointData(const GdbMi &bkpt, bool added)
{
BreakHandler *handler = breakHandler();
BreakpointResponseId rid = BreakpointResponseId(bkpt["lldbid"].data());
BreakpointModelId id = BreakpointModelId(bkpt["modelid"].data());
Breakpoint bp = handler->breakpointById(id);
if (!bp.isValid())
bp = handler->findBreakpointByResponseId(rid);
BreakpointResponse response = bp.response();
if (added)
response.id = rid;
QTC_CHECK(response.id == rid);
response.address = 0;
response.enabled = bkpt["enabled"].toInt();
response.ignoreCount = bkpt["ignorecount"].toInt();
response.condition = QByteArray::fromHex(bkpt["condition"].data());
response.hitCount = bkpt["hitcount"].toInt();
response.fileName = bkpt["file"].toUtf8();
response.lineNumber = bkpt["line"].toInt();
GdbMi locations = bkpt["locations"];
const int numChild = int(locations.children().size());
if (numChild > 1) {
foreach (const GdbMi &location, locations.children()) {
const int locid = location["locid"].toInt();
BreakpointResponse sub;
sub.id = BreakpointResponseId(rid.majorPart(), locid);
sub.type = response.type;
sub.address = location["addr"].toAddress();
sub.functionName = location["func"].toUtf8();
sub.fileName = location["file"].toUtf8();
sub.lineNumber = location["line"].toInt();
bp.insertSubBreakpoint(sub);
}
} else if (numChild == 1) {
示例2: handleEntryPoint
void TermGdbAdapter::handleEntryPoint(const GdbResponse &response)
{
if (response.resultClass == GdbResultDone) {
GdbMi stack = response.data.findChild("stack");
if (stack.isValid() && stack.childCount() == 1)
m_engine->m_entryPoint = stack.childAt(0).findChild("addr").data();
}
}
示例3: gdbmiChildToBool
// Helper to retrieve an bool child from GDBMI
static inline bool gdbmiChildToBool(const GdbMi &parent, const char *childName, bool *target)
{
const GdbMi childBA = parent[childName];
if (childBA.isValid()) {
*target = childBA.data() == "true";
return true;
}
return false;
}
示例4: cdbIdToBreakpointId
inline ModelId cdbIdToBreakpointId(const GdbMi &data)
{
if (data.isValid()) { // Might not be valid if there is not id
bool ok;
const int id = data.data().toInt(&ok);
if (ok)
return cdbIdToBreakpointId<ModelId>(id);
}
return ModelId();
}
示例5: handleContinuation
void LldbEngine::handleContinuation(const GdbMi &data)
{
if (data.data() == "updateLocals") {
updateLocals();
} else if (data.data() == "updateAll") {
updateAll();
} else {
QTC_ASSERT(false, qDebug() << "Unknown continuation: " << data.data());
}
}
示例6: foreach
void LldbEngine::handleResponse(const QByteArray &response)
{
GdbMi all;
all.fromStringMultiple(response);
foreach (const GdbMi &item, all.children()) {
const QByteArray name = item.name();
if (name == "all") {
updateLocalsView(item);
watchHandler()->notifyUpdateFinished();
} else if (name == "dumpers") {
watchHandler()->addDumpers(item);
setupInferiorStage2();
} else if (name == "stack")
refreshStack(item);
else if (name == "registers")
refreshRegisters(item);
else if (name == "threads")
refreshThreads(item);
else if (name == "current-thread")
refreshCurrentThread(item);
else if (name == "typeinfo")
refreshTypeInfo(item);
else if (name == "state")
refreshState(item);
else if (name == "location")
refreshLocation(item);
else if (name == "modules")
refreshModules(item);
else if (name == "symbols")
refreshSymbols(item);
else if (name == "breakpoint-added")
refreshAddedBreakpoint(item);
else if (name == "breakpoint-changed")
refreshChangedBreakpoint(item);
else if (name == "breakpoint-removed")
refreshRemovedBreakpoint(item);
else if (name == "output")
refreshOutput(item);
else if (name == "disassembly")
refreshDisassembly(item);
else if (name == "memory")
refreshMemory(item);
else if (name == "full-backtrace")
showFullBacktrace(item);
else if (name == "continuation")
handleContinuation(item);
else if (name == "statusmessage") {
QString msg = QString::fromUtf8(item.data());
if (msg.size())
msg[0] = msg.at(0).toUpper();
showStatusMessage(msg);
}
}
}
示例7: gdbmiChildToInt
// Helper to retrieve an int child from GDBMI
static inline bool gdbmiChildToInt(const GdbMi &parent, const char *childName, int *target)
{
const GdbMi childBA = parent[childName];
if (childBA.isValid()) {
bool ok;
const int v = childBA.data().toInt(&ok);
if (ok) {
*target = v;
return true;
}
}
return false;
}
示例8: foreach
void PdbEngine::handleListSymbols(const PdbResponse &response)
{
GdbMi out;
out.fromString(response.data.trimmed());
Symbols symbols;
QString moduleName = response.cookie.toString();
foreach (const GdbMi &item, out.children()) {
Symbol symbol;
symbol.name = _(item.findChild("name").data());
symbols.append(symbol);
}
debuggerCore()->showModuleSymbols(moduleName, symbols);
}
示例9: parse
void WatchItem::parse(const GdbMi &data)
{
iname = data["iname"].data();
GdbMi wname = data["wname"];
if (wname.isValid()) // Happens (only) for watched expressions.
name = QString::fromUtf8(QByteArray::fromHex(wname.data()));
else
name = QString::fromLatin1(data["name"].data());
parseHelper(data);
if (wname.isValid())
exp = name.toUtf8();
}
示例10: dataChanged
void ThreadsHandler::updateThreads(const GdbMi &data)
{
// ^done,threads=[{id="1",target-id="Thread 0xb7fdc710 (LWP 4264)",
// frame={level="0",addr="0x080530bf",func="testQString",args=[],
// file="/.../app.cpp",fullname="/../app.cpp",line="1175"},
// state="stopped",core="0"}],current-thread-id="1"
// Emit changed for previous frame.
if (m_currentIndex != -1) {
dataChanged(m_currentIndex);
m_currentIndex = -1;
}
ThreadId currentId;
const GdbMi current = data["current-thread-id"];
if (current.isValid())
currentId = ThreadId(current.data().toLongLong());
const QList<GdbMi> items = data["threads"].children();
const int n = items.size();
for (int index = 0; index != n; ++index) {
const GdbMi item = items.at(index);
const GdbMi frame = item["frame"];
ThreadData thread;
thread.id = ThreadId(item["id"].toInt());
thread.targetId = item["target-id"].toLatin1();
thread.details = item["details"].toLatin1();
thread.core = item["core"].toLatin1();
thread.state = item["state"].toLatin1();
thread.address = frame["addr"].toAddress();
thread.function = frame["func"].toLatin1();
thread.fileName = frame["fullname"].toLatin1();
thread.lineNumber = frame["line"].toInt();
thread.module = QString::fromLocal8Bit(frame["from"].data());
thread.stopped = true;
thread.name = item["name"].toLatin1();
if (thread.state == QLatin1String("running"))
thread.stopped = false;
if (thread.id == currentId)
m_currentIndex = index;
updateThread(thread);
}
if (m_currentIndex != -1)
dataChanged(m_currentIndex);
updateThreadBox();
}
示例11: skipCommas
void GdbMi::parseTuple_helper(const char *&from, const char *to)
{
skipCommas(from, to);
//qDebug() << "parseTuple_helper: " << QByteArray(from, to - from);
m_type = Tuple;
while (from < to) {
if (*from == '}') {
++from;
break;
}
GdbMi child;
child.parseResultOrValue(from, to);
//qDebug() << "\n=======\n" << qPrintable(child.toString()) << "\n========\n";
if (!child.isValid())
return;
m_children += child;
skipCommas(from, to);
}
}
示例12: refreshState
void PdbEngine::refreshState(const GdbMi &reportedState)
{
QByteArray newState = reportedState.data();
if (newState == "stopped") {
notifyInferiorSpontaneousStop();
updateAll();
} else if (newState == "inferiorexited") {
notifyInferiorExited();
}
}
示例13: QTC_CHECK
void GdbMi::parseList(const char *&from, const char *to)
{
//qDebug() << "parseList: " << QByteArray(from, to - from);
QTC_CHECK(*from == '[');
++from;
m_type = List;
skipCommas(from, to);
while (from < to) {
if (*from == ']') {
++from;
break;
}
GdbMi child;
child.parseResultOrValue(from, to);
if (child.isValid())
m_children += child;
skipCommas(from, to);
}
}
示例14: setFramesAndCurrentIndex
void StackHandler::setFramesAndCurrentIndex(const GdbMi &frames, bool isFull)
{
int targetFrame = -1;
StackFrames stackFrames;
const int n = frames.childCount();
for (int i = 0; i != n; ++i) {
stackFrames.append(StackFrame::parseFrame(frames.childAt(i), m_engine->runParameters()));
const StackFrame &frame = stackFrames.back();
// Initialize top frame to the first valid frame.
const bool isValid = frame.isUsable() && !frame.function.isEmpty();
if (isValid && targetFrame == -1)
targetFrame = i;
}
bool canExpand = !isFull && (n >= action(MaximalStackDepth)->value().toInt());
action(ExpandStack)->setEnabled(canExpand);
setFrames(stackFrames, canExpand);
// We can't jump to any file if we don't have any frames.
if (stackFrames.isEmpty())
return;
// targetFrame contains the top most frame for which we have source
// information. That's typically the frame we'd like to jump to, with
// a few exceptions:
// Always jump to frame #0 when stepping by instruction.
if (m_engine->operatesByInstruction())
targetFrame = 0;
// If there is no frame with source, jump to frame #0.
if (targetFrame == -1)
targetFrame = 0;
setCurrentIndex(targetFrame);
}
示例15: fromGdbMI
void WinException::fromGdbMI(const GdbMi &gdbmi)
{
exceptionCode = gdbmi["exceptionCode"].data().toUInt();
exceptionFlags = gdbmi["exceptionFlags"].data().toUInt();
exceptionAddress = gdbmi["exceptionAddress"].data().toULongLong();
firstChance = gdbmi["firstChance"].data() != "0";
const GdbMi ginfo1 = gdbmi["exceptionInformation0"];
if (ginfo1.isValid()) {
info1 = ginfo1.data().toULongLong();
const GdbMi ginfo2 = gdbmi["exceptionInformation1"];
if (ginfo2.isValid())
info2 = ginfo1.data().toULongLong();
}
const GdbMi gLineNumber = gdbmi["exceptionLine"];
if (gLineNumber.isValid()) {
lineNumber = gLineNumber.toInt();
file = gdbmi["exceptionFile"].data();
}
function = gdbmi["exceptionFunction"].data();
}