diff --git a/src/plugins/debugger/debuggerprotocol.h b/src/plugins/debugger/debuggerprotocol.h index 82ff1472f8c..bd2ffe62f1e 100644 --- a/src/plugins/debugger/debuggerprotocol.h +++ b/src/plugins/debugger/debuggerprotocol.h @@ -191,7 +191,6 @@ public: int token; ResultClass resultClass; GdbMi data; - QVariant cookie; QByteArray logStreamOutput; QByteArray consoleStreamOutput; }; diff --git a/src/plugins/debugger/gdb/attachgdbadapter.cpp b/src/plugins/debugger/gdb/attachgdbadapter.cpp index 4766c65b702..02bfd9fa8a8 100644 --- a/src/plugins/debugger/gdb/attachgdbadapter.cpp +++ b/src/plugins/debugger/gdb/attachgdbadapter.cpp @@ -39,8 +39,6 @@ namespace Debugger { namespace Internal { -#define CB(callback) [this](const DebuggerResponse &r) { callback(r); } - /////////////////////////////////////////////////////////////////////// // // AttachGdbAdapter @@ -69,7 +67,8 @@ void GdbAttachEngine::setupInferior() { QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); const qint64 pid = startParameters().attachPID; - postCommand("attach " + QByteArray::number(pid), CB(handleAttach)); + postCommand("attach " + QByteArray::number(pid), NoFlags, + [this](const DebuggerResponse &r) { handleAttach(r); }); // Task 254674 does not want to remove them //qq->breakHandler()->removeAllBreakpoints(); } diff --git a/src/plugins/debugger/gdb/coregdbadapter.cpp b/src/plugins/debugger/gdb/coregdbadapter.cpp index 7d0ba4357f2..fc28ac70777 100644 --- a/src/plugins/debugger/gdb/coregdbadapter.cpp +++ b/src/plugins/debugger/gdb/coregdbadapter.cpp @@ -213,7 +213,7 @@ void GdbCoreEngine::setupInferior() // Do that first, otherwise no symbols are loaded. QFileInfo fi(m_executable); QByteArray path = fi.absoluteFilePath().toLocal8Bit(); - postCommand("-file-exec-and-symbols \"" + path + '"', + postCommand("-file-exec-and-symbols \"" + path + '"', NoFlags, CB(handleFileExecAndSymbols)); } @@ -223,7 +223,7 @@ void GdbCoreEngine::handleFileExecAndSymbols(const DebuggerResponse &response) QString core = coreFileName(); if (response.resultClass == ResultDone) { showMessage(tr("Symbols found."), StatusBar); - postCommand("target core " + core.toLocal8Bit(), + postCommand("target core " + core.toLocal8Bit(), NoFlags, CB(handleTargetCore)); return; } @@ -246,9 +246,9 @@ void GdbCoreEngine::handleTargetCore(const DebuggerResponse &response) handleInferiorPrepared(); // Due to the auto-solib-add off setting, we don't have any // symbols yet. Load them in order of importance. - reloadStack(true); + reloadStack(); reloadModulesInternal(); - postCommand("p 5", CB(handleRoundTrip)); + postCommand("p 5", NoFlags, CB(handleRoundTrip)); return; } QString msg = tr("Attach to core \"%1\" failed:") diff --git a/src/plugins/debugger/gdb/coregdbadapter.h b/src/plugins/debugger/gdb/coregdbadapter.h index e058db71da2..d8839ea4ec5 100644 --- a/src/plugins/debugger/gdb/coregdbadapter.h +++ b/src/plugins/debugger/gdb/coregdbadapter.h @@ -59,6 +59,7 @@ public: bool isCore; }; static CoreInfo readExecutableNameFromCore(const QString &debuggerCmd, const QString &coreFile); + private: void setupEngine(); void setupInferior(); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 3392a424a07..ba78737675e 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -858,25 +858,14 @@ void GdbEngine::runCommand(const DebuggerCommand &command) postCommand("python theDumper." + cmd); } -void GdbEngine::postCommand(const QByteArray &command, GdbCommandCallback callback, - const QVariant &cookie) -{ - postCommand(command, NoFlags, callback, cookie); -} - void GdbEngine::postCommand(const QByteArray &command, GdbCommandFlags flags, - GdbCommandCallback callback, const QVariant &cookie) + GdbCommandCallback callback) { GdbCommand cmd; cmd.command = command; cmd.flags = flags; cmd.callback = callback; - cmd.cookie = cookie; - postCommandHelper(cmd); -} -void GdbEngine::postCommandHelper(const GdbCommand &cmd) -{ if (!stateAcceptsGdbCommands(state())) { PENDING_DEBUG(_("NO GDB PROCESS RUNNING, CMD IGNORED: " + cmd.command)); showMessage(_("NO GDB PROCESS RUNNING, CMD IGNORED: %1 %2") @@ -1138,8 +1127,6 @@ void GdbEngine::handleResultRecord(DebuggerResponse *response) return; } - response->cookie = cmd.cookie; - bool isExpectedResult = (response->resultClass == ResultError) // Can always happen. || (response->resultClass == ResultRunning && (cmd.flags & RunRequest)) @@ -1241,10 +1228,10 @@ void GdbEngine::updateAll() QTC_CHECK(state() == InferiorUnrunnable || state() == InferiorStopOk); reloadModulesInternal(); int depth = action(MaximalStackDepth)->value().toInt(); - postCommand(stackCommand(depth), CB(handleStackListFrames), - QVariant::fromValue(StackCookie(false, true))); + postCommand(stackCommand(depth), NoFlags, + [this](const DebuggerResponse &r) { handleStackListFrames(r, false); }); stackHandler()->setCurrentIndex(0); - postCommand("-thread-info", CB(handleThreadInfo), 0); + postCommand("-thread-info", NoFlags, CB(handleThreadInfo)); reloadRegisters(); updateLocals(); } @@ -1295,7 +1282,7 @@ void GdbEngine::handleExecuteJumpToLine(const DebuggerResponse &response) // This happens on old gdb. Trigger the effect of a '*stopped'. showStatusMessage(tr("Jumped. Stopped")); notifyInferiorSpontaneousStop(); - handleStop2(response); + handleStop2(response.data); } } @@ -1373,7 +1360,7 @@ void GdbEngine::handleStopResponse(const GdbMi &data) if (!m_fullStartDone) { m_fullStartDone = true; postCommand("sharedlibrary .*"); - postCommand("p 3", CB(handleStop1)); + postCommand("p 3", NoFlags, [this, data](const DebuggerResponse &) { handleStop1(data); }); gotoHandleStop1 = false; } @@ -1468,11 +1455,6 @@ static QByteArray stopSignal(const Abi &abi) return (abi.os() == Abi::WindowsOS) ? QByteArray("SIGTRAP") : QByteArray("SIGINT"); } -void GdbEngine::handleStop1(const DebuggerResponse &response) -{ - handleStop1(response.cookie.value()); -} - void GdbEngine::handleStop1(const GdbMi &data) { QTC_ASSERT(state() == InferiorStopOk, qDebug() << state()); @@ -1545,11 +1527,6 @@ void GdbEngine::handleStop1(const GdbMi &data) handleStop2(data); } -void GdbEngine::handleStop2(const DebuggerResponse &response) -{ - handleStop2(response.cookie.value()); -} - void GdbEngine::handleStop2(const GdbMi &data) { QTC_ASSERT(state() == InferiorStopOk, qDebug() << state()); @@ -1776,7 +1753,7 @@ void GdbEngine::handleExecuteContinue(const DebuggerResponse &response) flushQueuedCommands(); QTC_ASSERT(state() == InferiorStopOk, qDebug() << state()); showStatusMessage(tr("Stopped."), 5000); - reloadStack(true); + reloadStack(); } else if (msg.startsWith("Cannot access memory at address")) { // Happens on single step on ARM prolog and epilogs. } else if (msg.startsWith("\"finish\" not meaningful in the outermost frame")) { @@ -2466,9 +2443,8 @@ QByteArray GdbEngine::breakpointLocation2(const BreakpointParameters &data) + QByteArray::number(data.lineNumber); } -void GdbEngine::handleWatchInsert(const DebuggerResponse &response) +void GdbEngine::handleWatchInsert(const DebuggerResponse &response, Breakpoint bp) { - Breakpoint bp = response.cookie.value(); if (bp && response.resultClass == ResultDone) { BreakpointResponse br = bp.response(); // "Hardware watchpoint 2: *0xbfffed40\n" @@ -2502,9 +2478,8 @@ void GdbEngine::handleWatchInsert(const DebuggerResponse &response) } } -void GdbEngine::handleCatchInsert(const DebuggerResponse &response) +void GdbEngine::handleCatchInsert(const DebuggerResponse &response, Breakpoint bp) { - Breakpoint bp = response.cookie.value(); if (bp && response.resultClass == ResultDone) bp.notifyBreakpointInsertOk(); } @@ -2548,9 +2523,8 @@ void GdbEngine::handleBkpt(const GdbMi &bkpt, Breakpoint bp) bp.setResponse(br); } -void GdbEngine::handleBreakInsert1(const DebuggerResponse &response) +void GdbEngine::handleBreakInsert1(const DebuggerResponse &response, Breakpoint bp) { - Breakpoint bp = response.cookie.value(); if (bp.state() == BreakpointRemoveRequested) { if (response.resultClass == ResultDone) { // This delete was deferred. Act now. @@ -2597,14 +2571,13 @@ void GdbEngine::handleBreakInsert1(const DebuggerResponse &response) // again with MI. QByteArray cmd = "break " + breakpointLocation2(bp.parameters()); postCommand(cmd, NeedsStop | RebuildBreakpointModel, - CB(handleBreakInsert2), QVariant::fromValue(bp)); + [this, bp](const DebuggerResponse &r) { handleBreakInsert2(r, bp); }); } } -void GdbEngine::handleBreakInsert2(const DebuggerResponse &response) +void GdbEngine::handleBreakInsert2(const DebuggerResponse &response, Breakpoint bp) { if (response.resultClass == ResultDone) { - Breakpoint bp = response.cookie.value(); QTC_ASSERT(bp, return); bp.notifyBreakpointInsertOk(); } else { @@ -2615,19 +2588,17 @@ void GdbEngine::handleBreakInsert2(const DebuggerResponse &response) } } -void GdbEngine::handleBreakDelete(const DebuggerResponse &response) +void GdbEngine::handleBreakDelete(const DebuggerResponse &response, Breakpoint bp) { - Breakpoint bp = response.cookie.value(); if (response.resultClass == ResultDone) bp.notifyBreakpointRemoveOk(); else bp.notifyBreakpointRemoveFailed(); } -void GdbEngine::handleBreakDisable(const DebuggerResponse &response) +void GdbEngine::handleBreakDisable(const DebuggerResponse &response, Breakpoint bp) { QTC_CHECK(response.resultClass == ResultDone); - Breakpoint bp = response.cookie.value(); // This should only be the requested state. QTC_ASSERT(!bp.isEnabled(), /* Prevent later recursion */); BreakpointResponse br = bp.response(); @@ -2636,10 +2607,9 @@ void GdbEngine::handleBreakDisable(const DebuggerResponse &response) changeBreakpoint(bp); // Maybe there's more to do. } -void GdbEngine::handleBreakEnable(const DebuggerResponse &response) +void GdbEngine::handleBreakEnable(const DebuggerResponse &response, Breakpoint bp) { QTC_CHECK(response.resultClass == ResultDone); - Breakpoint bp = response.cookie.value(); // This should only be the requested state. QTC_ASSERT(bp.isEnabled(), /* Prevent later recursion */); BreakpointResponse br = bp.response(); @@ -2648,10 +2618,9 @@ void GdbEngine::handleBreakEnable(const DebuggerResponse &response) changeBreakpoint(bp); // Maybe there's more to do. } -void GdbEngine::handleBreakThreadSpec(const DebuggerResponse &response) +void GdbEngine::handleBreakThreadSpec(const DebuggerResponse &response, Breakpoint bp) { QTC_CHECK(response.resultClass == ResultDone); - Breakpoint bp = response.cookie.value(); BreakpointResponse br = bp.response(); br.threadSpec = bp.threadSpec(); bp.setResponse(br); @@ -2659,10 +2628,9 @@ void GdbEngine::handleBreakThreadSpec(const DebuggerResponse &response) insertBreakpoint(bp); } -void GdbEngine::handleBreakLineNumber(const DebuggerResponse &response) +void GdbEngine::handleBreakLineNumber(const DebuggerResponse &response, Breakpoint bp) { QTC_CHECK(response.resultClass == ResultDone); - Breakpoint bp = response.cookie.value(); BreakpointResponse br = bp.response(); br.lineNumber = bp.lineNumber(); bp.setResponse(br); @@ -2670,7 +2638,7 @@ void GdbEngine::handleBreakLineNumber(const DebuggerResponse &response) insertBreakpoint(bp); } -void GdbEngine::handleBreakIgnore(const DebuggerResponse &response) +void GdbEngine::handleBreakIgnore(const DebuggerResponse &response, Breakpoint bp) { // gdb 6.8: // ignore 2 0: @@ -2684,7 +2652,6 @@ void GdbEngine::handleBreakIgnore(const DebuggerResponse &response) // gdb 6.3 does not produce any console output QTC_CHECK(response.resultClass == ResultDone); //QString msg = _(response.consoleStreamOutput); - Breakpoint bp = response.cookie.value(); BreakpointResponse br = bp.response(); //if (msg.contains(__("Will stop next time breakpoint"))) // response.ignoreCount = _("0"); @@ -2698,11 +2665,10 @@ void GdbEngine::handleBreakIgnore(const DebuggerResponse &response) changeBreakpoint(bp); // Maybe there's more to do. } -void GdbEngine::handleBreakCondition(const DebuggerResponse &response) +void GdbEngine::handleBreakCondition(const DebuggerResponse &, Breakpoint bp) { // Can happen at invalid condition strings. //QTC_CHECK(response.resultClass == ResultDone) - Breakpoint bp = response.cookie.value(); // We just assume it was successful. Otherwise we had to parse // the output stream data. // The following happens on Mac: @@ -2747,7 +2713,6 @@ void GdbEngine::insertBreakpoint(Breakpoint bp) bp.notifyBreakpointInsertProceeding(); const BreakpointParameters &data = bp.parameters(); - QVariant vid = QVariant::fromValue(bp); if (!data.isCppBreakpoint()) { DebuggerCommand cmd("insertQmlBreakpoint"); @@ -2761,22 +2726,22 @@ void GdbEngine::insertBreakpoint(Breakpoint bp) if (type == WatchpointAtAddress) { postCommand("watch " + addressSpec(bp.address()), NeedsStop | RebuildBreakpointModel | ConsoleCommand, - CB(handleWatchInsert), vid); + [this, bp](const DebuggerResponse &r) { handleWatchInsert(r, bp); }); return; } if (type == WatchpointAtExpression) { postCommand("watch " + bp.expression().toLocal8Bit(), NeedsStop | RebuildBreakpointModel | ConsoleCommand, - CB(handleWatchInsert), vid); + [this, bp](const DebuggerResponse &r) { handleWatchInsert(r, bp); }); return; } if (type == BreakpointAtFork) { postCommand("catch fork", NeedsStop | RebuildBreakpointModel | ConsoleCommand, - CB(handleCatchInsert), vid); + [this, bp](const DebuggerResponse &r) { handleCatchInsert(r, bp); }); postCommand("catch vfork", NeedsStop | RebuildBreakpointModel | ConsoleCommand, - CB(handleCatchInsert), vid); + [this, bp](const DebuggerResponse &r) { handleCatchInsert(r, bp); }); return; } //if (type == BreakpointAtVFork) { @@ -2787,13 +2752,13 @@ void GdbEngine::insertBreakpoint(Breakpoint bp) if (type == BreakpointAtExec) { postCommand("catch exec", NeedsStop | RebuildBreakpointModel | ConsoleCommand, - CB(handleCatchInsert), vid); + [this, bp](const DebuggerResponse &r) { handleCatchInsert(r, bp); }); return; } if (type == BreakpointAtSysCall) { postCommand("catch syscall", NeedsStop | RebuildBreakpointModel | ConsoleCommand, - CB(handleCatchInsert), vid); + [this, bp](const DebuggerResponse &r) { handleCatchInsert(r, bp); }); return; } @@ -2823,7 +2788,7 @@ void GdbEngine::insertBreakpoint(Breakpoint bp) cmd += breakpointLocation(bp.parameters()); postCommand(cmd, NeedsStop | RebuildBreakpointModel, - CB(handleBreakInsert1), vid); + [this, bp](const DebuggerResponse &r) { handleBreakInsert1(r, bp); }); } void GdbEngine::changeBreakpoint(Breakpoint bp) @@ -2838,20 +2803,19 @@ void GdbEngine::changeBreakpoint(Breakpoint bp) bp.notifyBreakpointChangeProceeding(); const BreakpointState state2 = bp.state(); QTC_ASSERT(state2 == BreakpointChangeProceeding, qDebug() << state2); - QVariant vid = QVariant::fromValue(bp); if (!response.pending && data.threadSpec != response.threadSpec) { // The only way to change this seems to be to re-set the bp completely. postCommand("-break-delete " + bpnr, NeedsStop | RebuildBreakpointModel, - CB(handleBreakThreadSpec), vid); + [this, bp](const DebuggerResponse &r) { handleBreakThreadSpec(r, bp); }); return; } if (!response.pending && data.lineNumber != response.lineNumber) { // The only way to change this seems to be to re-set the bp completely. postCommand("-break-delete " + bpnr, NeedsStop | RebuildBreakpointModel, - CB(handleBreakLineNumber), vid); + [this, bp](const DebuggerResponse &r) { handleBreakLineNumber(r, bp); }); return; } if (data.command != response.command) { @@ -2864,31 +2828,31 @@ void GdbEngine::changeBreakpoint(Breakpoint bp) } } postCommand(breakCommand, NeedsStop | RebuildBreakpointModel, - CB(handleBreakIgnore), vid); + [this, bp](const DebuggerResponse &r) { handleBreakIgnore(r, bp); }); return; } if (!data.conditionsMatch(response.condition)) { postCommand("condition " + bpnr + ' ' + data.condition, NeedsStop | RebuildBreakpointModel, - CB(handleBreakCondition), vid); + [this, bp](const DebuggerResponse &r) { handleBreakCondition(r, bp); }); return; } if (data.ignoreCount != response.ignoreCount) { postCommand("ignore " + bpnr + ' ' + QByteArray::number(data.ignoreCount), NeedsStop | RebuildBreakpointModel, - CB(handleBreakIgnore), vid); + [this, bp](const DebuggerResponse &r) { handleBreakIgnore(r, bp); }); return; } if (!data.enabled && response.enabled) { postCommand("-break-disable " + bpnr, NeedsStop | RebuildBreakpointModel, - CB(handleBreakDisable), vid); + [this, bp](const DebuggerResponse &r) { handleBreakDisable(r, bp); }); return; } if (data.enabled && !response.enabled) { postCommand("-break-enable " + bpnr, NeedsStop | RebuildBreakpointModel, - CB(handleBreakEnable), vid); + [this, bp](const DebuggerResponse &r) { handleBreakEnable(r, bp); }); return; } bp.notifyBreakpointChangeOk(); @@ -2909,13 +2873,12 @@ void GdbEngine::removeBreakpoint(Breakpoint bp) } if (br.id.isValid()) { - QVariant vid = QVariant::fromValue(bp); // We already have a fully inserted breakpoint. bp.notifyBreakpointRemoveProceeding(); showMessage(_("DELETING BP %1 IN %2").arg(br.id.toString()).arg(bp.fileName())); postCommand("-break-delete " + br.id.toByteArray(), NeedsStop | RebuildBreakpointModel, - CB(handleBreakDelete), vid); + [this, bp](const DebuggerResponse &r) { handleBreakDelete(r, bp); }); } else { // Breakpoint was scheduled to be inserted, but we haven't had // an answer so far. Postpone activity by doing nothing. @@ -2934,7 +2897,7 @@ void GdbEngine::loadSymbols(const QString &modulePath) // FIXME: gdb does not understand quoted names here (tested with 6.8) postCommand("sharedlibrary " + dotEscape(modulePath.toLocal8Bit())); reloadModulesInternal(); - reloadStack(true); + reloadStack(); updateLocals(); } @@ -2942,7 +2905,7 @@ void GdbEngine::loadAllSymbols() { postCommand("sharedlibrary .*"); reloadModulesInternal(); - reloadStack(true); + reloadStack(); updateLocals(); } @@ -2965,29 +2928,14 @@ void GdbEngine::loadSymbolsForStack() } if (needUpdate) { //reloadModulesInternal(); - reloadStack(true); + reloadStack(); updateLocals(); } } -void GdbEngine::requestModuleSymbols(const QString &modulePath) +static void handleShowModuleSymbols(const DebuggerResponse &response, + const QString &modulePath, const QString &fileName) { - QTemporaryFile tf(QDir::tempPath() + _("/gdbsymbols")); - if (!tf.open()) - return; - QString fileName = tf.fileName(); - tf.close(); - postCommand("maint print msymbols \"" + fileName.toLocal8Bit() - + "\" " + modulePath.toLocal8Bit(), - NeedsStop, CB(handleShowModuleSymbols), - QVariant(modulePath + QLatin1Char('@') + fileName)); -} - -void GdbEngine::handleShowModuleSymbols(const DebuggerResponse &response) -{ - const QString cookie = response.cookie.toString(); - const QString modulePath = cookie.section(QLatin1Char('@'), 0, 0); - const QString fileName = cookie.section(QLatin1Char('@'), 1, 1); if (response.resultClass == ResultDone) { Symbols symbols; QFile file(fileName); @@ -3039,24 +2987,38 @@ void GdbEngine::handleShowModuleSymbols(const DebuggerResponse &response) file.remove(); Internal::showModuleSymbols(modulePath, symbols); } else { - AsynchronousMessageBox::critical(tr("Cannot Read Symbols"), - tr("Cannot read symbols for module \"%1\".").arg(fileName)); + AsynchronousMessageBox::critical(GdbEngine::tr("Cannot Read Symbols"), + GdbEngine::tr("Cannot read symbols for module \"%1\".").arg(fileName)); } } +void GdbEngine::requestModuleSymbols(const QString &modulePath) +{ + QTemporaryFile tf(QDir::tempPath() + _("/gdbsymbols")); + if (!tf.open()) + return; + QString fileName = tf.fileName(); + tf.close(); + postCommand("maint print msymbols \"" + fileName.toLocal8Bit() + + "\" " + modulePath.toLocal8Bit(), NeedsStop, + [modulePath, fileName](const DebuggerResponse &r) { + handleShowModuleSymbols(r, modulePath, fileName); }); +} + void GdbEngine::requestModuleSections(const QString &moduleName) { // There seems to be no way to get the symbols from a single .so. - postCommand("maint info section ALLOBJ", - NeedsStop, CB(handleShowModuleSections), moduleName); + postCommand("maint info section ALLOBJ", NeedsStop, + [this, moduleName](const DebuggerResponse &r) { + handleShowModuleSections(r, moduleName); }); } -void GdbEngine::handleShowModuleSections(const DebuggerResponse &response) +void GdbEngine::handleShowModuleSections(const DebuggerResponse &response, + const QString &moduleName) { // ~" Object file: /usr/lib/i386-linux-gnu/libffi.so.6\n" // ~" 0xb44a6114->0xb44a6138 at 0x00000114: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS\n" if (response.resultClass == ResultDone) { - const QString moduleName = response.cookie.toString(); const QStringList lines = QString::fromLocal8Bit(response.consoleStreamOutput).split(QLatin1Char('\n')); const QString prefix = QLatin1String(" Object file: "); const QString needle = prefix + moduleName; @@ -3209,7 +3171,7 @@ void GdbEngine::handleStackSelectThread(const DebuggerResponse &) { QTC_CHECK(state() == InferiorUnrunnable || state() == InferiorStopOk); showStatusMessage(tr("Retrieving data for stack view..."), 3000); - reloadStack(true); // Will reload registers. + reloadStack(); // Will reload registers. updateLocals(); } @@ -3217,8 +3179,8 @@ void GdbEngine::reloadFullStack() { PENDING_DEBUG("RELOAD FULL STACK"); resetLocation(); - postCommand(stackCommand(-1), Discardable, CB(handleStackListFrames), - QVariant::fromValue(StackCookie(true, true))); + postCommand(stackCommand(-1), Discardable, + [this](const DebuggerResponse &r) { handleStackListFrames(r, true); }); } void GdbEngine::loadAdditionalQmlStack() @@ -3270,7 +3232,7 @@ void GdbEngine::handleQmlStackFrameArguments(const DebuggerResponse &response) QByteArray command = "-data-evaluate-expression \"qt_v4StackTrace((QV4::ExecutionContext *)0x"; command += QByteArray::number(contextAddress, 16); command += ")\""; - postCommand(command, CB(handleQmlStackTrace)); + postCommand(command, NoFlags, CB(handleQmlStackTrace)); } void GdbEngine::handleQmlStackTrace(const DebuggerResponse &response) @@ -3323,12 +3285,12 @@ QByteArray GdbEngine::stackCommand(int depth) return cmd; } -void GdbEngine::reloadStack(bool forceGotoLocation) +void GdbEngine::reloadStack() { PENDING_DEBUG("RELOAD STACK"); int depth = action(MaximalStackDepth)->value().toInt(); - postCommand(stackCommand(depth), Discardable, CB(handleStackListFrames), - QVariant::fromValue(StackCookie(false, forceGotoLocation))); + postCommand(stackCommand(depth), Discardable, + [this](const DebuggerResponse &r) { handleStackListFrames(r, false); }); } StackFrame GdbEngine::parseStackFrame(const GdbMi &frameMi, int level) @@ -3360,7 +3322,7 @@ StackFrame GdbEngine::parseStackFrame(const GdbMi &frameMi, int level) return frame; } -void GdbEngine::handleStackListFrames(const DebuggerResponse &response) +void GdbEngine::handleStackListFrames(const DebuggerResponse &response, bool isFull) { if (response.resultClass != ResultDone) { // That always happens on symbian gdb with @@ -3371,7 +3333,6 @@ void GdbEngine::handleStackListFrames(const DebuggerResponse &response) return; } - StackCookie cookie = response.cookie.value(); QList stackFrames; GdbMi stack = response.data["stack"]; // C++ @@ -3396,8 +3357,7 @@ void GdbEngine::handleStackListFrames(const DebuggerResponse &response) targetFrame = i; } - bool canExpand = !cookie.isFull - && (n >= action(MaximalStackDepth)->value().toInt()); + bool canExpand = !isFull && (n >= action(MaximalStackDepth)->value().toInt()); action(ExpandStack)->setEnabled(canExpand); stackHandler()->setFrames(stackFrames, canExpand); @@ -3470,7 +3430,7 @@ void GdbEngine::handleThreadInfo(const DebuggerResponse &response) action(MaximalStackDepth)->value().toByteArray(), Discardable, CB(handleThreadNames)); } - reloadStack(false); // Will trigger register reload. + reloadStack(); // Will trigger register reload. } else { // Fall back for older versions: Try to get at least a list // of running threads. @@ -3489,7 +3449,7 @@ void GdbEngine::handleThreadListIds(const DebuggerResponse &response) thread.id = ThreadId(items.at(index).toInt()); handler->updateThread(thread); } - reloadStack(false); // Will trigger register reload. + reloadStack(); // Will trigger register reload. } void GdbEngine::handleThreadNames(const DebuggerResponse &response) @@ -3524,20 +3484,20 @@ void GdbEngine::createSnapshot() fileName = tf.fileName(); tf.close(); // This must not be quoted, it doesn't work otherwise. - postCommand("gcore " + fileName.toLocal8Bit(), - NeedsStop|ConsoleCommand, CB(handleMakeSnapshot), fileName); + postCommand("gcore " + fileName.toLocal8Bit(), NeedsStop|ConsoleCommand, + [this, fileName](const DebuggerResponse &r) { handleMakeSnapshot(r, fileName); }); } else { AsynchronousMessageBox::critical(tr("Snapshot Creation Error"), tr("Cannot create snapshot file.")); } } -void GdbEngine::handleMakeSnapshot(const DebuggerResponse &response) +void GdbEngine::handleMakeSnapshot(const DebuggerResponse &response, const QString &coreFile) { if (response.resultClass == ResultDone) { DebuggerStartParameters sp = startParameters(); sp.startMode = AttachCore; - sp.coreFile = response.cookie.toString(); + sp.coreFile = coreFile; //snapshot.setDate(QDateTime::currentDateTime()); StackFrames frames = stackHandler()->frames(); QString function = _(""); @@ -3572,7 +3532,7 @@ void GdbEngine::reloadRegisters() if (true) { if (!m_registerNamesListed) { - postCommand("-data-list-register-names", CB(handleRegisterListNames)); + postCommand("-data-list-register-names", NoFlags, CB(handleRegisterListNames)); m_registerNamesListed = true; } // Can cause i386-linux-nat.c:571: internal-error: Got request @@ -3580,7 +3540,7 @@ void GdbEngine::reloadRegisters() postCommand("-data-list-register-values r", Discardable, CB(handleRegisterListValues)); } else { - postCommand("maintenance print cooked-registers", CB(handleMaintPrintRegisters)); + postCommand("maintenance print cooked-registers", NoFlags, CB(handleMaintPrintRegisters)); } } @@ -3906,7 +3866,7 @@ void GdbEngine::changeMemory(MemoryAgent *agent, QObject *token, ac.token = token; ac.base = addr; ac.length = data.size(); - postCommand(cmd, NeedsStop, CB(handleChangeMemory), QVariant::fromValue(ac)); + postCommand(cmd, NeedsStop, CB(handleChangeMemory)); } void GdbEngine::handleChangeMemory(const DebuggerResponse &response) @@ -3930,17 +3890,16 @@ void GdbEngine::fetchMemory(MemoryAgent *agent, QObject *token, quint64 addr, void GdbEngine::fetchMemoryHelper(const MemoryAgentCookie &ac) { postCommand("-data-read-memory 0x" + QByteArray::number(ac.base + ac.offset, 16) + " x 1 1 " - + QByteArray::number(ac.length), - NeedsStop, CB(handleFetchMemory), QVariant::fromValue(ac)); + + QByteArray::number(ac.length), NeedsStop, + [this, ac](const DebuggerResponse &r) { handleFetchMemory(r, ac); }); } -void GdbEngine::handleFetchMemory(const DebuggerResponse &response) +void GdbEngine::handleFetchMemory(const DebuggerResponse &response, MemoryAgentCookie ac) { // ^done,addr="0x08910c88",nr-bytes="16",total-bytes="16", // next-row="0x08910c98",prev-row="0x08910c78",next-page="0x08910c98", // prev-page="0x08910c78",memory=[{addr="0x08910c88", // data=["1","0","0","0","5","0","0","0","0","0","0","0","0","0","0","0"]}] - MemoryAgentCookie ac = response.cookie.value(); --*ac.pendingRequests; showMessage(QString::fromLatin1("PENDING: %1").arg(*ac.pendingRequests)); QTC_ASSERT(ac.agent, return); @@ -4020,25 +3979,34 @@ static inline QByteArray disassemblerCommand(const Location &location, bool mixe return command; } -void GdbEngine::fetchDisassemblerByCliPointMixed(const DisassemblerAgentCookie &ac0) +void GdbEngine::fetchDisassemblerByCliPointMixed(const DisassemblerAgentCookie &ac) { - DisassemblerAgentCookie ac = ac0; QTC_ASSERT(ac.agent, return); postCommand(disassemblerCommand(ac.agent->location(), true), Discardable|ConsoleCommand, - CB(handleFetchDisassemblerByCliPointMixed), - QVariant::fromValue(ac)); + [this, ac](const DebuggerResponse &response) { + if (response.resultClass == ResultDone) + if (handleCliDisassemblerResult(response.consoleStreamOutput, ac.agent)) + return; + // 'point, plain' can take far too long. + // Skip this feature and immediately fall back to the 'range' version: + fetchDisassemblerByCliRangeMixed(ac); + }); } -void GdbEngine::fetchDisassemblerByCliRangeMixed(const DisassemblerAgentCookie &ac0) +void GdbEngine::fetchDisassemblerByCliRangeMixed(const DisassemblerAgentCookie &ac) { - DisassemblerAgentCookie ac = ac0; QTC_ASSERT(ac.agent, return); const quint64 address = ac.agent->address(); QByteArray start = QByteArray::number(address - 20, 16); QByteArray end = QByteArray::number(address + 100, 16); QByteArray cmd = "disassemble /rm 0x" + start + ",0x" + end; postCommand(cmd, Discardable|ConsoleCommand, - CB(handleFetchDisassemblerByCliRangeMixed), QVariant::fromValue(ac)); + [this, ac](const DebuggerResponse &response) { + if (response.resultClass == ResultDone) + if (handleCliDisassemblerResult(response.consoleStreamOutput, ac.agent)) + return; + fetchDisassemblerByCliRangePlain(ac); + }); } @@ -4051,7 +4019,18 @@ void GdbEngine::fetchDisassemblerByCliRangePlain(const DisassemblerAgentCookie & QByteArray end = QByteArray::number(address + 100, 16); QByteArray cmd = "disassemble /r 0x" + start + ",0x" + end; postCommand(cmd, Discardable, - CB(handleFetchDisassemblerByCliRangePlain), QVariant::fromValue(ac)); + [this, ac](const DebuggerResponse &response) { + if (response.resultClass == ResultDone) + if (handleCliDisassemblerResult(response.consoleStreamOutput, ac.agent)) + return; + // Finally, give up. + //76^error,msg="No function contains program counter for selected..." + //76^error,msg="No function contains specified address." + //>568^error,msg="Line number 0 out of range; + QByteArray msg = response.data["msg"].data(); + showStatusMessage(tr("Disassembler failed: %1") + .arg(QString::fromLocal8Bit(msg)), 5000); + }); } struct LineData @@ -4064,6 +4043,7 @@ struct LineData bool GdbEngine::handleCliDisassemblerResult(const QByteArray &output, DisassemblerAgent *agent) { + QTC_ASSERT(agent, return true); // First line is something like // "Dump of assembler code from 0xb7ff598f to 0xb7ff5a07:" DisassemblerLines dlines; @@ -4107,50 +4087,6 @@ bool GdbEngine::handleCliDisassemblerResult(const QByteArray &output, Disassembl return false; } -void GdbEngine::handleFetchDisassemblerByCliPointMixed(const DebuggerResponse &response) -{ - DisassemblerAgentCookie ac = response.cookie.value(); - QTC_ASSERT(ac.agent, return); - - if (response.resultClass == ResultDone) - if (handleCliDisassemblerResult(response.consoleStreamOutput, ac.agent)) - return; - - // 'point, plain' can take far too long. - // Skip this feature and immediately fall back to the 'range' version: - fetchDisassemblerByCliRangeMixed(ac); -} - -void GdbEngine::handleFetchDisassemblerByCliRangeMixed(const DebuggerResponse &response) -{ - DisassemblerAgentCookie ac = response.cookie.value(); - QTC_ASSERT(ac.agent, return); - - if (response.resultClass == ResultDone) - if (handleCliDisassemblerResult(response.consoleStreamOutput, ac.agent)) - return; - - fetchDisassemblerByCliRangePlain(ac); -} - -void GdbEngine::handleFetchDisassemblerByCliRangePlain(const DebuggerResponse &response) -{ - DisassemblerAgentCookie ac = response.cookie.value(); - QTC_ASSERT(ac.agent, return); - - if (response.resultClass == ResultDone) - if (handleCliDisassemblerResult(response.consoleStreamOutput, ac.agent)) - return; - - // Finally, give up. - //76^error,msg="No function contains program counter for selected..." - //76^error,msg="No function contains specified address." - //>568^error,msg="Line number 0 out of range; - QByteArray msg = response.data["msg"].data(); - showStatusMessage(tr("Disassembler failed: %1") - .arg(QString::fromLocal8Bit(msg)), 5000); -} - // Binary/configuration check logic. static QString gdbBinary(const DebuggerStartParameters &sp) @@ -4219,9 +4155,9 @@ void GdbEngine::startGdb(const QStringList &args) } showMessage(_("GDB STARTED, INITIALIZING IT")); - postCommand("show version", CB(handleShowVersion)); + postCommand("show version", NoFlags, CB(handleShowVersion)); //postCommand("-list-features", CB(handleListFeatures)); - postCommand("show debug-file-directory", CB(handleDebugInfoLocation)); + postCommand("show debug-file-directory", NoFlags, CB(handleDebugInfoLocation)); //postCommand("-enable-timings"); //postCommand("set print static-members off"); // Seemingly doesn't work. @@ -4562,10 +4498,10 @@ void GdbEngine::finishInferiorSetup() postCommand("-break-insert -f '" + qtNamespace() + "QMessageLogger::warning'"); } if (boolSetting(BreakOnFatal)) { - postCommand("-break-insert -f '" + qtNamespace() + "qFatal'", - CB(handleBreakOnQFatal), QVariant(false)); - postCommand("-break-insert -f '" + qtNamespace() + "QMessageLogger::fatal'", - CB(handleBreakOnQFatal), QVariant(true)); + postCommand("-break-insert -f '" + qtNamespace() + "qFatal'", NoFlags, + [this](const DebuggerResponse &r) { handleBreakOnQFatal(r, false); }); + postCommand("-break-insert -f '" + qtNamespace() + "QMessageLogger::fatal'", NoFlags, + [this](const DebuggerResponse &r) { handleBreakOnQFatal(r, true); }); } else { notifyInferiorSetupOk(); } @@ -4589,7 +4525,7 @@ void GdbEngine::handleDebugInfoLocation(const DebuggerResponse &response) } } -void GdbEngine::handleBreakOnQFatal(const DebuggerResponse &response) +void GdbEngine::handleBreakOnQFatal(const DebuggerResponse &response, bool continueSetup) { if (response.resultClass == ResultDone) { GdbMi bkpt = response.data["bkpt"]; @@ -4602,7 +4538,7 @@ void GdbEngine::handleBreakOnQFatal(const DebuggerResponse &response) } // Continue setup. - if (response.cookie.toBool()) + if (continueSetup) notifyInferiorSetupOk(); } @@ -4901,13 +4837,13 @@ void GdbEngine::updateLocalsPython(const UpdateParameters ¶ms) postCommand("bb options:" + options + " vars:" + params.varList + ' ' + resultVar + expanded + " watchers:" + watchers.toHex() + cutOff + context, - Discardable, CB(handleStackFramePython), QVariant(params.tryPartial)); + Discardable, + [this, params](const DebuggerResponse &r) { handleStackFramePython(r, params.tryPartial); }); } -void GdbEngine::handleStackFramePython(const DebuggerResponse &response) +void GdbEngine::handleStackFramePython(const DebuggerResponse &response, bool partial) { if (response.resultClass == ResultDone) { - const bool partial = response.cookie.toBool(); QByteArray out = response.consoleStreamOutput; while (out.endsWith(' ') || out.endsWith('\n')) out.chop(1); @@ -4995,10 +4931,7 @@ QString GdbEngine::msgPtraceError(DebuggerStartMode sm) "For more details, see /etc/sysctl.d/10-ptrace.conf\n"); } - } // namespace Internal } // namespace Debugger -Q_DECLARE_METATYPE(Debugger::Internal::MemoryAgentCookie) -Q_DECLARE_METATYPE(Debugger::Internal::DisassemblerAgentCookie) Q_DECLARE_METATYPE(Debugger::Internal::GdbMi) diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 38b4c7e26ba..9ac92230f09 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -185,7 +185,6 @@ private: ////////// Gdb Command Management ////////// int flags; GdbCommandCallback callback; QByteArray command; - QVariant cookie; QTime postTime; }; @@ -197,14 +196,9 @@ private: ////////// Gdb Command Management ////////// protected: void runCommand(const DebuggerCommand &command); void postCommand(const QByteArray &command, - GdbCommandFlags flags, - GdbCommandCallback callback = 0, - const QVariant &cookie = QVariant()); - void postCommand(const QByteArray &command, - GdbCommandCallback callback = 0, - const QVariant &cookie = QVariant()); + GdbCommandFlags flags = NoFlags, + GdbCommandCallback callback = GdbCommandCallback()); private: - void postCommandHelper(const GdbCommand &cmd); void flushQueuedCommands(); Q_SLOT void commandTimeout(); void setTokenBarrier(); @@ -238,9 +232,7 @@ protected: Q_SLOT void handleResponse(const QByteArray &buff); void handleStopResponse(const GdbMi &data); void handleResultRecord(DebuggerResponse *response); - void handleStop1(const DebuggerResponse &response); void handleStop1(const GdbMi &data); - void handleStop2(const DebuggerResponse &response); void handleStop2(const GdbMi &data); Q_SLOT void handleStop2(); StackFrame parseStackFrame(const GdbMi &mi, int level); @@ -304,18 +296,17 @@ private: ////////// View & Data Stuff ////////// // Breakpoint specific stuff // void handleBreakModifications(const GdbMi &bkpts); - void handleBreakIgnore(const DebuggerResponse &response); - void handleBreakDisable(const DebuggerResponse &response); - void handleBreakEnable(const DebuggerResponse &response); - void handleBreakInsert1(const DebuggerResponse &response); - void handleBreakInsert2(const DebuggerResponse &response); - void handleBreakDelete(const DebuggerResponse &response); - void handleTraceInsert2(const DebuggerResponse &response); - void handleBreakCondition(const DebuggerResponse &response); - void handleBreakThreadSpec(const DebuggerResponse &response); - void handleBreakLineNumber(const DebuggerResponse &response); - void handleWatchInsert(const DebuggerResponse &response); - void handleCatchInsert(const DebuggerResponse &response); + void handleBreakIgnore(const DebuggerResponse &response, Breakpoint bp); + void handleBreakDisable(const DebuggerResponse &response, Breakpoint bp); + void handleBreakEnable(const DebuggerResponse &response, Breakpoint bp); + void handleBreakInsert1(const DebuggerResponse &response, Breakpoint bp); + void handleBreakInsert2(const DebuggerResponse &response, Breakpoint bp); + void handleBreakDelete(const DebuggerResponse &response, Breakpoint bp); + void handleBreakCondition(const DebuggerResponse &response, Breakpoint bp); + void handleBreakThreadSpec(const DebuggerResponse &response, Breakpoint bp); + void handleBreakLineNumber(const DebuggerResponse &response, Breakpoint bp); + void handleWatchInsert(const DebuggerResponse &response, Breakpoint bp); + void handleCatchInsert(const DebuggerResponse &response, Breakpoint bp); void handleBkpt(const GdbMi &bkpt, Breakpoint bp); void updateResponse(BreakpointResponse &response, const GdbMi &bkpt); QByteArray breakpointLocation(const BreakpointParameters &data); // For gdb/MI. @@ -336,14 +327,13 @@ private: ////////// View & Data Stuff ////////// void reloadModulesInternal(); void handleModulesList(const DebuggerResponse &response); - void handleShowModuleSymbols(const DebuggerResponse &response); - void handleShowModuleSections(const DebuggerResponse &response); + void handleShowModuleSections(const DebuggerResponse &response, const QString &moduleName); // // Snapshot specific stuff // virtual void createSnapshot(); - void handleMakeSnapshot(const DebuggerResponse &response); + void handleMakeSnapshot(const DebuggerResponse &response, const QString &coreFile); // // Register specific stuff @@ -363,12 +353,9 @@ private: ////////// View & Data Stuff ////////// void fetchDisassemblerByCliPointMixed(const DisassemblerAgentCookie &ac); void fetchDisassemblerByCliRangeMixed(const DisassemblerAgentCookie &ac); void fetchDisassemblerByCliRangePlain(const DisassemblerAgentCookie &ac); - void handleFetchDisassemblerByCliPointMixed(const DebuggerResponse &response); - void handleFetchDisassemblerByCliRangeMixed(const DebuggerResponse &response); - void handleFetchDisassemblerByCliRangePlain(const DebuggerResponse &response); bool handleCliDisassemblerResult(const QByteArray &response, DisassemblerAgent *agent); - void handleBreakOnQFatal(const DebuggerResponse &response); + void handleBreakOnQFatal(const DebuggerResponse &response, bool continueSetup); // // Source file specific stuff @@ -392,13 +379,13 @@ private: ////////// View & Data Stuff ////////// // protected: void updateAll(); - void handleStackListFrames(const DebuggerResponse &response); + void handleStackListFrames(const DebuggerResponse &response, bool isFull); void handleStackSelectThread(const DebuggerResponse &response); void handleThreadListIds(const DebuggerResponse &response); void handleThreadInfo(const DebuggerResponse &response); void handleThreadNames(const DebuggerResponse &response); QByteArray stackCommand(int depth); - Q_SLOT void reloadStack(bool forceGotoLocation); + Q_SLOT void reloadStack(); Q_SLOT virtual void reloadFullStack(); virtual void loadAdditionalQmlStack(); void handleQmlStackFrameArguments(const DebuggerResponse &response); @@ -421,7 +408,7 @@ protected: void handleChangeMemory(const DebuggerResponse &response); virtual void changeMemory(MemoryAgent *agent, QObject *token, quint64 addr, const QByteArray &data); - void handleFetchMemory(const DebuggerResponse &response); + void handleFetchMemory(const DebuggerResponse &response, MemoryAgentCookie ac); virtual void watchPoint(const QPoint &); void handleWatchPoint(const DebuggerResponse &response); @@ -442,7 +429,7 @@ protected: void updateLocals(); void updateLocalsPython(const UpdateParameters ¶meters); - void handleStackFramePython(const DebuggerResponse &response); + void handleStackFramePython(const DebuggerResponse &response, bool partial); void setLocals(const QList &locals); diff --git a/src/plugins/debugger/gdb/gdbplainengine.cpp b/src/plugins/debugger/gdb/gdbplainengine.cpp index 7201926af6d..9b5f98f6b95 100644 --- a/src/plugins/debugger/gdb/gdbplainengine.cpp +++ b/src/plugins/debugger/gdb/gdbplainengine.cpp @@ -45,7 +45,7 @@ namespace Debugger { namespace Internal { -#define CB(callback) [this](const DebuggerResponse &r) { callback(r); }, STRINGIFY(callback) +#define CB(callback) [this](const DebuggerResponse &r) { callback(r); } GdbPlainEngine::GdbPlainEngine(const DebuggerStartParameters &startParameters) : GdbEngine(startParameters) @@ -63,7 +63,7 @@ void GdbPlainEngine::setupInferior() postCommand("-exec-arguments " + toLocalEncoding(args)); } postCommand("-file-exec-and-symbols \"" + execFilePath() + '"', - CB(handleFileExecAndSymbols)); + NoFlags, CB(handleFileExecAndSymbols)); } void GdbPlainEngine::handleFileExecAndSymbols(const DebuggerResponse &response) diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp index 5f0df8ce82b..e2339f8e4be 100644 --- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp +++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp @@ -204,7 +204,7 @@ void GdbRemoteServerEngine::setupInferior() // mi_execute_async_cli_command: Assertion `is_running (inferior_ptid)' // failed.\nA problem internal to GDB has been detected,[...] if (boolSetting(TargetAsync)) - postCommand("set target-async on", CB(handleSetTargetAsync)); + postCommand("set target-async on", NoFlags, CB(handleSetTargetAsync)); if (executableFileName.isEmpty()) { showMessage(tr("No symbol file given."), StatusBar); @@ -214,7 +214,7 @@ void GdbRemoteServerEngine::setupInferior() if (!executableFileName.isEmpty()) { postCommand("-file-exec-and-symbols \"" + executableFileName.toLocal8Bit() + '"', - CB(handleFileExecAndSymbols)); + NoFlags, CB(handleFileExecAndSymbols)); } } @@ -264,11 +264,11 @@ void GdbRemoteServerEngine::callTargetRemote() } if (m_isQnxGdb) - postCommand("target qnx " + channel, CB(handleTargetQnx)); + postCommand("target qnx " + channel, NoFlags, CB(handleTargetQnx)); else if (startParameters().multiProcess) - postCommand("target extended-remote " + channel, CB(handleTargetExtendedRemote)); + postCommand("target extended-remote " + channel, NoFlags, CB(handleTargetExtendedRemote)); else - postCommand("target remote " + channel, CB(handleTargetRemote), 10); + postCommand("target remote " + channel, NoFlags, CB(handleTargetRemote)); } void GdbRemoteServerEngine::handleTargetRemote(const DebuggerResponse &response) @@ -306,10 +306,10 @@ void GdbRemoteServerEngine::handleTargetExtendedRemote(const DebuggerResponse &r if (startParameters().attachPID > 0) { // attach to pid if valid // gdb server will stop the remote application itself. postCommand("attach " + QByteArray::number(startParameters().attachPID), - CB(handleTargetExtendedAttach)); + NoFlags, CB(handleTargetExtendedAttach)); } else { postCommand("-gdb-set remote exec-file " + startParameters().remoteExecutable.toLatin1(), - CB(handleTargetExtendedAttach)); + NoFlags, CB(handleTargetExtendedAttach)); } } else { QString msg = msgConnectRemoteServerFailed( @@ -343,9 +343,9 @@ void GdbRemoteServerEngine::handleTargetQnx(const DebuggerResponse &response) const qint64 pid = isMasterEngine() ? startParameters().attachPID : masterEngine()->startParameters().attachPID; const QString remoteExecutable = isMasterEngine() ? startParameters().remoteExecutable : masterEngine()->startParameters().remoteExecutable; if (pid > -1) - postCommand("attach " + QByteArray::number(pid), CB(handleAttach)); + postCommand("attach " + QByteArray::number(pid), NoFlags, CB(handleAttach)); else if (!remoteExecutable.isEmpty()) - postCommand("set nto-executable " + remoteExecutable.toLatin1(), CB(handleSetNtoExecutable)); + postCommand("set nto-executable " + remoteExecutable.toLatin1(), NoFlags, CB(handleSetNtoExecutable)); else handleInferiorPrepared(); } else { diff --git a/src/plugins/debugger/gdb/termgdbadapter.cpp b/src/plugins/debugger/gdb/termgdbadapter.cpp index e679a9a4384..3ebd4db863e 100644 --- a/src/plugins/debugger/gdb/termgdbadapter.cpp +++ b/src/plugins/debugger/gdb/termgdbadapter.cpp @@ -46,8 +46,6 @@ using namespace Utils; namespace Debugger { namespace Internal { -#define CB(callback) [this](const DebuggerResponse &r) { callback(r); } - /////////////////////////////////////////////////////////////////////// // // TermGdbAdapter @@ -136,8 +134,8 @@ void GdbTermEngine::runEngine() { QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); const qint64 attachedPID = m_stubProc.applicationPID(); - postCommand("attach " + QByteArray::number(attachedPID), - CB(handleStubAttached)); + postCommand("attach " + QByteArray::number(attachedPID), NoFlags, + [this](const DebuggerResponse &r) { handleStubAttached(r); }); } void GdbTermEngine::handleStubAttached(const DebuggerResponse &response) diff --git a/src/plugins/debugger/stackhandler.h b/src/plugins/debugger/stackhandler.h index 8b59016ead9..891a858f703 100644 --- a/src/plugins/debugger/stackhandler.h +++ b/src/plugins/debugger/stackhandler.h @@ -48,21 +48,6 @@ enum StackColumns StackColumnCount = StackAddressColumn, }; -//////////////////////////////////////////////////////////////////////// -// -// StackCookie -// -//////////////////////////////////////////////////////////////////////// - -struct StackCookie -{ - StackCookie() : isFull(true), gotoLocation(false) {} - StackCookie(bool full, bool jump) : isFull(full), gotoLocation(jump) {} - bool isFull; - bool gotoLocation; -}; - - //////////////////////////////////////////////////////////////////////// // // StackModel @@ -120,7 +105,4 @@ private: } // namespace Internal } // namespace Debugger -Q_DECLARE_METATYPE(Debugger::Internal::StackCookie) - - #endif // DEBUGGER_STACKHANDLER_H