Commit 7ec95338 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen

more reliable startup breakpoint handling

instead of picking "random" known entry point symbols, ask the debugger
for the actual entry point.
this also removes the "one instruction after the first one" hack, as it
seems fairly pointless.
NOTE: this does *not* work with the 2005 version of apple gdb.

Conflicts:

	src/plugins/debugger/gdbengine.cpp
parent 4a5137e0
......@@ -234,20 +234,6 @@ static bool isLeavableFunction(const QString &funcName, const QString &fileName)
return false;
}
static QString startSymbolName()
{
#ifdef Q_OS_WIN
return "WinMainCRTStartup";
#endif
#ifdef Q_OS_MAC
return "main";
return "_start";
#endif
#ifdef Q_OS_LINUX
return "_start";
#endif
}
///////////////////////////////////////////////////////////////////////
//
......@@ -1679,7 +1665,7 @@ bool GdbEngine::startDebugger()
#ifndef Q_OS_MAC
sendCommand("set auto-solib-add off");
#endif
sendCommand("x/2i " + startSymbolName(), GdbStart);
sendCommand("info target", GdbStart);
}
// set all to "pending"
......@@ -1702,19 +1688,14 @@ void GdbEngine::continueInferior()
void GdbEngine::handleStart(const GdbResultRecord &response)
{
if (response.resultClass == GdbResultDone) {
// stdout:&"x/2i _start\n"
// stdout:~"0x404540 <_start>:\txor %ebp,%ebp\n"
// stdout:~"0x404542 <_start+2>:\tmov %rdx,%r9\n"
// [some leading stdout here]
// stdout:&" Entry point: 0x80831f0 0x08048134 - 0x08048147 is .interp\n"
// [some trailing stdout here]
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() + "\\+.*>:");
#endif
if (needle.lastIndexIn(msg) != -1) {
QRegExp needle("\\bEntry point: (0x[0-9a-f]+)\\b");
if (needle.indexIn(msg) != -1) {
//debugMessage("STREAM: " + msg + " " + needle.cap(1));
sendCommand("tbreak *0x" + needle.cap(1));
sendCommand("tbreak *" + needle.cap(1));
m_waitingForFirstBreakpointToBeHit = true;
qq->notifyInferiorRunningRequested();
sendCommand("-exec-run");
......@@ -1722,7 +1703,7 @@ void GdbEngine::handleStart(const GdbResultRecord &response)
debugMessage("PARSING START ADDRESS FAILED: " + msg);
}
} else if (response.resultClass == GdbResultError) {
debugMessage("PARSING START ADDRESS FAILED: " + response.toString());
debugMessage("FETCHING START ADDRESS FAILED: " + response.toString());
}
}
......
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