2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-05-05 12:49:08 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
|
|
|
|
** Contact: http://www.qt-project.org/legal
|
2010-05-05 12:49:08 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-05-05 12:49:08 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2010-05-05 12:49:08 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-05-05 12:49:08 +02:00
|
|
|
|
|
|
|
|
#include "localgdbprocess.h"
|
|
|
|
|
|
2012-02-21 16:12:25 +01:00
|
|
|
#include "procinterrupt.h"
|
|
|
|
|
#include "debuggerconstants.h"
|
2011-10-12 16:34:02 +02:00
|
|
|
|
2012-02-21 16:12:25 +01:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
#include <utils/winutils.h>
|
2011-10-12 16:34:02 +02:00
|
|
|
#endif
|
|
|
|
|
|
2012-02-21 16:12:25 +01:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
|
|
|
|
|
|
2010-05-05 12:49:08 +02:00
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
LocalGdbProcess::LocalGdbProcess(QObject *parent) : AbstractGdbProcess(parent)
|
|
|
|
|
{
|
|
|
|
|
connect(&m_gdbProc, SIGNAL(error(QProcess::ProcessError)),
|
|
|
|
|
this, SIGNAL(error(QProcess::ProcessError)));
|
|
|
|
|
connect(&m_gdbProc, SIGNAL(finished(int,QProcess::ExitStatus)),
|
|
|
|
|
this, SIGNAL(finished(int,QProcess::ExitStatus)));
|
|
|
|
|
connect(&m_gdbProc, SIGNAL(readyReadStandardOutput()),
|
|
|
|
|
this, SIGNAL(readyReadStandardOutput()));
|
|
|
|
|
connect(&m_gdbProc, SIGNAL(readyReadStandardError()),
|
|
|
|
|
this, SIGNAL(readyReadStandardError()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QByteArray LocalGdbProcess::readAllStandardOutput()
|
|
|
|
|
{
|
|
|
|
|
return m_gdbProc.readAllStandardOutput();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QByteArray LocalGdbProcess::readAllStandardError()
|
|
|
|
|
{
|
|
|
|
|
return m_gdbProc.readAllStandardError();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LocalGdbProcess::start(const QString &cmd, const QStringList &args)
|
|
|
|
|
{
|
|
|
|
|
m_gdbProc.start(cmd, args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool LocalGdbProcess::waitForStarted()
|
|
|
|
|
{
|
|
|
|
|
return m_gdbProc.waitForStarted();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qint64 LocalGdbProcess::write(const QByteArray &data)
|
|
|
|
|
{
|
|
|
|
|
return m_gdbProc.write(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LocalGdbProcess::kill()
|
|
|
|
|
{
|
|
|
|
|
m_gdbProc.kill();
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-12 16:34:02 +02:00
|
|
|
bool LocalGdbProcess::interrupt()
|
|
|
|
|
{
|
2012-02-21 16:12:25 +01:00
|
|
|
long pid;
|
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
|
pid = Utils::winQPidToPid(m_gdbProc.pid());
|
2011-10-12 16:34:02 +02:00
|
|
|
#else
|
2012-02-21 16:12:25 +01:00
|
|
|
pid = m_gdbProc.pid();
|
2011-10-12 16:34:02 +02:00
|
|
|
#endif
|
2012-02-21 16:12:25 +01:00
|
|
|
return interruptProcess(pid, GdbEngineType, &m_errorString);
|
2011-10-12 16:34:02 +02:00
|
|
|
}
|
|
|
|
|
|
2010-05-05 12:49:08 +02:00
|
|
|
QProcess::ProcessState LocalGdbProcess::state() const
|
|
|
|
|
{
|
|
|
|
|
return m_gdbProc.state();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString LocalGdbProcess::errorString() const
|
|
|
|
|
{
|
2011-10-12 16:34:02 +02:00
|
|
|
return m_errorString + m_gdbProc.errorString();
|
2010-05-05 12:49:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QProcessEnvironment LocalGdbProcess::processEnvironment() const
|
|
|
|
|
{
|
|
|
|
|
return m_gdbProc.processEnvironment();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LocalGdbProcess::setProcessEnvironment(const QProcessEnvironment &env)
|
|
|
|
|
{
|
|
|
|
|
m_gdbProc.setProcessEnvironment(env);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LocalGdbProcess::setEnvironment(const QStringList &env)
|
|
|
|
|
{
|
|
|
|
|
m_gdbProc.setEnvironment(env);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LocalGdbProcess::setWorkingDirectory(const QString &dir)
|
|
|
|
|
{
|
|
|
|
|
m_gdbProc.setWorkingDirectory(dir);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|