Commit 41caca27 authored by hjk's avatar hjk

debugger: reorganize trk startup

parent efb02a30
......@@ -83,12 +83,12 @@
#endif
#include <ctype.h>
// FIXME: temporary hack to evalute tbreak based step-over behaviour
static QString lastFile;
static int lastLine;
namespace Debugger {
namespace Internal {
using namespace Debugger::Constants;
//#define DEBUG_PENDING 1
//#define DEBUG_SUBITEM 1
......@@ -103,6 +103,18 @@ using namespace Debugger::Constants;
#define STRINGIFY(x) STRINGIFY_INTERNAL(x)
#define CB(callback) &GdbEngine::callback, STRINGIFY(callback)
static bool stateAcceptsGdbCommands(GdbAdapterState state)
{
return state == AdapterStarted
|| state == InferiorPreparing
|| state == InferiorPrepared
|| state == InferiorStarting
|| state == InferiorStarted
|| state == InferiorShuttingDown
|| state == InferiorShutDown
|| state == AdapterShuttingDown;
};
static int &currentToken()
{
static int token = 0;
......@@ -729,7 +741,8 @@ void GdbEngine::postCommand(const QString &command, GdbCommandFlags flags,
void GdbEngine::postCommandHelper(const GdbCommand &cmd)
{
if (m_gdbAdapter->state() == AdapterNotRunning) {
if (!stateAcceptsGdbCommands(m_gdbAdapter->state())) {
PENDING_DEBUG(_("NO GDB PROCESS RUNNING, CMD IGNORED: ") + cmd.command);
debugMessage(_("NO GDB PROCESS RUNNING, CMD IGNORED: ") + cmd.command);
return;
}
......@@ -737,10 +750,12 @@ void GdbEngine::postCommandHelper(const GdbCommand &cmd)
if (cmd.flags & RebuildModel) {
++m_pendingRequests;
PENDING_DEBUG(" CALLBACK" << cmd.callbackName
<< "INCREMENTS PENDING TO:" << m_pendingRequests << cmd.command);
<< "INCREMENTS PENDING TO:" << m_pendingRequests << cmd.command
<< m_gdbAdapter->state());
} else {
PENDING_DEBUG(" UNKNOWN CALLBACK" << cmd.callbackName
<< "LEAVES PENDING AT:" << m_pendingRequests << cmd.command);
<< "LEAVES PENDING AT:" << m_pendingRequests << cmd.command
<< m_gdbAdapter->state());
}
if ((cmd.flags & NeedsStop) && status() != DebuggerInferiorStopped
......
This diff is collapsed.
......@@ -101,6 +101,7 @@ private:
QProcess m_rfcommProc;
bool m_running;
DebuggerStartParametersPtr m_startParameters;
void debugMessage(const QString &msg) { m_engine->debugMessage(msg); }
public:
//
......@@ -110,8 +111,6 @@ public:
QIODevice::OpenMode mode = QIODevice::ReadWrite);
void kill();
void terminate();
bool waitForFinished(int msecs = 30000);
GdbAdapterState state() const;
QString errorString() const;
QByteArray readAllStandardError();
QByteArray readAllStandardOutput();
......@@ -121,7 +120,7 @@ public:
bool isAdapter() const { return true; }
//void attach();
void interruptInferior();
void startInferiorEarly();
Q_SLOT void startInferiorEarly();
void startAdapter(const DebuggerStartParametersPtr &sp);
void prepareInferior();
......@@ -129,6 +128,11 @@ public:
void shutdownInferior();
void shutdownAdapter();
void handleKill(const GdbResultRecord &, const QVariant &);
void handleExit(const GdbResultRecord &, const QVariant &);
void handleTargetRemote(const GdbResultRecord &, const QVariant &);
void handleFirstContinue(const GdbResultRecord &, const QVariant &);
//
// TRK
//
......
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