forked from qt-creator/qt-creator
Debugger: Improve core unpacking
* Delete process when finished * Handle unpack failure * Support lzop on Windows (if available) Change-Id: I8d95b77922c8b22b5874dffd8f935ff184902e12 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
46171f5470
commit
5b115fe9ae
@@ -56,12 +56,19 @@ namespace Internal {
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
GdbCoreEngine::GdbCoreEngine(const DebuggerStartParameters &startParameters)
|
||||
: GdbEngine(startParameters)
|
||||
: GdbEngine(startParameters),
|
||||
m_coreUnpackProcess(0)
|
||||
{}
|
||||
|
||||
GdbCoreEngine::~GdbCoreEngine()
|
||||
{
|
||||
if (false && !m_tempCoreName.isEmpty()) {
|
||||
if (m_coreUnpackProcess) {
|
||||
m_coreUnpackProcess->blockSignals(true);
|
||||
m_coreUnpackProcess->terminate();
|
||||
m_coreUnpackProcess->deleteLater();
|
||||
m_coreUnpackProcess = 0;
|
||||
}
|
||||
if (!m_tempCoreName.isEmpty()) {
|
||||
QFile tmpFile(m_tempCoreName);
|
||||
tmpFile.remove();
|
||||
}
|
||||
@@ -114,19 +121,18 @@ QString GdbCoreEngine::readExecutableNameFromCore(bool *isCore)
|
||||
|
||||
void GdbCoreEngine::continueSetupEngine()
|
||||
{
|
||||
if (m_executable.isEmpty()) {
|
||||
bool isCore = true;
|
||||
if (m_coreUnpackProcess) {
|
||||
isCore = m_coreUnpackProcess->exitCode() == 0;
|
||||
m_coreUnpackProcess->deleteLater();
|
||||
m_coreUnpackProcess = 0;
|
||||
}
|
||||
if (isCore && m_executable.isEmpty()) {
|
||||
// Read executable from core.
|
||||
bool isCore = false;
|
||||
isCore = false;
|
||||
m_executable = readExecutableNameFromCore(&isCore);
|
||||
|
||||
if (!isCore) {
|
||||
showMessageBox(QMessageBox::Warning,
|
||||
tr("Error Loading Core File"),
|
||||
tr("The specified file does not appear to be a core file."));
|
||||
notifyEngineSetupFailed();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isCore) {
|
||||
// Strip off command line arguments. FIXME: make robust.
|
||||
int idx = m_executable.indexOf(QLatin1Char(' '));
|
||||
if (idx >= 0)
|
||||
@@ -139,7 +145,15 @@ void GdbCoreEngine::continueSetupEngine()
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isCore)
|
||||
startGdb();
|
||||
else {
|
||||
showMessageBox(QMessageBox::Warning,
|
||||
tr("Error Loading Core File"),
|
||||
tr("The specified file does not appear to be a core file."));
|
||||
notifyEngineSetupFailed();
|
||||
}
|
||||
}
|
||||
|
||||
void GdbCoreEngine::setupInferior()
|
||||
@@ -233,12 +247,12 @@ void GdbCoreEngine::unpackCoreIfNeeded()
|
||||
m_tempCoreName = tmp.fileName();
|
||||
}
|
||||
|
||||
QProcess *process = new QProcess(this);
|
||||
process->setWorkingDirectory(QDir::tempPath());
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("-o") << m_tempCoreName << QLatin1String("-x") << m_coreName;
|
||||
process->start(QLatin1String("/usr/bin/lzop"), arguments);
|
||||
connect(process, SIGNAL(finished(int)), SLOT(continueSetupEngine()));
|
||||
m_coreUnpackProcess = new QProcess(this);
|
||||
m_coreUnpackProcess->setWorkingDirectory(QDir::tempPath());
|
||||
m_coreUnpackProcess->start(QLatin1String("lzop"), arguments);
|
||||
connect(m_coreUnpackProcess, SIGNAL(finished(int)), SLOT(continueSetupEngine()));
|
||||
}
|
||||
|
||||
QString GdbCoreEngine::coreFileName() const
|
||||
|
@@ -74,6 +74,7 @@ private:
|
||||
QString m_coreName;
|
||||
LocalGdbProcess m_gdbProc;
|
||||
QString m_tempCoreName;
|
||||
QProcess *m_coreUnpackProcess;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
Reference in New Issue
Block a user