forked from qt-creator/qt-creator
debugger: use gdb again to read executable file name from core
Change-Id: I035d1260c5cf08d4a65adb4494a5f83045effecf Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user