forked from qt-creator/qt-creator
Debugger: Add more information about the debugee when debugging
Fixes: QTCREATORBUG-25159 Change-Id: Ic462c8bb4d9f4f7163dbb9fcc13adce4c7172564 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
@@ -920,6 +920,11 @@ QString DebuggerEngine::stateName(int s)
|
|||||||
# undef SN
|
# undef SN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebuggerEngine::notifyExitCode(int code)
|
||||||
|
{
|
||||||
|
d->m_runParameters.exitCode = code;
|
||||||
|
}
|
||||||
|
|
||||||
void DebuggerEngine::showStatusMessage(const QString &msg, int timeout) const
|
void DebuggerEngine::showStatusMessage(const QString &msg, int timeout) const
|
||||||
{
|
{
|
||||||
showMessage(msg, StatusBar, timeout);
|
showMessage(msg, StatusBar, timeout);
|
||||||
|
@@ -197,6 +197,8 @@ public:
|
|||||||
|
|
||||||
Utils::MacroExpander *macroExpander = nullptr;
|
Utils::MacroExpander *macroExpander = nullptr;
|
||||||
|
|
||||||
|
Utils::optional<int> exitCode = {};
|
||||||
|
|
||||||
// For Debugger testing.
|
// For Debugger testing.
|
||||||
int testCase = 0;
|
int testCase = 0;
|
||||||
|
|
||||||
@@ -381,6 +383,7 @@ public:
|
|||||||
|
|
||||||
static QString stateName(int s);
|
static QString stateName(int s);
|
||||||
|
|
||||||
|
void notifyExitCode(int code);
|
||||||
void notifyInferiorPid(const Utils::ProcessHandle &pid);
|
void notifyInferiorPid(const Utils::ProcessHandle &pid);
|
||||||
qint64 inferiorPid() const;
|
qint64 inferiorPid() const;
|
||||||
|
|
||||||
|
@@ -738,7 +738,8 @@ void DebuggerRunTool::start()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
appendMessage(tr("Debugging starts"), NormalMessageFormat);
|
appendMessage(tr("Debugging %1 ...").arg(m_runParameters.inferior.commandLine().toUserOutput()),
|
||||||
|
NormalMessageFormat);
|
||||||
QString debuggerName = m_engine->objectName();
|
QString debuggerName = m_engine->objectName();
|
||||||
if (m_engine2)
|
if (m_engine2)
|
||||||
debuggerName += ' ' + m_engine2->objectName();
|
debuggerName += ' ' + m_engine2->objectName();
|
||||||
@@ -782,7 +783,12 @@ void DebuggerRunTool::handleEngineFinished(DebuggerEngine *engine)
|
|||||||
{
|
{
|
||||||
engine->prepareForRestart();
|
engine->prepareForRestart();
|
||||||
if (--d->engineStopsNeeded == 0) {
|
if (--d->engineStopsNeeded == 0) {
|
||||||
appendMessage(tr("Debugging has finished"), NormalMessageFormat);
|
QString cmd = m_runParameters.inferior.commandLine().toUserOutput();
|
||||||
|
QString msg = engine->runParameters().exitCode // Main engine.
|
||||||
|
? tr("Debugging of %1 has finished with exit code %2.")
|
||||||
|
.arg(cmd).arg(engine->runParameters().exitCode.value())
|
||||||
|
: tr("Debugging of %1 has finished.").arg(cmd);
|
||||||
|
appendMessage(msg, NormalMessageFormat);
|
||||||
reportStopped();
|
reportStopped();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1134,8 +1134,9 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
|
|||||||
// qDebug() << state());
|
// qDebug() << state());
|
||||||
QString msg;
|
QString msg;
|
||||||
if (reason == "exited") {
|
if (reason == "exited") {
|
||||||
msg = tr("Application exited with exit code %1")
|
const int exitCode = data["exit-code"].toInt();
|
||||||
.arg(data["exit-code"].toString());
|
notifyExitCode(exitCode);
|
||||||
|
msg = tr("Application exited with exit code %1").arg(exitCode);
|
||||||
} else if (reason == "exited-signalled" || reason == "signal-received") {
|
} else if (reason == "exited-signalled" || reason == "signal-received") {
|
||||||
msg = tr("Application exited after receiving signal %1")
|
msg = tr("Application exited after receiving signal %1")
|
||||||
.arg(data["signal-name"].toString());
|
.arg(data["signal-name"].toString());
|
||||||
@@ -1712,6 +1713,8 @@ void GdbEngine::handleThreadGroupExited(const GdbMi &result)
|
|||||||
{
|
{
|
||||||
QString groupId = result["id"].data();
|
QString groupId = result["id"].data();
|
||||||
if (threadsHandler()->notifyGroupExited(groupId)) {
|
if (threadsHandler()->notifyGroupExited(groupId)) {
|
||||||
|
const int exitCode = result["exit-code"].toInt();
|
||||||
|
notifyExitCode(exitCode);
|
||||||
if (m_rerunPending)
|
if (m_rerunPending)
|
||||||
m_rerunPending = false;
|
m_rerunPending = false;
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user