forked from qt-creator/qt-creator
debugger: make attach to running process stop the process (again)
This commit is contained in:
@@ -78,10 +78,11 @@ void AttachGdbAdapter::setupInferior()
|
|||||||
void AttachGdbAdapter::runEngine()
|
void AttachGdbAdapter::runEngine()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
|
||||||
m_engine->notifyEngineRunAndInferiorStopOk();
|
|
||||||
m_engine->continueInferiorInternal();
|
|
||||||
m_engine->showStatusMessage(tr("Attached to process %1.")
|
m_engine->showStatusMessage(tr("Attached to process %1.")
|
||||||
.arg(m_engine->inferiorPid()));
|
.arg(m_engine->inferiorPid()));
|
||||||
|
m_engine->notifyEngineRunAndInferiorStopOk();
|
||||||
|
GdbMi data;
|
||||||
|
m_engine->handleStop0(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttachGdbAdapter::handleAttach(const GdbResponse &response)
|
void AttachGdbAdapter::handleAttach(const GdbResponse &response)
|
||||||
|
|||||||
@@ -1215,6 +1215,34 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
|
|||||||
notifyInferiorStopOk();
|
notifyInferiorStopOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: Replace the #ifdef by the "target" architecture.
|
||||||
|
// FIXME: Is this needed at all anymore?
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
|
if (!m_entryPoint.isEmpty()) {
|
||||||
|
if (frame.findChild("addr").data() == m_entryPoint) {
|
||||||
|
// There are two expected reasons for getting here:
|
||||||
|
// 1) For some reason, attaching to a stopped process causes *two* SIGSTOPs
|
||||||
|
// when trying to continue (kernel i386 2.6.24-23-ubuntu, gdb 6.8).
|
||||||
|
// Interestingly enough, on MacOSX no signal is delivered at all.
|
||||||
|
// 2) The explicit tbreak at the entry point we set to query the PID.
|
||||||
|
// Gdb <= 6.8 reports a frame but no reason, 6.8.50+ reports everything.
|
||||||
|
// The case of the user really setting a breakpoint at _start is simply
|
||||||
|
// unsupported.
|
||||||
|
if (!inferiorPid()) // For programs without -pthread under gdb <= 6.8.
|
||||||
|
postCommand("info proc", CB(handleInfoProc));
|
||||||
|
continueInferiorInternal();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// We are past the initial stop(s). No need to waste time on further checks.
|
||||||
|
m_entryPoint.clear();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
handleStop0(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GdbEngine::handleStop0(const GdbMi &data)
|
||||||
|
{
|
||||||
#if 0 // See http://vladimir_prus.blogspot.com/2007/12/debugger-stories-pending-breakpoints.html
|
#if 0 // See http://vladimir_prus.blogspot.com/2007/12/debugger-stories-pending-breakpoints.html
|
||||||
// Due to LD_PRELOADing the dumpers, these events can occur even before
|
// Due to LD_PRELOADing the dumpers, these events can occur even before
|
||||||
// reaching the entry point. So handle it before the entry point hacks below.
|
// reaching the entry point. So handle it before the entry point hacks below.
|
||||||
@@ -1244,27 +1272,8 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// FIXME: Replace the #ifdef by the "target" architecture
|
const GdbMi frame = data.findChild("frame");
|
||||||
#ifdef Q_OS_LINUX
|
const QByteArray reason = data.findChild("reason").data();
|
||||||
if (!m_entryPoint.isEmpty()) {
|
|
||||||
if (frame.findChild("addr").data() == m_entryPoint) {
|
|
||||||
// There are two expected reasons for getting here:
|
|
||||||
// 1) For some reason, attaching to a stopped process causes *two* SIGSTOPs
|
|
||||||
// when trying to continue (kernel i386 2.6.24-23-ubuntu, gdb 6.8).
|
|
||||||
// Interestingly enough, on MacOSX no signal is delivered at all.
|
|
||||||
// 2) The explicit tbreak at the entry point we set to query the PID.
|
|
||||||
// Gdb <= 6.8 reports a frame but no reason, 6.8.50+ reports everything.
|
|
||||||
// The case of the user really setting a breakpoint at _start is simply
|
|
||||||
// unsupported.
|
|
||||||
if (!inferiorPid()) // For programs without -pthread under gdb <= 6.8.
|
|
||||||
postCommand("info proc", CB(handleInfoProc));
|
|
||||||
continueInferiorInternal();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// We are past the initial stop(s). No need to waste time on further checks.
|
|
||||||
m_entryPoint.clear();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// This was seen on XP after removing a breakpoint while running
|
// This was seen on XP after removing a breakpoint while running
|
||||||
// >945*stopped,reason="signal-received",signal-name="SIGTRAP",
|
// >945*stopped,reason="signal-received",signal-name="SIGTRAP",
|
||||||
|
|||||||
@@ -278,6 +278,7 @@ private: ////////// Gdb Output, State & Capability Handling //////////
|
|||||||
void handleResponse(const QByteArray &buff);
|
void handleResponse(const QByteArray &buff);
|
||||||
void handleStopResponse(const GdbMi &data);
|
void handleStopResponse(const GdbMi &data);
|
||||||
void handleResultRecord(GdbResponse *response);
|
void handleResultRecord(GdbResponse *response);
|
||||||
|
void handleStop0(const GdbMi &data);
|
||||||
void handleStop1(const GdbResponse &response);
|
void handleStop1(const GdbResponse &response);
|
||||||
void handleStop1(const GdbMi &data);
|
void handleStop1(const GdbMi &data);
|
||||||
StackFrame parseStackFrame(const GdbMi &mi, int level);
|
StackFrame parseStackFrame(const GdbMi &mi, int level);
|
||||||
|
|||||||
Reference in New Issue
Block a user