2009-09-09 17:24:21 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
|
|
|
|
** Commercial Usage
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
|
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
2009-09-11 15:53:08 +02:00
|
|
|
#ifndef DEBUGGER_ABSTRACT_GDB_ADAPTER
|
|
|
|
|
#define DEBUGGER_ABSTRACT_GDB_ADAPTER
|
2009-09-09 17:24:21 +02:00
|
|
|
|
|
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
#include <QtCore/QProcess>
|
|
|
|
|
|
2009-09-21 11:09:38 +02:00
|
|
|
#include "gdbengine.h"
|
|
|
|
|
|
2009-09-09 17:24:21 +02:00
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2009-09-11 15:53:08 +02:00
|
|
|
// AbstractGdbAdapter is inherited by PlainGdbAdapter used for local
|
|
|
|
|
// debugging and TrkGdbAdapter used for on-device debugging.
|
|
|
|
|
// In the PlainGdbAdapter case it's just a wrapper around a QProcess running
|
|
|
|
|
// gdb, in the TrkGdbAdapter case it's the interface to the gdb process in
|
2009-09-09 17:24:21 +02:00
|
|
|
// the whole rfomm/gdb/gdbserver combo.
|
2009-09-11 15:53:08 +02:00
|
|
|
class AbstractGdbAdapter : public QObject
|
2009-09-09 17:24:21 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2009-10-06 13:33:06 +02:00
|
|
|
AbstractGdbAdapter(GdbEngine *engine, QObject *parent = 0);
|
|
|
|
|
virtual ~AbstractGdbAdapter();
|
2009-09-09 17:24:21 +02:00
|
|
|
|
2009-10-06 13:33:06 +02:00
|
|
|
QByteArray readAllStandardOutput();
|
|
|
|
|
QByteArray readAllStandardError();
|
|
|
|
|
virtual void write(const QByteArray &data);
|
|
|
|
|
virtual bool isTrkAdapter() const; // isUtterlyBrokenAdapter
|
2009-09-09 17:24:21 +02:00
|
|
|
|
2009-09-23 10:14:53 +02:00
|
|
|
virtual void startAdapter() = 0;
|
2009-09-21 11:09:38 +02:00
|
|
|
virtual void startInferior() = 0;
|
2009-09-14 11:02:36 +02:00
|
|
|
virtual void interruptInferior() = 0;
|
2009-09-22 11:31:34 +02:00
|
|
|
virtual void shutdown() = 0;
|
2009-09-11 12:30:53 +02:00
|
|
|
|
2009-09-24 10:08:17 +02:00
|
|
|
virtual bool dumpersAvailable() const = 0;
|
2009-09-23 10:14:53 +02:00
|
|
|
|
2009-09-09 17:24:21 +02:00
|
|
|
signals:
|
2009-09-21 11:09:38 +02:00
|
|
|
void adapterStarted();
|
2009-10-08 11:43:26 +02:00
|
|
|
void adapterStartFailed(const QString &msg, const QString &settingsIdHint);
|
2009-09-21 11:09:38 +02:00
|
|
|
void adapterShutDown();
|
|
|
|
|
void adapterShutdownFailed(const QString &msg);
|
2009-09-25 11:06:51 +02:00
|
|
|
void adapterCrashed(const QString &msg);
|
2009-09-21 11:09:38 +02:00
|
|
|
|
|
|
|
|
void inferiorStartFailed(const QString &msg);
|
|
|
|
|
void inferiorShutDown();
|
|
|
|
|
void inferiorShutdownFailed(const QString &msg);
|
|
|
|
|
|
2009-09-09 17:24:21 +02:00
|
|
|
void readyReadStandardOutput();
|
|
|
|
|
void readyReadStandardError();
|
2009-09-14 11:02:36 +02:00
|
|
|
|
|
|
|
|
protected:
|
2009-10-06 13:33:06 +02:00
|
|
|
void commonInit();
|
2009-09-25 08:35:31 +02:00
|
|
|
DebuggerState state() const
|
2009-09-24 11:45:08 +02:00
|
|
|
{ return m_engine->state(); }
|
2009-09-25 08:35:31 +02:00
|
|
|
void setState(DebuggerState state)
|
|
|
|
|
{ m_engine->setState(state); }
|
2009-09-24 10:08:17 +02:00
|
|
|
const DebuggerStartParameters &startParameters() const
|
|
|
|
|
{ return m_engine->startParameters(); }
|
2009-09-24 11:16:00 +02:00
|
|
|
void debugMessage(const QString &msg) const
|
|
|
|
|
{ m_engine->debugMessage(msg); }
|
2009-09-29 10:15:52 +02:00
|
|
|
void showStatusMessage(const QString &msg) const
|
|
|
|
|
{ m_engine->showStatusMessage(msg); }
|
2009-09-21 17:35:19 +02:00
|
|
|
|
2009-10-12 12:33:12 +02:00
|
|
|
static QString msgGdbStopFailed(const QString &why);
|
|
|
|
|
static QString msgInferiorStopFailed(const QString &why);
|
|
|
|
|
static QString msgAttachedToStoppedInferior();
|
|
|
|
|
static QString msgInferiorStarted();
|
|
|
|
|
static QString msgInferiorRunning();
|
|
|
|
|
static QString msgConnectRemoteServerFailed(const QString &why);
|
|
|
|
|
|
2009-09-21 11:09:38 +02:00
|
|
|
GdbEngine * const m_engine;
|
2009-10-06 13:33:06 +02:00
|
|
|
|
|
|
|
|
QProcess m_gdbProc;
|
2009-09-09 17:24:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|
2009-09-11 15:53:08 +02:00
|
|
|
#endif // DEBUGGER_ABSTRACT_GDB_ADAPTER
|