forked from qt-creator/qt-creator
Debugger: Slim down CHECK_STATE() expansion
Less generated code. Change-Id: Iafcafc875afa3ead12e10fd5f316d9663b2f9823 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
This commit is contained in:
@@ -83,11 +83,6 @@ using namespace Debugger::Internal;
|
|||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
enum { debug = 0 };
|
|
||||||
|
|
||||||
#define SDEBUG(s) if (!debug) {} else qDebug() << s;
|
|
||||||
#define XSDEBUG(s) qDebug() << s
|
|
||||||
|
|
||||||
//#define WITH_BENCHMARK
|
//#define WITH_BENCHMARK
|
||||||
#ifdef WITH_BENCHMARK
|
#ifdef WITH_BENCHMARK
|
||||||
#include <valgrind/callgrind.h>
|
#include <valgrind/callgrind.h>
|
||||||
@@ -2015,6 +2010,19 @@ void DebuggerEngine::expandItem(const QByteArray &iname)
|
|||||||
updateItem(iname);
|
updateItem(iname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebuggerEngine::checkState(DebuggerState state, const char *file, int line)
|
||||||
|
{
|
||||||
|
const DebuggerState current = d->m_state;
|
||||||
|
if (current == state)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QString msg = QString::fromLatin1("UNEXPECTED STATE: %1 WANTED: %2 IN %3:%4")
|
||||||
|
.arg(current).arg(state).arg(QLatin1String(file)).arg(line);
|
||||||
|
|
||||||
|
showMessage(msg, LogError);
|
||||||
|
qDebug("%s", qPrintable(msg));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|
||||||
|
|||||||
@@ -442,6 +442,7 @@ protected:
|
|||||||
DebuggerState state);
|
DebuggerState state);
|
||||||
|
|
||||||
void updateLocalsView(const GdbMi &all);
|
void updateLocalsView(const GdbMi &all);
|
||||||
|
void checkState(DebuggerState state, const char *file, int line);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Wrapper engine needs access to state of its subengines.
|
// Wrapper engine needs access to state of its subengines.
|
||||||
|
|||||||
@@ -98,14 +98,7 @@ enum { debugPending = 0 };
|
|||||||
|
|
||||||
#define CB(callback) [this](const DebuggerResponse &r) { callback(r); }
|
#define CB(callback) [this](const DebuggerResponse &r) { callback(r); }
|
||||||
|
|
||||||
#define CHECK_STATE(s) \
|
#define CHECK_STATE(s) do { checkState(s, __FILE__, __LINE__); } while (0)
|
||||||
do { \
|
|
||||||
if (state() != s) { \
|
|
||||||
showMessage(QString::fromLatin1("UNEXPECTED STATE: %1 WANTED: %2 IN %3:%4") \
|
|
||||||
.arg(state()).arg(s).arg(QLatin1String(__FILE__)).arg(__LINE__), LogError); \
|
|
||||||
QTC_ASSERT(false, qDebug() << state() << s); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
QByteArray GdbEngine::tooltipIName(const QString &exp)
|
QByteArray GdbEngine::tooltipIName(const QString &exp)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,14 +51,7 @@ enum { debug = 0 };
|
|||||||
|
|
||||||
#define EDEBUG(s) do { if (debug) qDebug() << s; } while (0)
|
#define EDEBUG(s) do { if (debug) qDebug() << s; } while (0)
|
||||||
|
|
||||||
#define CHECK_STATE(s) \
|
#define CHECK_STATE(s) do { checkState(s, __FILE__, __LINE__); } while (0)
|
||||||
do { \
|
|
||||||
if (state() != s) { \
|
|
||||||
showMessage(QString::fromLatin1("UNEXPECTED STATE: %1 WANTED: %2 IN %3:%4") \
|
|
||||||
.arg(state()).arg(s).arg(QLatin1String(__FILE__)).arg(__LINE__), LogError); \
|
|
||||||
QTC_ASSERT(false, qDebug() << state() << s); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
DebuggerEngine *createQmlCppEngine(const DebuggerRunParameters &sp, QStringList *errors)
|
DebuggerEngine *createQmlCppEngine(const DebuggerRunParameters &sp, QStringList *errors)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user