2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
**
|
2010-03-05 11:25:49 +01:00
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-06-17 00:01:27 +10:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Commercial Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** 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.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01: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.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** If you are unsure which license is appropriate for your use, please
|
2009-08-14 09:30:56 +02:00
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 15:08:31 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "debuggerrunner.h"
|
2010-06-11 17:03:15 +02:00
|
|
|
#include "debuggermanager.h"
|
2010-06-14 17:23:25 +02:00
|
|
|
#include "debuggeroutputwindow.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-15 09:13:22 +02:00
|
|
|
#include "idebuggerengine.h"
|
2010-06-15 11:42:49 +02:00
|
|
|
|
|
|
|
#include "breakhandler.h"
|
2010-06-15 09:13:22 +02:00
|
|
|
#include "moduleshandler.h"
|
2010-06-15 11:42:49 +02:00
|
|
|
#include "registerhandler.h"
|
|
|
|
#include "snapshothandler.h"
|
|
|
|
#include "stackhandler.h"
|
|
|
|
#include "stackframe.h"
|
|
|
|
#include "threadshandler.h"
|
|
|
|
#include "watchhandler.h"
|
2010-06-15 09:13:22 +02:00
|
|
|
|
2009-11-09 16:25:24 +01:00
|
|
|
#include <projectexplorer/debugginghelper.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <projectexplorer/environment.h>
|
|
|
|
#include <projectexplorer/project.h>
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2010-02-08 15:50:06 +01:00
|
|
|
#include <projectexplorer/target.h>
|
2009-11-25 18:50:20 +01:00
|
|
|
#include <projectexplorer/buildconfiguration.h>
|
2010-06-11 16:31:54 +02:00
|
|
|
#include <projectexplorer/applicationrunconfiguration.h> // For LocalApplication*
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2008-12-09 15:25:01 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2009-10-08 17:23:27 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2008-12-09 15:25:01 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <QtCore/QDebug>
|
|
|
|
#include <QtCore/QDir>
|
|
|
|
#include <QtCore/QFileInfo>
|
2008-12-09 15:25:01 +01:00
|
|
|
|
2010-06-15 09:13:22 +02:00
|
|
|
#include <QtGui/QAbstractItemView>
|
2008-12-03 10:55:18 +01:00
|
|
|
#include <QtGui/QTextDocument>
|
2010-06-15 11:42:49 +02:00
|
|
|
#include <QtGui/QTreeWidget>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-11 16:16:14 +02:00
|
|
|
using namespace ProjectExplorer;
|
2010-06-14 17:23:25 +02:00
|
|
|
using namespace Debugger::Internal;
|
|
|
|
|
2010-06-11 16:16:14 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2009-09-25 11:35:44 +02:00
|
|
|
// DebuggerRunControlFactory
|
2008-12-02 12:01:29 +01:00
|
|
|
//
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2010-06-15 08:22:02 +02:00
|
|
|
namespace Debugger {
|
|
|
|
|
2009-05-05 17:48:54 +02:00
|
|
|
// A factory to create DebuggerRunControls
|
2009-09-25 11:35:44 +02:00
|
|
|
DebuggerRunControlFactory::DebuggerRunControlFactory(DebuggerManager *manager)
|
2009-06-30 13:19:17 +02:00
|
|
|
: m_manager(manager)
|
2008-12-02 12:01:29 +01:00
|
|
|
{}
|
|
|
|
|
2009-10-08 18:37:18 +02:00
|
|
|
bool DebuggerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-06-09 16:13:47 +02:00
|
|
|
// return mode == ProjectExplorer::Constants::DEBUGMODE;
|
2009-05-25 16:22:11 +02:00
|
|
|
return mode == ProjectExplorer::Constants::DEBUGMODE
|
2009-10-08 18:37:18 +02:00
|
|
|
&& qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2009-09-25 11:35:44 +02:00
|
|
|
QString DebuggerRunControlFactory::displayName() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2009-02-27 20:06:08 +01:00
|
|
|
return tr("Debug");
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-06-14 08:57:15 +02:00
|
|
|
static DebuggerStartParameters localStartParameters(RunConfiguration *runConfiguration)
|
2009-07-28 09:10:35 +02:00
|
|
|
{
|
2010-06-14 08:57:15 +02:00
|
|
|
DebuggerStartParameters sp;
|
2010-06-11 16:06:13 +02:00
|
|
|
QTC_ASSERT(runConfiguration, return sp);
|
|
|
|
LocalApplicationRunConfiguration *rc =
|
|
|
|
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
|
|
|
|
QTC_ASSERT(rc, return sp);
|
|
|
|
|
2010-06-14 08:57:15 +02:00
|
|
|
sp.startMode = StartInternal;
|
|
|
|
sp.executable = rc->executable();
|
|
|
|
sp.environment = rc->environment().toStringList();
|
|
|
|
sp.workingDirectory = rc->workingDirectory();
|
|
|
|
sp.processArgs = rc->commandLineArguments();
|
|
|
|
sp.toolChainType = rc->toolChainType();
|
|
|
|
sp.useTerminal = rc->runMode() == LocalApplicationRunConfiguration::Console;
|
|
|
|
sp.dumperLibrary = rc->dumperLibrary();
|
|
|
|
sp.dumperLibraryLocations = rc->dumperLibraryLocations();
|
|
|
|
sp.displayName = rc->displayName();
|
2010-06-11 16:06:13 +02:00
|
|
|
|
2010-06-11 16:16:14 +02:00
|
|
|
// Find qtInstallPath.
|
|
|
|
QString qmakePath = DebuggingHelperLibrary::findSystemQt(rc->environment());
|
2010-06-11 16:06:13 +02:00
|
|
|
if (!qmakePath.isEmpty()) {
|
|
|
|
QProcess proc;
|
|
|
|
QStringList args;
|
|
|
|
args.append(QLatin1String("-query"));
|
|
|
|
args.append(QLatin1String("QT_INSTALL_HEADERS"));
|
|
|
|
proc.start(qmakePath, args);
|
|
|
|
proc.waitForFinished();
|
|
|
|
QByteArray ba = proc.readAllStandardOutput().trimmed();
|
|
|
|
QFileInfo fi(QString::fromLocal8Bit(ba) + "/..");
|
2010-06-14 08:57:15 +02:00
|
|
|
sp.qtInstallPath = fi.absoluteFilePath();
|
2010-06-11 16:06:13 +02:00
|
|
|
}
|
|
|
|
return sp;
|
2009-07-28 09:10:35 +02:00
|
|
|
}
|
|
|
|
|
2010-06-15 08:22:02 +02:00
|
|
|
RunControl *DebuggerRunControlFactory::create
|
|
|
|
(RunConfiguration *runConfiguration, const QString &mode)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2008-12-09 15:25:01 +01:00
|
|
|
QTC_ASSERT(mode == ProjectExplorer::Constants::DEBUGMODE, return 0);
|
2010-06-14 08:57:15 +02:00
|
|
|
DebuggerStartParameters sp = localStartParameters(runConfiguration);
|
2010-06-11 16:31:54 +02:00
|
|
|
return new DebuggerRunControl(m_manager, sp);
|
2010-06-11 16:06:13 +02:00
|
|
|
}
|
|
|
|
|
2010-06-14 08:57:15 +02:00
|
|
|
RunControl *DebuggerRunControlFactory::create(const DebuggerStartParameters &sp)
|
2010-06-11 16:06:13 +02:00
|
|
|
{
|
2010-06-11 16:31:54 +02:00
|
|
|
return new DebuggerRunControl(m_manager, sp);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-04-16 11:46:47 +02:00
|
|
|
QWidget *DebuggerRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
// NBS TODO: Add GDB-specific configuration widget
|
2009-07-13 17:35:17 +02:00
|
|
|
Q_UNUSED(runConfiguration)
|
2008-12-02 12:01:29 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-15 08:22:02 +02:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// DebuggerRunControl::Private
|
|
|
|
//
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class DebuggerRunControl::Private
|
|
|
|
{
|
|
|
|
public:
|
2010-06-15 09:13:22 +02:00
|
|
|
Private(DebuggerRunControl *parent, DebuggerManager *manager,
|
|
|
|
const DebuggerStartParameters &startParameters);
|
|
|
|
~Private();
|
2010-06-15 08:22:02 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
DebuggerRunControl *q;
|
|
|
|
|
|
|
|
DebuggerStartParameters m_startParameters;
|
|
|
|
DebuggerManager *m_manager;
|
2010-06-15 09:13:22 +02:00
|
|
|
Internal::IDebuggerEngine *m_engine;
|
2010-06-15 08:22:02 +02:00
|
|
|
bool m_running;
|
|
|
|
|
2010-06-15 09:13:22 +02:00
|
|
|
ModulesHandler *m_modulesHandler;
|
2010-06-15 11:42:49 +02:00
|
|
|
RegisterHandler *m_registerHandler;
|
2010-06-15 08:22:02 +02:00
|
|
|
/*
|
|
|
|
// FIXME: Move from DebuggerManager
|
|
|
|
BreakHandler *m_breakHandler;
|
|
|
|
SnapshotHandler *m_snapshotHandler;
|
|
|
|
StackHandler *m_stackHandler;
|
|
|
|
ThreadsHandler *m_threadsHandler;
|
|
|
|
WatchHandler *m_watchHandler;
|
|
|
|
*/
|
|
|
|
};
|
|
|
|
|
2010-06-15 09:13:22 +02:00
|
|
|
DebuggerRunControl::Private::Private(DebuggerRunControl *parent,
|
|
|
|
DebuggerManager *manager,
|
|
|
|
const DebuggerStartParameters &startParameters)
|
|
|
|
: q(parent),
|
|
|
|
m_startParameters(startParameters),
|
|
|
|
m_manager(manager),
|
|
|
|
m_engine(0)
|
2010-06-15 08:22:02 +02:00
|
|
|
{
|
2010-06-15 09:13:22 +02:00
|
|
|
m_running = false;
|
|
|
|
m_modulesHandler = new ModulesHandler(q);
|
2010-06-15 11:42:49 +02:00
|
|
|
m_registerHandler = new RegisterHandler();
|
2010-06-15 09:13:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
DebuggerRunControl::Private::~Private()
|
|
|
|
{
|
|
|
|
#define doDelete(ptr) delete ptr; ptr = 0
|
|
|
|
doDelete(m_modulesHandler);
|
2010-06-15 11:42:49 +02:00
|
|
|
doDelete(m_registerHandler);
|
2010-06-15 09:13:22 +02:00
|
|
|
#undef doDelete
|
2010-06-15 08:22:02 +02:00
|
|
|
}
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// DebuggerRunControl
|
|
|
|
//
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
|
2010-06-14 08:57:15 +02:00
|
|
|
const DebuggerStartParameters &startParameters)
|
2010-06-11 16:31:54 +02:00
|
|
|
: RunControl(0, ProjectExplorer::Constants::DEBUGMODE),
|
2010-06-15 09:13:22 +02:00
|
|
|
d(new Private(this, manager, startParameters))
|
2009-10-08 17:36:07 +02:00
|
|
|
{
|
2010-06-15 08:22:02 +02:00
|
|
|
connect(d->m_manager, SIGNAL(debuggingFinished()),
|
2010-06-11 16:31:54 +02:00
|
|
|
this, SLOT(debuggingFinished()),
|
|
|
|
Qt::QueuedConnection);
|
2010-06-15 08:22:02 +02:00
|
|
|
connect(d->m_manager, SIGNAL(messageAvailable(QString, bool)),
|
2010-06-11 16:31:54 +02:00
|
|
|
this, SLOT(slotMessageAvailable(QString, bool)));
|
2010-06-15 08:22:02 +02:00
|
|
|
connect(d->m_manager, SIGNAL(inferiorPidChanged(qint64)),
|
2010-06-11 16:31:54 +02:00
|
|
|
this, SLOT(bringApplicationToForeground(qint64)),
|
|
|
|
Qt::QueuedConnection);
|
|
|
|
connect(this, SIGNAL(stopRequested()),
|
2010-06-15 08:22:02 +02:00
|
|
|
d->m_manager, SLOT(exitDebugger()));
|
2009-10-08 17:36:07 +02:00
|
|
|
|
2010-06-15 08:22:02 +02:00
|
|
|
if (d->m_startParameters.environment.empty())
|
|
|
|
d->m_startParameters.environment = ProjectExplorer::Environment().toStringList();
|
|
|
|
d->m_startParameters.useTerminal = false;
|
2010-06-14 17:23:25 +02:00
|
|
|
|
2009-10-08 17:36:07 +02:00
|
|
|
}
|
|
|
|
|
2010-06-15 08:22:02 +02:00
|
|
|
DebuggerRunControl::~DebuggerRunControl()
|
|
|
|
{
|
|
|
|
delete d;
|
|
|
|
}
|
|
|
|
|
2010-06-07 16:40:33 +02:00
|
|
|
QString DebuggerRunControl::displayName() const
|
|
|
|
{
|
2010-06-15 08:22:02 +02:00
|
|
|
return d->m_startParameters.displayName;
|
2010-06-07 16:40:33 +02:00
|
|
|
}
|
|
|
|
|
2010-04-15 11:59:22 +02:00
|
|
|
void DebuggerRunControl::setCustomEnvironment(ProjectExplorer::Environment env)
|
|
|
|
{
|
2010-06-15 08:22:02 +02:00
|
|
|
d->m_startParameters.environment = env.toStringList();
|
2010-04-15 11:59:22 +02:00
|
|
|
}
|
|
|
|
|
2009-10-08 17:36:07 +02:00
|
|
|
void DebuggerRunControl::init()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-09-09 18:35:25 +02:00
|
|
|
void DebuggerRunControl::start()
|
|
|
|
{
|
2010-06-15 08:22:02 +02:00
|
|
|
d->m_running = true;
|
2009-10-08 17:23:27 +02:00
|
|
|
QString errorMessage;
|
|
|
|
QString settingsCategory;
|
|
|
|
QString settingsPage;
|
2010-06-15 08:22:02 +02:00
|
|
|
if (d->m_manager->checkDebugConfiguration(d->m_startParameters.toolChainType,
|
2010-06-14 17:23:25 +02:00
|
|
|
&errorMessage, &settingsCategory, &settingsPage)) {
|
2010-06-15 08:22:02 +02:00
|
|
|
d->m_manager->startNewDebugger(this);
|
2010-04-14 17:32:01 +02:00
|
|
|
emit started();
|
2009-10-08 17:23:27 +02:00
|
|
|
} else {
|
2010-04-19 14:21:33 +02:00
|
|
|
appendMessage(this, errorMessage, true);
|
2009-10-08 17:23:27 +02:00
|
|
|
emit finished();
|
2010-06-14 17:23:25 +02:00
|
|
|
Core::ICore::instance()->showWarningWithOptions(tr("Debugger"),
|
|
|
|
errorMessage, QString(), settingsCategory, settingsPage);
|
2009-10-08 17:23:27 +02:00
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
2010-06-14 18:19:02 +02:00
|
|
|
void DebuggerRunControl::showMessage(const QString &msg, int channel,
|
|
|
|
int timeout)
|
2009-05-25 16:22:11 +02:00
|
|
|
{
|
2010-06-15 08:22:02 +02:00
|
|
|
if (!d->m_manager)
|
2010-06-14 19:09:18 +02:00
|
|
|
return;
|
2010-06-15 08:22:02 +02:00
|
|
|
DebuggerOutputWindow *ow = d->m_manager->debuggerOutputWindow();
|
2010-06-14 18:19:02 +02:00
|
|
|
QTC_ASSERT(ow, return);
|
|
|
|
switch (channel) {
|
|
|
|
case StatusBar:
|
2010-06-15 08:22:02 +02:00
|
|
|
d->m_manager->showStatusMessage(msg, timeout);
|
2010-06-14 18:19:02 +02:00
|
|
|
ow->showOutput(LogStatus, msg);
|
|
|
|
break;
|
|
|
|
case AppOutput:
|
|
|
|
emit addToOutputWindowInline(this, msg, false);
|
|
|
|
break;
|
|
|
|
case AppError:
|
|
|
|
emit addToOutputWindowInline(this, msg, true);
|
|
|
|
break;
|
|
|
|
case LogMiscInput:
|
|
|
|
ow->showInput(LogMisc, msg);
|
|
|
|
ow->showOutput(LogMisc, msg);
|
|
|
|
break;
|
|
|
|
case LogInput:
|
|
|
|
ow->showInput(channel, msg);
|
|
|
|
ow->showOutput(channel, msg);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ow->showOutput(channel, msg);
|
|
|
|
break;
|
|
|
|
}
|
2010-04-19 14:21:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void DebuggerRunControl::slotMessageAvailable(const QString &data, bool isError)
|
|
|
|
{
|
|
|
|
emit appendMessage(this, data, isError);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void DebuggerRunControl::stop()
|
|
|
|
{
|
2010-06-15 08:22:02 +02:00
|
|
|
d->m_running = false;
|
2009-02-16 13:29:57 +01:00
|
|
|
emit stopRequested();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void DebuggerRunControl::debuggingFinished()
|
|
|
|
{
|
2010-06-15 08:22:02 +02:00
|
|
|
d->m_running = false;
|
2008-12-02 12:01:29 +01:00
|
|
|
emit finished();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DebuggerRunControl::isRunning() const
|
|
|
|
{
|
2010-06-15 08:22:02 +02:00
|
|
|
return d->m_running;
|
|
|
|
}
|
|
|
|
|
|
|
|
const DebuggerStartParameters &DebuggerRunControl::sp() const
|
|
|
|
{
|
|
|
|
return d->m_startParameters;
|
|
|
|
}
|
|
|
|
|
|
|
|
ModulesHandler *DebuggerRunControl::modulesHandler() const
|
|
|
|
{
|
2010-06-15 09:13:22 +02:00
|
|
|
return d->m_modulesHandler;
|
2010-06-15 08:22:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
BreakHandler *DebuggerRunControl::breakHandler() const
|
|
|
|
{
|
|
|
|
return d->m_manager->breakHandler();
|
|
|
|
}
|
|
|
|
|
|
|
|
RegisterHandler *DebuggerRunControl::registerHandler() const
|
|
|
|
{
|
2010-06-15 11:42:49 +02:00
|
|
|
return d->m_registerHandler;
|
2010-06-15 08:22:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
StackHandler *DebuggerRunControl::stackHandler() const
|
|
|
|
{
|
|
|
|
return d->m_manager->stackHandler();
|
|
|
|
}
|
|
|
|
|
|
|
|
ThreadsHandler *DebuggerRunControl::threadsHandler() const
|
|
|
|
{
|
|
|
|
return d->m_manager->threadsHandler();
|
|
|
|
}
|
|
|
|
|
|
|
|
WatchHandler *DebuggerRunControl::watchHandler() const
|
|
|
|
{
|
|
|
|
return d->m_manager->watchHandler();
|
|
|
|
}
|
|
|
|
|
|
|
|
SnapshotHandler *DebuggerRunControl::snapshotHandler() const
|
|
|
|
{
|
|
|
|
return d->m_manager->snapshotHandler();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2009-09-11 08:55:16 +02:00
|
|
|
|
2010-06-15 09:13:22 +02:00
|
|
|
void DebuggerRunControl::cleanup()
|
|
|
|
{
|
|
|
|
modulesHandler()->removeAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
Internal::IDebuggerEngine *DebuggerRunControl::engine()
|
|
|
|
{
|
|
|
|
QTC_ASSERT(d->m_engine, /**/);
|
|
|
|
return d->m_engine;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DebuggerRunControl::startDebugger(IDebuggerEngine *engine)
|
|
|
|
{
|
|
|
|
d->m_engine = engine;
|
|
|
|
d->m_engine->setRunControl(this);
|
|
|
|
d->m_manager->modulesWindow()->setModel(d->m_modulesHandler->model());
|
2010-06-15 11:42:49 +02:00
|
|
|
d->m_manager->registerWindow()->setModel(d->m_registerHandler->model());
|
2010-06-15 09:13:22 +02:00
|
|
|
d->m_engine->startDebugger();
|
|
|
|
}
|
|
|
|
|
2010-06-15 11:42:49 +02:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// AbstractDebuggerEngine
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/*
|
|
|
|
void IDebuggerEngine::showStatusMessage(const QString &msg, int timeout)
|
|
|
|
{
|
|
|
|
m_manager->showStatusMessage(msg, timeout);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
DebuggerState IDebuggerEngine::state() const
|
|
|
|
{
|
|
|
|
return m_manager->state();
|
|
|
|
}
|
|
|
|
|
|
|
|
void IDebuggerEngine::setState(DebuggerState state, bool forced)
|
|
|
|
{
|
|
|
|
m_manager->setState(state, forced);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IDebuggerEngine::debuggerActionsEnabled() const
|
|
|
|
{
|
|
|
|
return m_manager->debuggerActionsEnabled();
|
|
|
|
}
|
|
|
|
|
|
|
|
void IDebuggerEngine::showModuleSymbols
|
|
|
|
(const QString &moduleName, const Symbols &symbols)
|
|
|
|
{
|
|
|
|
QTreeWidget *w = new QTreeWidget;
|
|
|
|
w->setColumnCount(3);
|
|
|
|
w->setRootIsDecorated(false);
|
|
|
|
w->setAlternatingRowColors(true);
|
|
|
|
w->setSortingEnabled(true);
|
|
|
|
w->setHeaderLabels(QStringList() << tr("Symbol") << tr("Address") << tr("Code"));
|
|
|
|
w->setWindowTitle(tr("Symbols in \"%1\"").arg(moduleName));
|
|
|
|
foreach (const Symbol &s, symbols) {
|
|
|
|
QTreeWidgetItem *it = new QTreeWidgetItem;
|
|
|
|
it->setData(0, Qt::DisplayRole, s.name);
|
|
|
|
it->setData(1, Qt::DisplayRole, s.address);
|
|
|
|
it->setData(2, Qt::DisplayRole, s.state);
|
|
|
|
w->addTopLevelItem(it);
|
|
|
|
}
|
|
|
|
manager()->createNewDock(w);
|
|
|
|
}
|
|
|
|
|
|
|
|
ModulesHandler *IDebuggerEngine::modulesHandler() const
|
|
|
|
{
|
|
|
|
return runControl()->modulesHandler();
|
|
|
|
}
|
|
|
|
|
|
|
|
BreakHandler *IDebuggerEngine::breakHandler() const
|
|
|
|
{
|
|
|
|
return runControl()->breakHandler();
|
|
|
|
}
|
|
|
|
|
|
|
|
RegisterHandler *IDebuggerEngine::registerHandler() const
|
|
|
|
{
|
|
|
|
return runControl()->registerHandler();
|
|
|
|
}
|
|
|
|
|
|
|
|
StackHandler *IDebuggerEngine::stackHandler() const
|
|
|
|
{
|
|
|
|
return runControl()->stackHandler();
|
|
|
|
}
|
|
|
|
|
|
|
|
ThreadsHandler *IDebuggerEngine::threadsHandler() const
|
|
|
|
{
|
|
|
|
return runControl()->threadsHandler();
|
|
|
|
}
|
|
|
|
|
|
|
|
WatchHandler *IDebuggerEngine::watchHandler() const
|
|
|
|
{
|
|
|
|
return runControl()->watchHandler();
|
|
|
|
}
|
|
|
|
|
|
|
|
SnapshotHandler *IDebuggerEngine::snapshotHandler() const
|
|
|
|
{
|
|
|
|
return runControl()->snapshotHandler();
|
|
|
|
}
|
|
|
|
|
2009-09-11 08:55:16 +02:00
|
|
|
} // namespace Debugger
|