Commit c23bf0da authored by hjk's avatar hjk
Browse files

debugger: use gdb again to read executable file name from core



Change-Id: I035d1260c5cf08d4a65adb4494a5f83045effecf
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 526c2bfe
......@@ -88,13 +88,44 @@ void GdbCoreEngine::setupEngine()
unpackCoreIfNeeded();
}
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()
{
if (m_executable.isEmpty()) {
// Read executable from core.
ElfReader reader(coreFileName());
bool isCore = false;
m_executable = QString::fromLocal8Bit(reader.readCoreName(&isCore));
m_executable = readExecutableNameFromCore(&isCore);
if (!isCore) {
showMessageBox(QMessageBox::Warning,
......
......@@ -68,6 +68,7 @@ private:
void unpackCoreIfNeeded();
QString coreFileName() const;
Q_SLOT void continueSetupEngine();
QString readExecutableNameFromCore(bool *isCore);
QString coreName() const;
QString m_executable;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment