QString GdbCoreEngine::readExecutableNameFromCore(bool *isCore) { #if 0 ElfReader reader(coreFileName()); return QString::fromLocal8Bit(reader.readCoreName(isCore)); #else const DebuggerStartParameters &sp = startParameters(); QStringList args; args.append(QLatin1String("-nx")); args.append(QLatin1String("-batch")); args.append(QLatin1String("-c")); args.append(coreFileName()); QProcess proc; proc.start(sp.debuggerCommand, args); if (proc.waitForFinished()) { QByteArray ba = proc.readAllStandardOutput(); // Core was generated by `/data/dev/creator-2.6/bin/qtcreator'. // Program terminated with signal 11, Segmentation fault. int pos1 = ba.indexOf("Core was generated by"); if (pos1 != -1) { pos1 += 23; int pos2 = ba.indexOf('\'', pos1); if (pos2 != -1) { *isCore = true; return QString::fromLocal8Bit(ba.mid(pos1, pos2 - pos1)); } } } return QString(); #endif }
void GdbCoreEngine::continueSetupEngine() { bool isCore = true; if (m_coreUnpackProcess) { isCore = m_coreUnpackProcess->exitCode() == 0; m_coreUnpackProcess->deleteLater(); m_coreUnpackProcess = 0; if (m_tempCoreFile.isOpen()) m_tempCoreFile.close(); } if (isCore && m_executable.isEmpty()) { GdbCoreEngine::CoreInfo cinfo = readExecutableNameFromCore( startParameters().debuggerCommand, coreFileName()); if (cinfo.isCore) { m_executable = cinfo.foundExecutableName; if (m_executable.isEmpty()) { Core::AsynchronousMessageBox::warning( tr("Error Loading Symbols"), tr("No executable to load symbols from specified core.")); notifyEngineSetupFailed(); return; } } } if (isCore) { startGdb(); } else { Core::AsynchronousMessageBox::warning( tr("Error Loading Core File"), tr("The specified file does not appear to be a core file.")); notifyEngineSetupFailed(); } }
void GdbCoreEngine::runEngine() { CHECK_STATE(EngineRunRequested); runCommand({"target core " + coreFileName().toLocal8Bit(), NoFlags, CB(handleTargetCore) }); }
void GdbCoreEngine::handleFileExecAndSymbols(const DebuggerResponse &response) { CHECK_STATE(InferiorSetupRequested); QString core = coreFileName(); if (response.resultClass == ResultDone) { showMessage(tr("Symbols found."), StatusBar); handleInferiorPrepared(); } else { QString msg = tr("No symbols found in core file <i>%1</i>.").arg(core) + _(" ") + tr("This can be caused by a path length limitation " "in the core file.") + _(" ") + tr("Try to specify the binary using the " "<i>Debug->Start Debugging->Attach to Core</i> dialog."); notifyInferiorSetupFailed(msg); } }
void GdbCoreEngine::handleFileExecAndSymbols(const GdbResponse &response) { QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); QString core = coreFileName(); if (response.resultClass == GdbResultDone) { showMessage(tr("Symbols found."), StatusBar); postCommand("target core " + core.toLocal8Bit(), CB(handleTargetCore)); return; } QString msg = tr("No symbols found in core file <i>%1</i>.") .arg(core); msg += _(" "); msg += tr("This can be caused by a path length limitation in the " "core file."); msg += _(" "); msg += tr("Try to specify the binary using the " "<i>Debug->Start Debugging->Attach to Core</i> dialog."); notifyInferiorSetupFailed(msg); }