diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 36f4c220dec89409f61272fe94223b08ca65029b..151b269c7e7d5f716e331f72d0713d1ed6297765 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()); } }