Commit 14f607e0 authored by hjk's avatar hjk

Debugger: Use DebuggerEngine::checkState also in core adapter

... instead of plain asserts. Less clutter on the user code side,
more information if it triggers.

Change-Id: I621e8adc168ceea64df6e39e0c95df4218f58d34
Reviewed-by: default avatarNiels Weber <niels.weber@theqtcompany.com>
parent d85979f2
...@@ -49,6 +49,7 @@ namespace Debugger { ...@@ -49,6 +49,7 @@ namespace Debugger {
namespace Internal { namespace Internal {
#define CB(callback) [this](const DebuggerResponse &r) { callback(r); } #define CB(callback) [this](const DebuggerResponse &r) { callback(r); }
#define CHECK_STATE(s) do { checkState(s, __FILE__, __LINE__); } while (0)
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// //
...@@ -207,7 +208,7 @@ void GdbCoreEngine::writeCoreChunk() ...@@ -207,7 +208,7 @@ void GdbCoreEngine::writeCoreChunk()
void GdbCoreEngine::setupInferior() void GdbCoreEngine::setupInferior()
{ {
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); CHECK_STATE(InferiorSetupRequested);
// Do that first, otherwise no symbols are loaded. // Do that first, otherwise no symbols are loaded.
QFileInfo fi(m_executable); QFileInfo fi(m_executable);
QByteArray path = fi.absoluteFilePath().toLocal8Bit(); QByteArray path = fi.absoluteFilePath().toLocal8Bit();
...@@ -217,7 +218,7 @@ void GdbCoreEngine::setupInferior() ...@@ -217,7 +218,7 @@ void GdbCoreEngine::setupInferior()
void GdbCoreEngine::handleFileExecAndSymbols(const DebuggerResponse &response) void GdbCoreEngine::handleFileExecAndSymbols(const DebuggerResponse &response)
{ {
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); CHECK_STATE(InferiorSetupRequested);
QString core = coreFileName(); QString core = coreFileName();
if (response.resultClass == ResultDone) { if (response.resultClass == ResultDone) {
showMessage(tr("Symbols found."), StatusBar); showMessage(tr("Symbols found."), StatusBar);
...@@ -234,13 +235,13 @@ void GdbCoreEngine::handleFileExecAndSymbols(const DebuggerResponse &response) ...@@ -234,13 +235,13 @@ void GdbCoreEngine::handleFileExecAndSymbols(const DebuggerResponse &response)
void GdbCoreEngine::runEngine() void GdbCoreEngine::runEngine()
{ {
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); CHECK_STATE(EngineRunRequested);
postCommand("target core " + coreFileName().toLocal8Bit(), NoFlags, CB(handleTargetCore)); postCommand("target core " + coreFileName().toLocal8Bit(), NoFlags, CB(handleTargetCore));
} }
void GdbCoreEngine::handleTargetCore(const DebuggerResponse &response) void GdbCoreEngine::handleTargetCore(const DebuggerResponse &response)
{ {
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); CHECK_STATE(EngineRunRequested);
notifyEngineRunOkAndInferiorUnrunnable(); notifyEngineRunOkAndInferiorUnrunnable();
if (response.resultClass == ResultDone) { if (response.resultClass == ResultDone) {
showMessage(tr("Attached to core."), StatusBar); showMessage(tr("Attached to core."), StatusBar);
...@@ -258,6 +259,7 @@ void GdbCoreEngine::handleTargetCore(const DebuggerResponse &response) ...@@ -258,6 +259,7 @@ void GdbCoreEngine::handleTargetCore(const DebuggerResponse &response)
void GdbCoreEngine::handleRoundTrip(const DebuggerResponse &response) void GdbCoreEngine::handleRoundTrip(const DebuggerResponse &response)
{ {
CHECK_STATE(InferiorUnrunnable);
Q_UNUSED(response); Q_UNUSED(response);
loadSymbolsForStack(); loadSymbolsForStack();
handleStop2(); handleStop2();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment