forked from qt-creator/qt-creator
Fixes: debugger: try fixing startup break on make
This commit is contained in:
@@ -301,6 +301,7 @@ void GdbEngine::initializeVariables()
|
|||||||
m_outputCodec = QTextCodec::codecForLocale();
|
m_outputCodec = QTextCodec::codecForLocale();
|
||||||
m_pendingRequests = 0;
|
m_pendingRequests = 0;
|
||||||
m_waitingForBreakpointSynchronizationToContinue = false;
|
m_waitingForBreakpointSynchronizationToContinue = false;
|
||||||
|
m_waitingForFirstBreakpointToBeHit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::gdbProcError(QProcess::ProcessError error)
|
void GdbEngine::gdbProcError(QProcess::ProcessError error)
|
||||||
@@ -1083,52 +1084,47 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
|
|||||||
{
|
{
|
||||||
const QString reason = data.findChild("reason").data();
|
const QString reason = data.findChild("reason").data();
|
||||||
|
|
||||||
QString msg = data.findChild("consolestreamoutput").data();
|
bool isFirstStop = data.findChild("bkptno").data() == "1";
|
||||||
if (reason.isEmpty()) {
|
if (isFirstStop && m_waitingForFirstBreakpointToBeHit) {
|
||||||
GdbMi frame = data.findChild("frame");
|
//
|
||||||
if (frame.findChild("func").data() == startSymbolName()) {
|
// that's the "early stop"
|
||||||
//
|
//
|
||||||
// that's the "early stop"
|
#if defined(Q_OS_WIN)
|
||||||
//
|
sendCommand("info proc", GdbInfoProc);
|
||||||
frame.findChild("func").data() + '%';
|
#endif
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_LINUX)
|
||||||
sendCommand("info proc", GdbInfoProc);
|
sendCommand("info proc", GdbInfoProc);
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_MAC)
|
||||||
sendCommand("info proc", GdbInfoProc);
|
sendCommand("info pid", GdbInfoProc, QVariant(), true);
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_MAC)
|
sendCommand("-file-list-exec-source-files", GdbQuerySources);
|
||||||
sendCommand("info pid", GdbInfoProc, QVariant(), true);
|
tryLoadCustomDumpers();
|
||||||
#endif
|
|
||||||
sendCommand("-file-list-exec-source-files", GdbQuerySources);
|
|
||||||
tryLoadCustomDumpers();
|
|
||||||
|
|
||||||
// intentionally after tryLoadCustomDumpers(),
|
// intentionally after tryLoadCustomDumpers(),
|
||||||
// otherwise we'd interupt solib loading.
|
// otherwise we'd interupt solib loading.
|
||||||
if (qq->wantsAllPluginBreakpoints()) {
|
if (qq->wantsAllPluginBreakpoints()) {
|
||||||
sendCommand("set auto-solib-add on");
|
sendCommand("set auto-solib-add on");
|
||||||
sendCommand("set stop-on-solib-events 0");
|
sendCommand("set stop-on-solib-events 0");
|
||||||
sendCommand("sharedlibrary .*");
|
sendCommand("sharedlibrary .*");
|
||||||
} else if (qq->wantsSelectedPluginBreakpoints()) {
|
} else if (qq->wantsSelectedPluginBreakpoints()) {
|
||||||
sendCommand("set auto-solib-add on");
|
sendCommand("set auto-solib-add on");
|
||||||
sendCommand("set stop-on-solib-events 1");
|
sendCommand("set stop-on-solib-events 1");
|
||||||
sendCommand("sharedlibrary "+qq->selectedPluginBreakpointsPattern());
|
sendCommand("sharedlibrary "+qq->selectedPluginBreakpointsPattern());
|
||||||
} else if (qq->wantsNoPluginBreakpoints()) {
|
} else if (qq->wantsNoPluginBreakpoints()) {
|
||||||
// should be like that already
|
// should be like that already
|
||||||
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");
|
||||||
}
|
|
||||||
// nicer to see a bit of the world we live in
|
|
||||||
reloadModules();
|
|
||||||
// this will "continue" if done
|
|
||||||
m_waitingForBreakpointSynchronizationToContinue = true;
|
|
||||||
QTimer::singleShot(0, this, SLOT(attemptBreakpointSynchronization()));
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
qDebug() << "EMPTY REASON FOR STOPPED";
|
// nicer to see a bit of the world we live in
|
||||||
// fall through
|
reloadModules();
|
||||||
|
// this will "continue" if done
|
||||||
|
m_waitingForBreakpointSynchronizationToContinue = true;
|
||||||
|
QTimer::singleShot(0, this, SLOT(attemptBreakpointSynchronization()));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString msg = data.findChild("consolestreamoutput").data();
|
||||||
if (msg.contains("Stopped due to shared library event") || reason.isEmpty()) {
|
if (msg.contains("Stopped due to shared library event") || reason.isEmpty()) {
|
||||||
if (qq->wantsSelectedPluginBreakpoints()) {
|
if (qq->wantsSelectedPluginBreakpoints()) {
|
||||||
qDebug() << "SHARED LIBRARY EVENT " << data.toString();
|
qDebug() << "SHARED LIBRARY EVENT " << data.toString();
|
||||||
@@ -1142,6 +1138,17 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
|
|||||||
// fall through
|
// fall through
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// seen on XP after removing a breakpoint while running
|
||||||
|
// stdout:945*stopped,reason="signal-received",signal-name="SIGTRAP",
|
||||||
|
// signal-meaning="Trace/breakpoint trap",thread-id="2",
|
||||||
|
// frame={addr="0x7c91120f",func="ntdll!DbgUiConnectToDbg",
|
||||||
|
// args=[],from="C:\\WINDOWS\\system32\\ntdll.dll"}
|
||||||
|
if (reason == "signal-received"
|
||||||
|
&& data.findChild("signal-name").toString() == "SIGTRAP") {
|
||||||
|
continueInferior();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isExitedReason(reason)) {
|
if (isExitedReason(reason)) {
|
||||||
qq->notifyInferiorExited();
|
qq->notifyInferiorExited();
|
||||||
QString msg = "Program exited normally";
|
QString msg = "Program exited normally";
|
||||||
@@ -1195,7 +1202,6 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
|
|||||||
if (isStoppedReason(reason) || reason.isEmpty()) {
|
if (isStoppedReason(reason) || reason.isEmpty()) {
|
||||||
if (m_modulesListOutdated) {
|
if (m_modulesListOutdated) {
|
||||||
reloadModules();
|
reloadModules();
|
||||||
QT_END_INCLUDE_NAMESPACE
|
|
||||||
m_modulesListOutdated = false;
|
m_modulesListOutdated = false;
|
||||||
}
|
}
|
||||||
// Need another round trip
|
// Need another round trip
|
||||||
@@ -1613,6 +1619,7 @@ void GdbEngine::handleStart(const GdbResultRecord &response)
|
|||||||
if (needle.indexIn(msg) != -1) {
|
if (needle.indexIn(msg) != -1) {
|
||||||
//qDebug() << "STREAM: " << msg << needle.cap(1);
|
//qDebug() << "STREAM: " << msg << needle.cap(1);
|
||||||
sendCommand("tbreak *0x" + needle.cap(1));
|
sendCommand("tbreak *0x" + needle.cap(1));
|
||||||
|
m_waitingForFirstBreakpointToBeHit = true;
|
||||||
sendCommand("-exec-run");
|
sendCommand("-exec-run");
|
||||||
qq->notifyInferiorRunningRequested();
|
qq->notifyInferiorRunningRequested();
|
||||||
} else {
|
} else {
|
||||||
|
@@ -330,6 +330,7 @@ private:
|
|||||||
QMap<QString, QString> m_varToType;
|
QMap<QString, QString> m_varToType;
|
||||||
|
|
||||||
bool m_waitingForBreakpointSynchronizationToContinue;
|
bool m_waitingForBreakpointSynchronizationToContinue;
|
||||||
|
bool m_waitingForFirstBreakpointToBeHit;
|
||||||
bool m_modulesListOutdated;
|
bool m_modulesListOutdated;
|
||||||
|
|
||||||
DebuggerManager *q;
|
DebuggerManager *q;
|
||||||
|
Reference in New Issue
Block a user