forked from qt-creator/qt-creator
Debugger[CDB]: Implement AttachCore for debugdiag dumps.
Change-Id: I19c57248ed5e7c43b14b849419c9edf29bca26dc Reviewed-on: http://codereview.qt.nokia.com/2706 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
@@ -316,7 +316,6 @@ static inline bool validMode(DebuggerStartMode sm)
|
|||||||
{
|
{
|
||||||
switch (sm) {
|
switch (sm) {
|
||||||
case NoStartMode:
|
case NoStartMode:
|
||||||
case AttachCore:
|
|
||||||
case StartRemoteGdb:
|
case StartRemoteGdb:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
@@ -394,6 +393,12 @@ bool checkCdbConfiguration(const DebuggerStartParameters &sp, ConfigurationCheck
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sp.toolChainAbi.osFlavor() == Abi::WindowsMSysFlavor
|
||||||
|
&& sp.startMode == AttachCore) {
|
||||||
|
check->errorDetails.push_back(CdbEngine::tr("The CDB debug engine cannot debug MSys core files."));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (cdbBinary(sp).isEmpty()) {
|
if (cdbBinary(sp).isEmpty()) {
|
||||||
check->errorDetails.push_back(msgNoCdbBinaryForToolChain(sp.toolChainAbi));
|
check->errorDetails.push_back(msgNoCdbBinaryForToolChain(sp.toolChainAbi));
|
||||||
check->settingsCategory = QLatin1String(ProjectExplorer::Constants::TOOLCHAIN_SETTINGS_CATEGORY);
|
check->settingsCategory = QLatin1String(ProjectExplorer::Constants::TOOLCHAIN_SETTINGS_CATEGORY);
|
||||||
@@ -479,6 +484,7 @@ void CdbEngine::init()
|
|||||||
m_pendingBreakpointMap.clear();
|
m_pendingBreakpointMap.clear();
|
||||||
m_customSpecialStopData.clear();
|
m_customSpecialStopData.clear();
|
||||||
m_symbolAddressCache.clear();
|
m_symbolAddressCache.clear();
|
||||||
|
m_coreStopReason.reset();
|
||||||
|
|
||||||
// Create local list of mappings in native separators
|
// Create local list of mappings in native separators
|
||||||
m_sourcePathMappings.clear();
|
m_sourcePathMappings.clear();
|
||||||
@@ -769,6 +775,9 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa
|
|||||||
arguments << QLatin1String("-pr") << QLatin1String("-pb");
|
arguments << QLatin1String("-pr") << QLatin1String("-pb");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case AttachCore:
|
||||||
|
arguments << QLatin1String("-z") << sp.coreFile;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
*errorMessage = QString::fromLatin1("Internal error: Unsupported start mode %1.").arg(sp.startMode);
|
*errorMessage = QString::fromLatin1("Internal error: Unsupported start mode %1.").arg(sp.startMode);
|
||||||
return false;
|
return false;
|
||||||
@@ -845,7 +854,13 @@ void CdbEngine::runEngine()
|
|||||||
qDebug("runEngine");
|
qDebug("runEngine");
|
||||||
foreach (const QString &breakEvent, m_options->breakEvents)
|
foreach (const QString &breakEvent, m_options->breakEvents)
|
||||||
postCommand(QByteArray("sxe ") + breakEvent.toAscii(), 0);
|
postCommand(QByteArray("sxe ") + breakEvent.toAscii(), 0);
|
||||||
|
if (startParameters().startMode == AttachCore) {
|
||||||
|
QTC_ASSERT(!m_coreStopReason.isNull(), return; );
|
||||||
|
notifyInferiorUnrunnable();
|
||||||
|
processStop(*m_coreStopReason, false);
|
||||||
|
} else {
|
||||||
postCommand("g", 0);
|
postCommand("g", 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CdbEngine::commandsPending() const
|
bool CdbEngine::commandsPending() const
|
||||||
@@ -1766,8 +1781,10 @@ void CdbEngine::reloadFullStack()
|
|||||||
|
|
||||||
void CdbEngine::handlePid(const CdbExtensionCommandPtr &reply)
|
void CdbEngine::handlePid(const CdbExtensionCommandPtr &reply)
|
||||||
{
|
{
|
||||||
if (reply->success) {
|
// Fails for core dumps.
|
||||||
|
if (reply->success)
|
||||||
notifyInferiorPid(reply->reply.toULongLong());
|
notifyInferiorPid(reply->reply.toULongLong());
|
||||||
|
if (reply->success || startParameters().startMode == AttachCore) {
|
||||||
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorSetupOk")
|
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorSetupOk")
|
||||||
notifyInferiorSetupOk();
|
notifyInferiorSetupOk();
|
||||||
} else {
|
} else {
|
||||||
@@ -2107,8 +2124,14 @@ void CdbEngine::handleSessionIdle(const QByteArray &messageBA)
|
|||||||
if (state() == EngineSetupRequested) { // Temporary stop at beginning
|
if (state() == EngineSetupRequested) { // Temporary stop at beginning
|
||||||
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyEngineSetupOk")
|
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyEngineSetupOk")
|
||||||
notifyEngineSetupOk();
|
notifyEngineSetupOk();
|
||||||
|
// Store stop reason to be handled in runEngine().
|
||||||
|
if (startParameters().startMode == AttachCore) {
|
||||||
|
m_coreStopReason.reset(new GdbMi);
|
||||||
|
m_coreStopReason->fromString(messageBA);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdbMi stopReason;
|
GdbMi stopReason;
|
||||||
stopReason.fromString(messageBA);
|
stopReason.fromString(messageBA);
|
||||||
processStop(stopReason, false);
|
processStop(stopReason, false);
|
||||||
@@ -2136,6 +2159,7 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
|
|||||||
}
|
}
|
||||||
// Notify about state and send off command sequence to get stack, etc.
|
// Notify about state and send off command sequence to get stack, etc.
|
||||||
if (stopFlags & StopNotifyStop) {
|
if (stopFlags & StopNotifyStop) {
|
||||||
|
if (startParameters().startMode != AttachCore) {
|
||||||
if (state() == InferiorStopRequested) {
|
if (state() == InferiorStopRequested) {
|
||||||
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorStopOk")
|
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorStopOk")
|
||||||
notifyInferiorStopOk();
|
notifyInferiorStopOk();
|
||||||
@@ -2143,6 +2167,7 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
|
|||||||
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorSpontaneousStop")
|
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorSpontaneousStop")
|
||||||
notifyInferiorSpontaneousStop();
|
notifyInferiorSpontaneousStop();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Prevent further commands from being sent if shutdown is in progress
|
// Prevent further commands from being sent if shutdown is in progress
|
||||||
if (stopFlags & StopShutdownInProgress) {
|
if (stopFlags & StopShutdownInProgress) {
|
||||||
showMessage(QString::fromLatin1("Shutdown request detected..."));
|
showMessage(QString::fromLatin1("Shutdown request detected..."));
|
||||||
|
|||||||
@@ -282,6 +282,7 @@ private:
|
|||||||
bool m_ignoreCdbOutput;
|
bool m_ignoreCdbOutput;
|
||||||
QVariantList m_customSpecialStopData;
|
QVariantList m_customSpecialStopData;
|
||||||
QList<SourcePathMapping> m_sourcePathMappings;
|
QList<SourcePathMapping> m_sourcePathMappings;
|
||||||
|
QScopedPointer<GdbMi> m_coreStopReason;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -449,6 +449,11 @@ static QList<DebuggerEngineType> enginesForMode(DebuggerStartMode startMode,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AttachCore:
|
case AttachCore:
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
result.push_back(CdbEngineType);
|
||||||
|
#endif
|
||||||
|
result.push_back(GdbEngineType);
|
||||||
|
break;
|
||||||
case StartRemoteGdb:
|
case StartRemoteGdb:
|
||||||
result.push_back(GdbEngineType);
|
result.push_back(GdbEngineType);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user