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();
|
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()
|
void GdbCoreEngine::continueSetupEngine()
|
||||||
{
|
{
|
||||||
if (m_executable.isEmpty()) {
|
if (m_executable.isEmpty()) {
|
||||||
// Read executable from core.
|
// Read executable from core.
|
||||||
ElfReader reader(coreFileName());
|
|
||||||
bool isCore = false;
|
bool isCore = false;
|
||||||
m_executable = QString::fromLocal8Bit(reader.readCoreName(&isCore));
|
m_executable = readExecutableNameFromCore(&isCore);
|
||||||
|
|
||||||
if (!isCore) {
|
if (!isCore) {
|
||||||
showMessageBox(QMessageBox::Warning,
|
showMessageBox(QMessageBox::Warning,
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ private:
|
|||||||
void unpackCoreIfNeeded();
|
void unpackCoreIfNeeded();
|
||||||
QString coreFileName() const;
|
QString coreFileName() const;
|
||||||
Q_SLOT void continueSetupEngine();
|
Q_SLOT void continueSetupEngine();
|
||||||
|
QString readExecutableNameFromCore(bool *isCore);
|
||||||
QString coreName() const;
|
QString coreName() const;
|
||||||
|
|
||||||
QString m_executable;
|
QString m_executable;
|
||||||
|
|||||||
Reference in New Issue
Block a user