forked from qt-creator/qt-creator
Debugger: Catch 'Remote connection closed' in response
'Remote connection closed' messages sometimes also arrive camuflaged as a response to a command (with the response of the original command already there). Change-Id: I8fa75f561fb341463fc4c0ed0a35aa6fd8300694 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -386,6 +386,26 @@ static bool isNameChar(char c)
|
|||||||
return (c >= 'a' && c <= 'z') || c == '-';
|
return (c >= 'a' && c <= 'z') || c == '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isGdbConnectionError(const QByteArray &message)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Handle messages gdb client produces when the target exits (gdbserver)
|
||||||
|
//
|
||||||
|
// we get this as response either to a specific command, e.g.
|
||||||
|
// 31^error,msg="Remote connection closed"
|
||||||
|
// or as informative output:
|
||||||
|
// &Remote connection closed
|
||||||
|
//
|
||||||
|
const QByteArray trimmed = message.trimmed();
|
||||||
|
if (trimmed == "Remote connection closed"
|
||||||
|
|| trimmed == "Remote communication error. "
|
||||||
|
"Target disconnected.: No error."
|
||||||
|
|| trimmed == "Quit") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void GdbEngine::handleResponse(const QByteArray &buff)
|
void GdbEngine::handleResponse(const QByteArray &buff)
|
||||||
{
|
{
|
||||||
showMessage(QString::fromLocal8Bit(buff, buff.length()), LogOutput);
|
showMessage(QString::fromLocal8Bit(buff, buff.length()), LogOutput);
|
||||||
@@ -668,12 +688,9 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
|||||||
if (data.startsWith("warning:"))
|
if (data.startsWith("warning:"))
|
||||||
showMessage(_(data.mid(9)), AppStuff); // Cut "warning: "
|
showMessage(_(data.mid(9)), AppStuff); // Cut "warning: "
|
||||||
|
|
||||||
// Messages when the target exits (gdbserver)
|
if (isGdbConnectionError(data)) {
|
||||||
if (data.trimmed() == "Remote connection closed"
|
|
||||||
|| data.trimmed() == "Remote communication error. "
|
|
||||||
"Target disconnected.: No error."
|
|
||||||
|| data.trimmed() == "Quit") {
|
|
||||||
notifyInferiorExited();
|
notifyInferiorExited();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// From SuSE's gdb: >&"Missing separate debuginfo for ...\n"
|
// From SuSE's gdb: >&"Missing separate debuginfo for ...\n"
|
||||||
@@ -1113,6 +1130,8 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
|
|||||||
QTC_CHECK(state() == InferiorRunOk);
|
QTC_CHECK(state() == InferiorRunOk);
|
||||||
notifyInferiorSpontaneousStop();
|
notifyInferiorSpontaneousStop();
|
||||||
notifyEngineIll();
|
notifyEngineIll();
|
||||||
|
} else if (isGdbConnectionError(msg)) {
|
||||||
|
notifyInferiorExited();
|
||||||
} else {
|
} else {
|
||||||
// Windows: Some DLL or some function not found. Report
|
// Windows: Some DLL or some function not found. Report
|
||||||
// the exception now in a box.
|
// the exception now in a box.
|
||||||
|
Reference in New Issue
Block a user