summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/gdb/coregdbadapter.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2013-06-09 09:05:47 +0300
committerOrgad Shaneh <orgads@gmail.com>2013-06-10 10:06:25 +0200
commit5b115fe9ae877ae850f069fd1d5d3952ba54ed03 (patch)
tree325369d91f0d707c2fe0947a68bb5d97ae1751ff /src/plugins/debugger/gdb/coregdbadapter.cpp
parent46171f54701d37adfdd0a340223f6c98d9a6efc5 (diff)
downloadqt-creator-5b115fe9ae877ae850f069fd1d5d3952ba54ed03.tar.gz
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>
Diffstat (limited to 'src/plugins/debugger/gdb/coregdbadapter.cpp')
-rw-r--r--src/plugins/debugger/gdb/coregdbadapter.cpp68
1 files changed, 41 insertions, 27 deletions
diff --git a/src/plugins/debugger/gdb/coregdbadapter.cpp b/src/plugins/debugger/gdb/coregdbadapter.cpp
index fb31d37f90..39f2b8187d 100644
--- a/src/plugins/debugger/gdb/coregdbadapter.cpp
+++ b/src/plugins/debugger/gdb/coregdbadapter.cpp
@@ -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,32 +121,39 @@ 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;
- }
-
- // Strip off command line arguments. FIXME: make robust.
- int idx = m_executable.indexOf(QLatin1Char(' '));
- if (idx >= 0)
- m_executable.truncate(idx);
- if (m_executable.isEmpty()) {
- showMessageBox(QMessageBox::Warning,
- tr("Error Loading Symbols"),
- tr("No executable to load symbols from specified core."));
- notifyEngineSetupFailed();
- return;
+ if (isCore) {
+ // Strip off command line arguments. FIXME: make robust.
+ int idx = m_executable.indexOf(QLatin1Char(' '));
+ if (idx >= 0)
+ m_executable.truncate(idx);
+ if (m_executable.isEmpty()) {
+ showMessageBox(QMessageBox::Warning,
+ tr("Error Loading Symbols"),
+ tr("No executable to load symbols from specified core."));
+ notifyEngineSetupFailed();
+ return;
+ }
}
}
- startGdb();
+ 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