summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-02-24 15:05:43 +0100
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-02-24 15:09:27 +0100
commit7ec95338d5be50b88eb4ea227cadf42b2d1fda6b (patch)
tree73425913a31bd3f89b341d40ad8316044592c7e6
parent4a5137e0aa0866fd57e0f9ae7c51e6d73a3883df (diff)
downloadqt-creator-7ec95338d5be50b88eb4ea227cadf42b2d1fda6b.tar.gz
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
-rw-r--r--src/plugins/debugger/gdbengine.cpp35
1 files changed, 8 insertions, 27 deletions
diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp
index 36f4c220de..151b269c7e 100644
--- a/src/plugins/debugger/gdbengine.cpp
+++ b/src/plugins/debugger/gdbengine.cpp
@@ -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());
}
}