forked from qt-creator/qt-creator
Fixes: debugger: fix Mac OS 10.4
This commit is contained in:
@@ -237,7 +237,12 @@ static QString startSymbolName()
|
|||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
return "WinMainCRTStartup";
|
return "WinMainCRTStartup";
|
||||||
#else
|
#endif
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
return "main";
|
||||||
|
return "_start";
|
||||||
|
#endif
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
return "_start";
|
return "_start";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -296,6 +301,7 @@ void GdbEngine::initializeVariables()
|
|||||||
{
|
{
|
||||||
m_dataDumperState = DataDumperUninitialized;
|
m_dataDumperState = DataDumperUninitialized;
|
||||||
m_gdbVersion = 100;
|
m_gdbVersion = 100;
|
||||||
|
m_gdbBuildVersion = -1;
|
||||||
|
|
||||||
m_fullToShortName.clear();
|
m_fullToShortName.clear();
|
||||||
m_shortToFullName.clear();
|
m_shortToFullName.clear();
|
||||||
@@ -483,8 +489,20 @@ void GdbEngine::handleResponse()
|
|||||||
handleAsyncOutput(record);
|
handleAsyncOutput(record);
|
||||||
} else if (asyncClass == "running") {
|
} else if (asyncClass == "running") {
|
||||||
// Archer has 'thread-id="all"' here
|
// Archer has 'thread-id="all"' here
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
} else if (asyncClass == "shlibs-updated") {
|
||||||
|
// MAC announces updated libs
|
||||||
|
} else if (asyncClass == "shlibs-added") {
|
||||||
|
// MAC announces added libs
|
||||||
|
// {shlib-info={num="2", name="libmathCommon.A_debug.dylib",
|
||||||
|
// kind="-", dyld-addr="0x7f000", reason="dyld", requested-state="Y",
|
||||||
|
// state="Y", path="/usr/lib/system/libmathCommon.A_debug.dylib",
|
||||||
|
// description="/usr/lib/system/libmathCommon.A_debug.dylib",
|
||||||
|
// loaded_addr="0x7f000", slide="0x7f000", prefix=""}}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "IGNORED ASYNC OUTPUT " << record.toString();
|
qDebug() << "IGNORED ASYNC OUTPUT "
|
||||||
|
<< asyncClass << record.toString();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -760,7 +778,7 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
|
|||||||
|
|
||||||
// FIXME: this falsely rejects results from the custom dumper recognition
|
// FIXME: this falsely rejects results from the custom dumper recognition
|
||||||
// procedure, too...
|
// procedure, too...
|
||||||
if (record.token < m_oldestAcceptableToken) {
|
if (record.token < m_oldestAcceptableToken && cmd.type >= 300) {
|
||||||
//qDebug() << "### SKIPPING OLD RESULT " << record.toString();
|
//qDebug() << "### SKIPPING OLD RESULT " << record.toString();
|
||||||
//QMessageBox::information(m_mainWindow, tr("Skipped"), "xxx");
|
//QMessageBox::information(m_mainWindow, tr("Skipped"), "xxx");
|
||||||
return;
|
return;
|
||||||
@@ -1160,6 +1178,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
|
|||||||
reloadSourceFiles();
|
reloadSourceFiles();
|
||||||
tryLoadCustomDumpers();
|
tryLoadCustomDumpers();
|
||||||
|
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
// intentionally after tryLoadCustomDumpers(),
|
// intentionally after tryLoadCustomDumpers(),
|
||||||
// otherwise we'd interupt solib loading.
|
// otherwise we'd interupt solib loading.
|
||||||
if (qq->wantsAllPluginBreakpoints()) {
|
if (qq->wantsAllPluginBreakpoints()) {
|
||||||
@@ -1175,11 +1194,13 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
|
|||||||
sendCommand("set auto-solib-add off");
|
sendCommand("set auto-solib-add off");
|
||||||
sendCommand("set stop-on-solib-events 0");
|
sendCommand("set stop-on-solib-events 0");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// nicer to see a bit of the world we live in
|
// nicer to see a bit of the world we live in
|
||||||
reloadModules();
|
reloadModules();
|
||||||
// this will "continue" if done
|
// this will "continue" if done
|
||||||
m_waitingForBreakpointSynchronizationToContinue = true;
|
m_waitingForBreakpointSynchronizationToContinue = true;
|
||||||
QTimer::singleShot(0, this, SLOT(attemptBreakpointSynchronization()));
|
//QTimer::singleShot(0, this, SLOT(attemptBreakpointSynchronization()));
|
||||||
|
attemptBreakpointSynchronization();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1344,10 +1365,14 @@ void GdbEngine::handleAsyncOutput2(const GdbMi &data)
|
|||||||
|
|
||||||
void GdbEngine::handleShowVersion(const GdbResultRecord &response)
|
void GdbEngine::handleShowVersion(const GdbResultRecord &response)
|
||||||
{
|
{
|
||||||
|
//qDebug () << "VERSION 2:" << response.data.findChild("consolestreamoutput").data();
|
||||||
|
//qDebug () << "VERSION:" << response.toString();
|
||||||
|
debugMessage("VERSION:" + response.toString());
|
||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
m_gdbVersion = 100;
|
m_gdbVersion = 100;
|
||||||
|
m_gdbBuildVersion = -1;
|
||||||
QString msg = response.data.findChild("consolestreamoutput").data();
|
QString msg = response.data.findChild("consolestreamoutput").data();
|
||||||
QRegExp supported("GNU gdb(.*) (\\d+)\\.(\\d+)(\\.(\\d+))?");
|
QRegExp supported("GNU gdb(.*) (\\d+)\\.(\\d+)(\\.(\\d+))?(-(\\d+))?");
|
||||||
if (supported.indexIn(msg) == -1) {
|
if (supported.indexIn(msg) == -1) {
|
||||||
debugMessage("UNSUPPORTED GDB VERSION " + msg);
|
debugMessage("UNSUPPORTED GDB VERSION " + msg);
|
||||||
QStringList list = msg.split("\n");
|
QStringList list = msg.split("\n");
|
||||||
@@ -1370,8 +1395,10 @@ void GdbEngine::handleShowVersion(const GdbResultRecord &response)
|
|||||||
m_gdbVersion = 10000 * supported.cap(2).toInt()
|
m_gdbVersion = 10000 * supported.cap(2).toInt()
|
||||||
+ 100 * supported.cap(3).toInt()
|
+ 100 * supported.cap(3).toInt()
|
||||||
+ 1 * supported.cap(5).toInt();
|
+ 1 * supported.cap(5).toInt();
|
||||||
//debugMessage(QString("GDB VERSION: %1").arg(m_gdbVersion));
|
m_gdbBuildVersion = supported.cap(7).toInt();
|
||||||
|
debugMessage(QString("GDB VERSION: %1").arg(m_gdbVersion));
|
||||||
}
|
}
|
||||||
|
//qDebug () << "VERSION 3:" << m_gdbVersion << m_gdbBuildVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1638,10 +1665,12 @@ bool GdbEngine::startDebugger()
|
|||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
sendCommand("sharedlibrary apply-load-rules all");
|
sendCommand("sharedlibrary apply-load-rules all");
|
||||||
#endif
|
#endif
|
||||||
setTokenBarrier();
|
//setTokenBarrier();
|
||||||
if (!q->m_processArgs.isEmpty())
|
if (!q->m_processArgs.isEmpty())
|
||||||
sendCommand("-exec-arguments " + q->m_processArgs.join(" "));
|
sendCommand("-exec-arguments " + q->m_processArgs.join(" "));
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
sendCommand("set auto-solib-add off");
|
sendCommand("set auto-solib-add off");
|
||||||
|
#endif
|
||||||
sendCommand("x/2i " + startSymbolName(), GdbStart);
|
sendCommand("x/2i " + startSymbolName(), GdbStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1670,8 +1699,13 @@ void GdbEngine::handleStart(const GdbResultRecord &response)
|
|||||||
// stdout:~"0x404540 <_start>:\txor %ebp,%ebp\n"
|
// stdout:~"0x404540 <_start>:\txor %ebp,%ebp\n"
|
||||||
// stdout:~"0x404542 <_start+2>:\tmov %rdx,%r9\n"
|
// stdout:~"0x404542 <_start+2>:\tmov %rdx,%r9\n"
|
||||||
QString msg = response.data.findChild("consolestreamoutput").data();
|
QString msg = response.data.findChild("consolestreamoutput").data();
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
// this ends up in 'gettimeoftheday' or such on MacOS 10.4
|
||||||
|
QRegExp needle("0x([0-9a-f]+) <.*\\+.*>:");
|
||||||
|
#else
|
||||||
QRegExp needle("0x([0-9a-f]+) <" + startSymbolName() + "\\+.*>:");
|
QRegExp needle("0x([0-9a-f]+) <" + startSymbolName() + "\\+.*>:");
|
||||||
if (needle.indexIn(msg) != -1) {
|
#endif
|
||||||
|
if (needle.lastIndexIn(msg) != -1) {
|
||||||
//debugMessage("STREAM: " + msg + " " + needle.cap(1));
|
//debugMessage("STREAM: " + msg + " " + needle.cap(1));
|
||||||
sendCommand("tbreak *0x" + needle.cap(1));
|
sendCommand("tbreak *0x" + needle.cap(1));
|
||||||
m_waitingForFirstBreakpointToBeHit = true;
|
m_waitingForFirstBreakpointToBeHit = true;
|
||||||
@@ -4016,12 +4050,12 @@ void GdbEngine::tryLoadCustomDumpers()
|
|||||||
QString lib = q->m_buildDir + "/qtc-gdbmacros/libgdbmacros.dylib";
|
QString lib = q->m_buildDir + "/qtc-gdbmacros/libgdbmacros.dylib";
|
||||||
if (QFileInfo(lib).exists()) {
|
if (QFileInfo(lib).exists()) {
|
||||||
m_dataDumperState = DataDumperLoadTried;
|
m_dataDumperState = DataDumperLoadTried;
|
||||||
sendCommand("sharedlibrary libc"); // for malloc
|
//sendCommand("sharedlibrary libc"); // for malloc
|
||||||
sendCommand("sharedlibrary libdl"); // for dlopen
|
//sendCommand("sharedlibrary libdl"); // for dlopen
|
||||||
QString flag = QString::number(RTLD_NOW);
|
QString flag = QString::number(RTLD_NOW);
|
||||||
sendCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")",
|
sendCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")",
|
||||||
WatchDumpCustomSetup);
|
WatchDumpCustomSetup);
|
||||||
sendCommand("sharedlibrary " + dotEscape(lib));
|
//sendCommand("sharedlibrary " + dotEscape(lib));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
|
@@ -220,6 +220,7 @@ private:
|
|||||||
int m_oldestAcceptableToken;
|
int m_oldestAcceptableToken;
|
||||||
|
|
||||||
int m_gdbVersion; // 6.8.0 is 680
|
int m_gdbVersion; // 6.8.0 is 680
|
||||||
|
int m_gdbBuildVersion; // MAC only?
|
||||||
|
|
||||||
// awful hack to keep track of used files
|
// awful hack to keep track of used files
|
||||||
QMap<QString, QString> m_shortToFullName;
|
QMap<QString, QString> m_shortToFullName;
|
||||||
|
Reference in New Issue
Block a user