void RemoteGdbServerAdapter::setupInferior() { QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); const DebuggerStartParameters &sp = startParameters(); QString fileName; if (!sp.executable.isEmpty()) { QFileInfo fi(sp.executable); fileName = fi.absoluteFilePath(); } const QByteArray sysroot = sp.sysroot.toLocal8Bit(); const QByteArray remoteArch = sp.remoteArchitecture.toLatin1(); const QByteArray gnuTarget = sp.gnuTarget.toLatin1(); const QByteArray searchPath = startParameters().searchPath.toLocal8Bit(); const QString args = sp.processArgs; if (!remoteArch.isEmpty()) m_engine->postCommand("set architecture " + remoteArch); if (!gnuTarget.isEmpty()) m_engine->postCommand("set gnutarget " + gnuTarget); if (!sysroot.isEmpty()) m_engine->postCommand("set sysroot " + sysroot); if (!searchPath.isEmpty()) m_engine->postCommand("set solib-search-path " + searchPath); if (!args.isEmpty()) m_engine->postCommand("-exec-arguments " + args.toLocal8Bit()); // This has to be issued before 'target remote'. On pre-7.0 the // command is not present and will result in ' No symbol table is // loaded. Use the "file" command.' as gdb tries to set the // value of a variable with name 'target-async'. // // Testing with -list-target-features which was introduced at // the same time would not work either, as this need an existing // target. // // Using it even without a target and having it fail might still // be better as: // Some external comment: '[but] "set target-async on" with a native // windows gdb will work, but then fail when you actually do // "run"/"attach", I think.. // gdb/mi/mi-main.c:1958: internal-error: // mi_execute_async_cli_command: Assertion `is_running (inferior_ptid)' // failed.\nA problem internal to GDB has been detected,[...] if (debuggerCore()->boolSetting(TargetAsync)) m_engine->postCommand("set target-async on", CB(handleSetTargetAsync)); if (fileName.isEmpty()) { showMessage(tr("No symbol file given."), StatusBar); callTargetRemote(); return; } m_engine->postCommand("-file-exec-and-symbols \"" + fileName.toLocal8Bit() + '"', CB(handleFileExecAndSymbols)); }
void GdbRemoteServerEngine::handleFileExecAndSymbols(const GdbResponse &response) { QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); if (response.resultClass == GdbResultDone) { callTargetRemote(); } else { QByteArray reason = response.data["msg"].data(); QString msg = tr("Reading debug information failed:\n"); msg += QString::fromLocal8Bit(reason); if (reason.endsWith("No such file or directory.")) { showMessage(_("INFERIOR STARTUP: BINARY NOT FOUND")); showMessage(msg, StatusBar); callTargetRemote(); // Proceed nevertheless. } else { notifyInferiorSetupFailed(msg); } } }
void RemoteGdbServerAdapter::handleFileExecAndSymbols(const GdbResponse &response) { QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); if (response.resultClass == GdbResultDone) { callTargetRemote(); } else { QString msg = tr("Reading debug information failed:\n"); msg += QString::fromLocal8Bit(response.data.findChild("msg").data()); m_engine->notifyInferiorSetupFailed(msg); } }