From 7ec95338d5be50b88eb4ea227cadf42b2d1fda6b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 24 Feb 2009 15:05:43 +0100 Subject: 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 --- src/plugins/debugger/gdbengine.cpp | 35 ++++++++--------------------------- 1 file 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()); } } -- cgit v1.2.1