2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01: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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 15:08:31 +01:00
|
|
|
|
2014-10-17 13:40:04 +02:00
|
|
|
#include "debuggerruncontrol.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
#include "analyzer/analyzermanager.h"
|
2010-06-16 11:08:54 +02:00
|
|
|
#include "debuggeractions.h"
|
2010-11-10 11:39:01 +01:00
|
|
|
#include "debuggercore.h"
|
2013-03-22 10:28:49 +01:00
|
|
|
#include "debuggerengine.h"
|
|
|
|
#include "debuggerkitinformation.h"
|
2010-06-16 11:08:54 +02:00
|
|
|
#include "debuggerplugin.h"
|
2013-03-27 13:03:15 +01:00
|
|
|
#include "debuggerrunconfigurationaspect.h"
|
2011-01-10 10:14:23 +01:00
|
|
|
#include "debuggerstartparameters.h"
|
2013-03-22 10:28:49 +01:00
|
|
|
#include "debuggerstringutils.h"
|
|
|
|
#include "breakhandler.h"
|
2014-02-19 15:35:58 +01:00
|
|
|
#include "shared/peutils.h"
|
2010-06-22 12:28:05 +02:00
|
|
|
|
2012-08-15 13:21:37 +02:00
|
|
|
#include <projectexplorer/buildconfiguration.h>
|
2014-10-20 14:03:47 +02:00
|
|
|
#include <projectexplorer/devicesupport/deviceprocessesdialog.h>
|
|
|
|
#include <projectexplorer/devicesupport/deviceprocesslist.h>
|
|
|
|
#include <projectexplorer/environmentaspect.h> // For the environment
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <projectexplorer/project.h>
|
2012-08-15 13:21:37 +02:00
|
|
|
#include <projectexplorer/projectexplorer.h>
|
2016-01-25 15:00:20 +01:00
|
|
|
#include <projectexplorer/runnables.h>
|
2010-02-08 15:50:06 +01:00
|
|
|
#include <projectexplorer/target.h>
|
2012-11-02 16:14:43 +01:00
|
|
|
#include <projectexplorer/taskhub.h>
|
2014-10-20 14:03:47 +02:00
|
|
|
#include <projectexplorer/toolchain.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-09-13 16:12:04 +02:00
|
|
|
#include <utils/checkablemessagebox.h>
|
2013-10-23 22:07:46 +03:00
|
|
|
#include <utils/fileutils.h>
|
2008-12-09 15:25:01 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2010-12-15 13:06:39 +01:00
|
|
|
#include <utils/qtcprocess.h>
|
2009-10-08 17:23:27 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2015-10-19 12:55:13 +02:00
|
|
|
#include <coreplugin/coreconstants.h>
|
2015-11-23 16:41:54 +01:00
|
|
|
#include <coreplugin/coreicons.h>
|
2015-08-10 17:43:58 +02:00
|
|
|
#include <qmldebug/qmldebugcommandlinearguments.h>
|
2008-12-09 15:25:01 +01:00
|
|
|
|
2015-10-08 16:19:57 +02:00
|
|
|
#include <qtsupport/qtkitinformation.h>
|
|
|
|
|
2013-04-17 17:45:53 +02:00
|
|
|
#include <QTcpServer>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-14 17:23:25 +02:00
|
|
|
using namespace Debugger::Internal;
|
2012-08-09 03:58:37 +02:00
|
|
|
using namespace ProjectExplorer;
|
|
|
|
using namespace Utils;
|
2010-06-14 17:23:25 +02:00
|
|
|
|
2011-02-25 09:34:31 +01:00
|
|
|
enum { debug = 0 };
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
namespace Debugger {
|
2011-01-11 11:06:15 +01:00
|
|
|
namespace Internal {
|
2011-01-12 12:10:12 +01:00
|
|
|
|
2015-06-24 08:26:35 +02:00
|
|
|
DebuggerEngine *createCdbEngine(const DebuggerRunParameters &rp, QStringList *error);
|
2015-06-29 10:36:29 +03:00
|
|
|
const auto *DebugRunMode = ProjectExplorer::Constants::DEBUG_RUN_MODE;
|
|
|
|
const auto *DebugRunModeWithBreakOnMain = ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN;
|
|
|
|
|
2015-06-04 10:31:27 +02:00
|
|
|
DebuggerEngine *createGdbEngine(const DebuggerRunParameters &rp);
|
|
|
|
DebuggerEngine *createPdbEngine(const DebuggerRunParameters &rp);
|
|
|
|
DebuggerEngine *createQmlEngine(const DebuggerRunParameters &rp);
|
2015-06-24 08:26:35 +02:00
|
|
|
DebuggerEngine *createQmlCppEngine(const DebuggerRunParameters &rp, QStringList *error);
|
2015-06-04 10:31:27 +02:00
|
|
|
DebuggerEngine *createLldbEngine(const DebuggerRunParameters &rp);
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2014-10-17 12:37:30 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
2015-06-24 08:26:35 +02:00
|
|
|
|
2011-02-24 16:50:15 +01:00
|
|
|
static const char *engineTypeName(DebuggerEngineType et)
|
|
|
|
{
|
|
|
|
switch (et) {
|
|
|
|
case Debugger::NoEngineType:
|
|
|
|
break;
|
|
|
|
case Debugger::GdbEngineType:
|
2011-03-14 17:34:27 +01:00
|
|
|
return "Gdb engine";
|
2011-02-24 16:50:15 +01:00
|
|
|
case Debugger::CdbEngineType:
|
|
|
|
return "Cdb engine";
|
|
|
|
case Debugger::PdbEngineType:
|
2011-03-14 17:34:27 +01:00
|
|
|
return "Pdb engine";
|
2011-02-24 16:50:15 +01:00
|
|
|
case Debugger::QmlEngineType:
|
|
|
|
return "QML engine";
|
|
|
|
case Debugger::QmlCppEngineType:
|
|
|
|
return "QML C++ engine";
|
|
|
|
case Debugger::LldbEngineType:
|
2013-03-22 10:28:49 +01:00
|
|
|
return "LLDB command line engine";
|
2011-02-24 16:50:15 +01:00
|
|
|
case Debugger::AllEngineTypes:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return "No engine";
|
|
|
|
}
|
|
|
|
|
2015-04-22 16:11:00 +02:00
|
|
|
DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfig, DebuggerEngine *engine)
|
|
|
|
: RunControl(runConfig, DebugRunMode),
|
2014-10-17 12:37:30 +02:00
|
|
|
m_engine(engine),
|
|
|
|
m_running(false)
|
2009-09-09 18:35:25 +02:00
|
|
|
{
|
2015-11-23 16:41:54 +01:00
|
|
|
setIcon(Core::Icons::DEBUG_START_SMALL);
|
2014-10-17 12:37:30 +02:00
|
|
|
connect(this, &RunControl::finished, this, &DebuggerRunControl::handleFinished);
|
2014-12-12 15:33:16 +01:00
|
|
|
|
|
|
|
connect(engine, &DebuggerEngine::requestRemoteSetup,
|
|
|
|
this, &DebuggerRunControl::requestRemoteSetup);
|
|
|
|
connect(engine, &DebuggerEngine::stateChanged,
|
|
|
|
this, &DebuggerRunControl::stateChanged);
|
|
|
|
connect(engine, &DebuggerEngine::aboutToNotifyInferiorSetupOk,
|
|
|
|
this, &DebuggerRunControl::aboutToNotifyInferiorSetupOk);
|
2010-04-19 14:21:33 +02:00
|
|
|
}
|
|
|
|
|
2010-12-03 16:18:50 +01:00
|
|
|
DebuggerRunControl::~DebuggerRunControl()
|
|
|
|
{
|
|
|
|
disconnect();
|
2014-10-17 12:37:30 +02:00
|
|
|
if (m_engine) {
|
|
|
|
DebuggerEngine *engine = m_engine;
|
|
|
|
m_engine = 0;
|
2010-12-03 16:18:50 +01:00
|
|
|
engine->disconnect();
|
|
|
|
delete engine;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
QString DebuggerRunControl::displayName() const
|
2010-06-15 08:22:02 +02:00
|
|
|
{
|
2014-10-17 12:37:30 +02:00
|
|
|
QTC_ASSERT(m_engine, return QString());
|
2015-05-27 13:59:56 +02:00
|
|
|
return m_engine->runParameters().displayName;
|
2010-06-15 08:22:02 +02:00
|
|
|
}
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerRunControl::start()
|
2010-06-15 09:13:22 +02:00
|
|
|
{
|
2016-03-17 10:11:38 +01:00
|
|
|
Debugger::Internal::saveModeToRestore();
|
2016-03-02 13:57:37 +01:00
|
|
|
Debugger::selectPerspective(Debugger::Constants::CppPerspectiveId);
|
2015-06-24 08:26:35 +02:00
|
|
|
TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO);
|
|
|
|
TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME);
|
|
|
|
|
2014-10-17 12:37:30 +02:00
|
|
|
QTC_ASSERT(m_engine, return);
|
2011-04-18 13:01:12 +02:00
|
|
|
// User canceled input dialog asking for executable when working on library project.
|
2015-05-27 13:59:56 +02:00
|
|
|
if (m_engine->runParameters().startMode == StartInternal
|
2016-01-28 10:31:24 +01:00
|
|
|
&& m_engine->runParameters().inferior.executable.isEmpty()
|
2015-07-23 11:23:52 +02:00
|
|
|
&& m_engine->runParameters().interpreter.isEmpty()) {
|
2013-10-17 13:48:04 +02:00
|
|
|
appendMessage(tr("No executable specified.") + QLatin1Char('\n'), ErrorMessageFormat);
|
2011-04-18 13:01:12 +02:00
|
|
|
emit started();
|
|
|
|
emit finished();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-05-27 13:59:56 +02:00
|
|
|
if (m_engine->runParameters().startMode == StartInternal) {
|
2014-03-17 18:27:26 +01:00
|
|
|
QStringList unhandledIds;
|
2015-01-10 01:07:01 +01:00
|
|
|
foreach (Breakpoint bp, breakHandler()->allBreakpoints()) {
|
|
|
|
if (bp.isEnabled() && !m_engine->acceptsBreakpoint(bp))
|
|
|
|
unhandledIds.append(bp.id().toString());
|
2014-03-17 18:27:26 +01:00
|
|
|
}
|
|
|
|
if (!unhandledIds.isEmpty()) {
|
|
|
|
QString warningMessage =
|
|
|
|
DebuggerPlugin::tr("Some breakpoints cannot be handled by the debugger "
|
|
|
|
"languages currently active, and will be ignored.\n"
|
|
|
|
"Affected are breakpoints %1")
|
|
|
|
.arg(unhandledIds.join(QLatin1String(", ")));
|
2011-08-08 15:38:05 +02:00
|
|
|
|
2014-10-22 13:04:47 +02:00
|
|
|
Internal::showMessage(warningMessage, LogWarning);
|
2011-08-08 15:38:05 +02:00
|
|
|
|
2014-03-17 18:27:26 +01:00
|
|
|
static bool checked = true;
|
|
|
|
if (checked)
|
2013-10-16 17:11:39 +02:00
|
|
|
CheckableMessageBox::information(Core::ICore::mainWindow(),
|
2013-09-13 16:12:04 +02:00
|
|
|
tr("Debugger"),
|
|
|
|
warningMessage,
|
|
|
|
tr("&Show this message again."),
|
|
|
|
&checked, QDialogButtonBox::Ok);
|
2011-04-28 14:05:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-22 13:04:47 +02:00
|
|
|
Internal::runControlStarted(m_engine);
|
2010-08-27 16:22:51 +02:00
|
|
|
|
2010-09-29 10:32:41 +02:00
|
|
|
// We might get a synchronous startFailed() notification on Windows,
|
|
|
|
// when launching the process fails. Emit a proper finished() sequence.
|
2010-06-16 11:08:54 +02:00
|
|
|
emit started();
|
2014-10-17 12:37:30 +02:00
|
|
|
m_running = true;
|
2010-09-29 10:32:41 +02:00
|
|
|
|
2014-10-17 12:37:30 +02:00
|
|
|
m_engine->startDebugger(this);
|
2010-09-29 10:32:41 +02:00
|
|
|
|
2014-10-17 12:37:30 +02:00
|
|
|
if (m_running)
|
2013-10-17 13:48:04 +02:00
|
|
|
appendMessage(tr("Debugging starts") + QLatin1Char('\n'), NormalMessageFormat);
|
2010-06-15 11:42:49 +02:00
|
|
|
}
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerRunControl::startFailed()
|
2010-06-15 11:42:49 +02:00
|
|
|
{
|
2013-10-17 13:48:04 +02:00
|
|
|
appendMessage(tr("Debugging has failed") + QLatin1Char('\n'), NormalMessageFormat);
|
2014-10-17 12:37:30 +02:00
|
|
|
m_running = false;
|
2010-06-16 11:08:54 +02:00
|
|
|
emit finished();
|
2014-10-17 12:37:30 +02:00
|
|
|
m_engine->handleStartFailed();
|
2010-06-15 11:42:49 +02:00
|
|
|
}
|
|
|
|
|
2014-12-12 15:33:16 +01:00
|
|
|
void DebuggerRunControl::notifyEngineRemoteServerRunning(const QByteArray &msg, int pid)
|
|
|
|
{
|
|
|
|
m_engine->notifyEngineRemoteServerRunning(msg, pid);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DebuggerRunControl::notifyEngineRemoteSetupFinished(const RemoteSetupResult &result)
|
|
|
|
{
|
|
|
|
m_engine->notifyEngineRemoteSetupFinished(result);
|
|
|
|
}
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerRunControl::handleFinished()
|
2010-06-15 11:42:49 +02:00
|
|
|
{
|
2013-10-17 13:48:04 +02:00
|
|
|
appendMessage(tr("Debugging has finished") + QLatin1Char('\n'), NormalMessageFormat);
|
2014-10-17 12:37:30 +02:00
|
|
|
if (m_engine)
|
|
|
|
m_engine->handleFinished();
|
2014-10-22 13:04:47 +02:00
|
|
|
Internal::runControlFinished(m_engine);
|
2010-06-15 11:42:49 +02:00
|
|
|
}
|
|
|
|
|
2011-01-17 13:52:14 +01:00
|
|
|
bool DebuggerRunControl::promptToStop(bool *optionalPrompt) const
|
2010-06-15 11:42:49 +02:00
|
|
|
{
|
2012-04-17 08:01:25 +02:00
|
|
|
QTC_ASSERT(isRunning(), return true);
|
2010-08-20 14:19:25 +02:00
|
|
|
|
2011-01-17 13:52:14 +01:00
|
|
|
if (optionalPrompt && !*optionalPrompt)
|
|
|
|
return true;
|
|
|
|
|
2010-09-29 12:48:00 +02:00
|
|
|
const QString question = tr("A debugging session is still in progress. "
|
2010-08-20 14:19:25 +02:00
|
|
|
"Terminating the session in the current"
|
|
|
|
" state can leave the target in an inconsistent state."
|
|
|
|
" Would you still like to terminate it?");
|
2011-01-17 13:52:14 +01:00
|
|
|
return showPromptToStopDialog(tr("Close Debugging Session"), question,
|
|
|
|
QString(), QString(), optionalPrompt);
|
2010-08-20 14:19:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
RunControl::StopResult DebuggerRunControl::stop()
|
|
|
|
{
|
2014-10-17 12:37:30 +02:00
|
|
|
QTC_ASSERT(m_engine, return StoppedSynchronously);
|
|
|
|
m_engine->quitDebugger();
|
2010-08-20 14:19:25 +02:00
|
|
|
return AsynchronousStop;
|
2010-06-15 11:42:49 +02:00
|
|
|
}
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void DebuggerRunControl::debuggingFinished()
|
2010-06-15 11:42:49 +02:00
|
|
|
{
|
2014-10-17 12:37:30 +02:00
|
|
|
m_running = false;
|
2010-06-16 11:08:54 +02:00
|
|
|
emit finished();
|
2010-06-15 11:42:49 +02:00
|
|
|
}
|
|
|
|
|
2014-12-12 15:33:16 +01:00
|
|
|
void DebuggerRunControl::showMessage(const QString &msg, int channel)
|
|
|
|
{
|
|
|
|
m_engine->showMessage(msg, channel);
|
|
|
|
}
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
bool DebuggerRunControl::isRunning() const
|
2010-06-15 11:42:49 +02:00
|
|
|
{
|
2014-10-17 12:37:30 +02:00
|
|
|
return m_running;
|
2010-06-15 11:42:49 +02:00
|
|
|
}
|
|
|
|
|
2014-12-12 15:33:16 +01:00
|
|
|
DebuggerStartParameters &DebuggerRunControl::startParameters()
|
|
|
|
{
|
2015-05-27 13:59:56 +02:00
|
|
|
return m_engine->runParameters();
|
2014-12-12 15:33:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void DebuggerRunControl::notifyInferiorIll()
|
|
|
|
{
|
|
|
|
m_engine->notifyInferiorIll();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DebuggerRunControl::notifyInferiorExited()
|
|
|
|
{
|
|
|
|
m_engine->notifyInferiorExited();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DebuggerRunControl::quitDebugger()
|
|
|
|
{
|
|
|
|
m_engine->quitDebugger();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DebuggerRunControl::abortDebugger()
|
2010-06-15 11:42:49 +02:00
|
|
|
{
|
2014-12-12 15:33:16 +01:00
|
|
|
m_engine->abortDebugger();
|
2010-06-15 11:42:49 +02:00
|
|
|
}
|
|
|
|
|
2015-06-24 08:26:35 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
2010-12-15 09:17:31 +01:00
|
|
|
//
|
2015-06-24 08:26:35 +02:00
|
|
|
// DebuggerRunControlCreator
|
2010-12-15 09:17:31 +01:00
|
|
|
//
|
2015-06-24 08:26:35 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
2010-12-15 09:17:31 +01:00
|
|
|
|
2015-05-27 16:09:43 +02:00
|
|
|
namespace Internal {
|
|
|
|
|
2015-06-24 08:26:35 +02:00
|
|
|
class DebuggerRunControlCreator
|
2015-05-27 16:09:43 +02:00
|
|
|
{
|
|
|
|
public:
|
2015-06-24 08:26:35 +02:00
|
|
|
DebuggerRunControlCreator() {}
|
|
|
|
|
|
|
|
// Life cycle: Initialize from StartParameters, enrich by automatically
|
|
|
|
// detectable pieces, construct an Engine and a RunControl.
|
|
|
|
void initialize(const DebuggerStartParameters &sp);
|
|
|
|
void enrich(const RunConfiguration *runConfig, const Kit *kit);
|
2015-06-29 10:36:29 +03:00
|
|
|
void createRunControl(Core::Id runMode = DebugRunMode);
|
2015-06-24 08:26:35 +02:00
|
|
|
QString fullError() const { return m_errors.join(QLatin1Char('\n')); }
|
|
|
|
|
|
|
|
// Result.
|
|
|
|
DebuggerRunParameters m_rp;
|
|
|
|
|
|
|
|
// Scratch data.
|
|
|
|
const Kit *m_kit = 0;
|
|
|
|
const RunConfiguration *m_runConfig = 0;
|
|
|
|
DebuggerRunConfigurationAspect *m_debuggerAspect = 0;
|
|
|
|
Target *m_target = 0;
|
|
|
|
Project *m_project = 0;
|
|
|
|
|
|
|
|
QStringList m_errors;
|
|
|
|
DebuggerRunControl *m_runControl = 0;
|
2015-05-27 16:09:43 +02:00
|
|
|
};
|
|
|
|
|
2015-06-24 08:26:35 +02:00
|
|
|
void DebuggerRunControlCreator::initialize(const DebuggerStartParameters &sp)
|
2015-05-27 13:59:56 +02:00
|
|
|
{
|
2015-06-24 08:26:35 +02:00
|
|
|
m_rp.DebuggerStartParameters::operator=(sp);
|
2015-05-27 13:59:56 +02:00
|
|
|
}
|
|
|
|
|
2015-06-24 08:26:35 +02:00
|
|
|
void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const Kit *kit)
|
2012-08-15 13:21:37 +02:00
|
|
|
{
|
2015-06-24 08:26:35 +02:00
|
|
|
QTC_ASSERT(!m_kit, return);
|
2016-01-28 17:58:53 +01:00
|
|
|
QTC_ASSERT(!m_target, return);
|
2015-06-24 08:26:35 +02:00
|
|
|
QTC_ASSERT(!m_runConfig, return);
|
|
|
|
|
2016-01-28 17:58:53 +01:00
|
|
|
m_kit = kit;
|
|
|
|
m_runConfig = runConfig;
|
|
|
|
|
|
|
|
// Find a Kit and Target. Either could be missing.
|
|
|
|
if (m_runConfig)
|
|
|
|
m_target = m_runConfig->target();
|
|
|
|
|
|
|
|
if (!m_kit && m_target)
|
|
|
|
m_kit = m_target->kit();
|
2015-06-24 08:26:35 +02:00
|
|
|
|
2016-03-22 13:11:01 +01:00
|
|
|
// Make sure we have something sensible to start with.
|
|
|
|
m_rp.inferior.runMode == ApplicationLauncher::Console;
|
|
|
|
m_rp.useTerminal = false;
|
|
|
|
|
2015-06-24 08:26:35 +02:00
|
|
|
// Extract as much as possible from available RunConfiguration.
|
2016-01-28 17:58:53 +01:00
|
|
|
if (m_runConfig && m_runConfig->runnable().is<StandardRunnable>()) {
|
2016-03-22 13:11:01 +01:00
|
|
|
m_rp.inferior = m_runConfig->runnable().as<StandardRunnable>();
|
|
|
|
m_rp.useTerminal = m_rp.inferior.runMode == ApplicationLauncher::Console;
|
2015-06-24 08:26:35 +02:00
|
|
|
// Normalize to work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch'...)
|
2016-03-22 13:11:01 +01:00
|
|
|
m_rp.inferior.workingDirectory = FileUtils::normalizePathName(m_rp.inferior.workingDirectory);
|
2010-12-15 09:34:02 +01:00
|
|
|
}
|
|
|
|
|
2015-07-23 11:23:58 +02:00
|
|
|
// We might get an executable from a local PID.
|
2016-01-28 10:31:24 +01:00
|
|
|
if (m_rp.inferior.executable.isEmpty() && m_rp.attachPID != InvalidPid) {
|
2015-06-24 08:26:35 +02:00
|
|
|
foreach (const DeviceProcessItem &p, DeviceProcessList::localProcesses())
|
|
|
|
if (p.pid == m_rp.attachPID)
|
2016-01-28 10:31:24 +01:00
|
|
|
m_rp.inferior.executable = p.exe;
|
2012-09-05 12:42:41 +02:00
|
|
|
}
|
2014-10-20 14:03:47 +02:00
|
|
|
|
2015-06-24 08:26:35 +02:00
|
|
|
if (!m_kit) {
|
2014-10-20 14:03:47 +02:00
|
|
|
// This code can only be reached when starting via the command line
|
|
|
|
// (-debug pid or executable) or attaching from runconfiguration
|
|
|
|
// without specifying a kit. Try to find a kit via ABI.
|
|
|
|
QList<Abi> abis;
|
2015-06-24 08:26:35 +02:00
|
|
|
if (m_rp.toolChainAbi.isValid()) {
|
|
|
|
abis.push_back(m_rp.toolChainAbi);
|
2016-01-28 10:31:24 +01:00
|
|
|
} else if (!m_rp.inferior.executable.isEmpty()) {
|
|
|
|
abis = Abi::abisOfBinary(FileName::fromString(m_rp.inferior.executable));
|
2014-10-20 14:03:47 +02:00
|
|
|
}
|
2015-06-24 08:26:35 +02:00
|
|
|
|
2014-10-20 14:03:47 +02:00
|
|
|
if (!abis.isEmpty()) {
|
|
|
|
// Try exact abis.
|
2016-03-01 21:32:03 +01:00
|
|
|
m_kit = KitManager::find(KitMatcher([abis](const Kit *k) -> bool {
|
2015-06-24 08:26:35 +02:00
|
|
|
if (const ToolChain *tc = ToolChainKitInformation::toolChain(k))
|
|
|
|
return abis.contains(tc->targetAbi()) && DebuggerKitInformation::isValidDebugger(k);
|
2014-10-20 14:03:47 +02:00
|
|
|
return false;
|
2016-03-01 21:32:03 +01:00
|
|
|
}));
|
2015-06-24 08:26:35 +02:00
|
|
|
if (!m_kit) {
|
2014-10-20 14:03:47 +02:00
|
|
|
// Or something compatible.
|
2016-03-01 21:32:03 +01:00
|
|
|
m_kit = KitManager::find(KitMatcher([abis](const Kit *k) -> bool {
|
2014-10-20 14:03:47 +02:00
|
|
|
if (const ToolChain *tc = ToolChainKitInformation::toolChain(k))
|
|
|
|
foreach (const Abi &a, abis)
|
|
|
|
if (a.isCompatibleWith(tc->targetAbi()) && DebuggerKitInformation::isValidDebugger(k))
|
|
|
|
return true;
|
|
|
|
return false;
|
2016-03-01 21:32:03 +01:00
|
|
|
}));
|
2014-10-20 14:03:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-24 08:26:35 +02:00
|
|
|
if (!m_kit)
|
|
|
|
m_kit = KitManager::defaultKit();
|
|
|
|
|
|
|
|
// We really should have a kit now.
|
|
|
|
if (!m_kit) {
|
|
|
|
m_errors.append(DebuggerKitInformation::tr("No kit found."));
|
|
|
|
return;
|
2014-10-20 14:03:47 +02:00
|
|
|
}
|
2015-06-24 08:26:35 +02:00
|
|
|
|
|
|
|
if (m_runConfig) {
|
2015-12-08 12:39:10 +01:00
|
|
|
if (auto envAspect = m_runConfig->extraAspect<EnvironmentAspect>()) {
|
2016-01-28 10:31:24 +01:00
|
|
|
m_rp.inferior.environment = envAspect->environment(); // Correct.
|
|
|
|
m_rp.stubEnvironment = m_rp.inferior.environment; // FIXME: Wrong, but contains DYLD_IMAGE_SUFFIX
|
|
|
|
m_rp.debuggerEnvironment = m_rp.inferior.environment; // FIXME: Wrong, but contains DYLD_IMAGE_SUFFIX
|
2015-12-08 12:39:10 +01:00
|
|
|
}
|
2015-06-24 08:26:35 +02:00
|
|
|
}
|
|
|
|
|
2015-06-26 13:06:08 +02:00
|
|
|
if (ToolChain *tc = ToolChainKitInformation::toolChain(m_kit))
|
|
|
|
m_rp.toolChainAbi = tc->targetAbi();
|
2015-06-24 08:26:35 +02:00
|
|
|
|
|
|
|
if (m_target)
|
|
|
|
m_project = m_target->project();
|
|
|
|
|
2015-06-26 13:06:08 +02:00
|
|
|
if (m_project && m_rp.projectSourceDirectory.isEmpty())
|
|
|
|
m_rp.projectSourceDirectory = m_project->projectDirectory().toString();
|
|
|
|
|
|
|
|
if (m_project && m_rp.projectSourceFiles.isEmpty())
|
2016-01-08 16:56:35 +01:00
|
|
|
m_rp.projectSourceFiles = m_project->files(Project::SourceFiles);
|
2015-06-26 13:06:08 +02:00
|
|
|
|
2015-10-08 16:19:57 +02:00
|
|
|
if (m_project && m_rp.projectSourceFiles.isEmpty())
|
2016-01-08 16:56:35 +01:00
|
|
|
m_rp.projectSourceFiles = m_project->files(Project::SourceFiles);
|
2015-10-08 16:19:57 +02:00
|
|
|
|
|
|
|
if (false && m_project && m_kit) {
|
|
|
|
const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(m_kit);
|
|
|
|
m_rp.nativeMixedEnabled = version && version->qtVersion() >= QtSupport::QtVersionNumber(5, 7, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ok = false;
|
|
|
|
int nativeMixedOverride = qgetenv("QTC_DEBUGGER_NATIVE_MIXED").toInt(&ok);
|
|
|
|
if (ok)
|
|
|
|
m_rp.nativeMixedEnabled = bool(nativeMixedOverride);
|
|
|
|
|
2014-10-20 14:03:47 +02:00
|
|
|
// validate debugger if C++ debugging is enabled
|
2015-06-24 08:26:35 +02:00
|
|
|
if (m_rp.languages & CppLanguage) {
|
|
|
|
const QList<Task> tasks = DebuggerKitInformation::validateDebugger(m_kit);
|
2014-10-20 14:03:47 +02:00
|
|
|
if (!tasks.isEmpty()) {
|
2015-06-24 08:26:35 +02:00
|
|
|
foreach (const Task &t, tasks)
|
|
|
|
m_errors.append(t.description);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_rp.cppEngineType = DebuggerKitInformation::engineType(m_kit);
|
|
|
|
m_rp.sysRoot = SysRootKitInformation::sysRoot(m_kit).toString();
|
|
|
|
m_rp.debuggerCommand = DebuggerKitInformation::debuggerCommand(m_kit).toString();
|
2015-06-26 13:06:08 +02:00
|
|
|
m_rp.device = DeviceKitInformation::device(m_kit);
|
2015-06-24 08:26:35 +02:00
|
|
|
|
|
|
|
if (m_project) {
|
|
|
|
m_rp.projectSourceDirectory = m_project->projectDirectory().toString();
|
2016-01-08 16:56:35 +01:00
|
|
|
m_rp.projectSourceFiles = m_project->files(Project::SourceFiles);
|
2015-06-24 08:26:35 +02:00
|
|
|
}
|
|
|
|
|
2015-06-26 13:06:08 +02:00
|
|
|
if (m_runConfig)
|
|
|
|
m_debuggerAspect = m_runConfig->extraAspect<DebuggerRunConfigurationAspect>();
|
2015-06-24 08:26:35 +02:00
|
|
|
|
2015-07-23 11:23:52 +02:00
|
|
|
if (m_rp.displayName.isEmpty() && m_runConfig)
|
|
|
|
m_rp.displayName = m_runConfig->displayName();
|
|
|
|
|
2015-08-31 15:35:16 +02:00
|
|
|
if (runConfig && runConfig->property("supportsDebugger").toBool()) {
|
2015-07-23 11:23:52 +02:00
|
|
|
QString mainScript = runConfig->property("mainScript").toString();
|
|
|
|
QString interpreter = runConfig->property("interpreter").toString();
|
|
|
|
if (!interpreter.isEmpty() && mainScript.endsWith(_(".py"))) {
|
|
|
|
m_rp.mainScript = mainScript;
|
|
|
|
m_rp.interpreter = interpreter;
|
|
|
|
QString args = runConfig->property("arguments").toString();
|
2015-08-25 08:52:45 +02:00
|
|
|
if (!args.isEmpty()) {
|
2016-01-28 10:31:24 +01:00
|
|
|
if (!m_rp.inferior.commandLineArguments.isEmpty())
|
|
|
|
m_rp.inferior.commandLineArguments.append(QLatin1Char(' '));
|
|
|
|
m_rp.inferior.commandLineArguments.append(args);
|
2015-08-25 08:52:45 +02:00
|
|
|
}
|
2015-07-23 11:23:52 +02:00
|
|
|
m_rp.masterEngineType = PdbEngineType;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-24 08:26:35 +02:00
|
|
|
if (m_debuggerAspect) {
|
|
|
|
m_rp.multiProcess = m_debuggerAspect->useMultiProcess();
|
|
|
|
|
|
|
|
if (m_debuggerAspect->useCppDebugger())
|
|
|
|
m_rp.languages |= CppLanguage;
|
|
|
|
|
|
|
|
if (m_debuggerAspect->useQmlDebugger()) {
|
2015-06-26 13:06:08 +02:00
|
|
|
m_rp.languages |= QmlLanguage;
|
2015-06-24 08:26:35 +02:00
|
|
|
if (m_rp.device && m_rp.device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
|
|
|
|
QTcpServer server;
|
|
|
|
const bool canListen = server.listen(QHostAddress::LocalHost)
|
|
|
|
|| server.listen(QHostAddress::LocalHostIPv6);
|
|
|
|
if (!canListen) {
|
|
|
|
m_errors.append(DebuggerPlugin::tr("Not enough free ports for QML debugging.") + QLatin1Char(' '));
|
|
|
|
return;
|
2014-10-20 14:03:47 +02:00
|
|
|
}
|
2015-06-24 08:26:35 +02:00
|
|
|
m_rp.qmlServerAddress = server.serverAddress().toString();
|
|
|
|
m_rp.qmlServerPort = server.serverPort();
|
|
|
|
|
|
|
|
// Makes sure that all bindings go through the JavaScript engine, so that
|
|
|
|
// breakpoints are actually hit!
|
|
|
|
const QString optimizerKey = _("QML_DISABLE_OPTIMIZER");
|
2016-01-28 10:31:24 +01:00
|
|
|
if (!m_rp.inferior.environment.hasKey(optimizerKey))
|
|
|
|
m_rp.inferior.environment.set(optimizerKey, _("1"));
|
2014-10-20 14:03:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-24 08:26:35 +02:00
|
|
|
if (!boolSetting(AutoEnrichParameters)) {
|
|
|
|
const QString sysroot = m_rp.sysRoot;
|
|
|
|
if (m_rp.debugInfoLocation.isEmpty())
|
|
|
|
m_rp.debugInfoLocation = sysroot + QLatin1String("/usr/lib/debug");
|
|
|
|
if (m_rp.debugSourceLocation.isEmpty()) {
|
|
|
|
QString base = sysroot + QLatin1String("/usr/src/debug/");
|
|
|
|
m_rp.debugSourceLocation.append(base + QLatin1String("qt5base/src/corelib"));
|
|
|
|
m_rp.debugSourceLocation.append(base + QLatin1String("qt5base/src/gui"));
|
|
|
|
m_rp.debugSourceLocation.append(base + QLatin1String("qt5base/src/network"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_rp.masterEngineType == NoEngineType && m_debuggerAspect) {
|
2015-10-08 16:19:57 +02:00
|
|
|
const bool wantCppDebugger = m_debuggerAspect->useCppDebugger() && (m_rp.languages & CppLanguage);
|
|
|
|
const bool wantQmlDebugger = m_debuggerAspect->useQmlDebugger() && (m_rp.languages & QmlLanguage);
|
|
|
|
|
|
|
|
if (wantQmlDebugger) {
|
2015-11-12 08:07:46 +01:00
|
|
|
QmlDebug::QmlDebugServicesPreset service;
|
2015-10-08 16:19:57 +02:00
|
|
|
if (wantCppDebugger) {
|
|
|
|
if (m_rp.nativeMixedEnabled) {
|
2015-11-12 08:07:46 +01:00
|
|
|
service = QmlDebug::QmlNativeDebuggerServices;
|
2015-10-08 16:19:57 +02:00
|
|
|
} else {
|
|
|
|
m_rp.masterEngineType = QmlCppEngineType;
|
2015-11-12 08:07:46 +01:00
|
|
|
service = QmlDebug::QmlDebuggerServices;
|
2015-10-08 16:19:57 +02:00
|
|
|
}
|
|
|
|
} else {
|
2015-06-24 08:26:35 +02:00
|
|
|
m_rp.masterEngineType = QmlEngineType;
|
2015-11-12 08:07:46 +01:00
|
|
|
service = QmlDebug::QmlDebuggerServices;
|
2015-10-08 16:19:57 +02:00
|
|
|
}
|
2015-11-12 08:07:46 +01:00
|
|
|
if (m_rp.startMode != AttachExternal)
|
2016-01-28 10:31:24 +01:00
|
|
|
QtcProcess::addArg(&m_rp.inferior.commandLineArguments,
|
|
|
|
wantCppDebugger && m_rp.nativeMixedEnabled ?
|
2015-11-17 16:40:27 +01:00
|
|
|
QmlDebug::qmlDebugNativeArguments(service, false) :
|
|
|
|
QmlDebug::qmlDebugTcpArguments(service, m_rp.qmlServerPort));
|
2015-06-24 08:26:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_rp.masterEngineType == NoEngineType)
|
|
|
|
m_rp.masterEngineType = m_rp.cppEngineType;
|
|
|
|
|
|
|
|
if (m_rp.device && m_rp.connParams.port == 0)
|
|
|
|
m_rp.connParams = m_rp.device->sshParameters();
|
|
|
|
|
|
|
|
// Could have been set from command line.
|
|
|
|
if (m_rp.remoteChannel.isEmpty())
|
|
|
|
m_rp.remoteChannel = m_rp.connParams.host + QLatin1Char(':') + QString::number(m_rp.connParams.port);
|
2015-06-12 11:37:46 +02:00
|
|
|
|
2015-06-24 08:26:35 +02:00
|
|
|
if (m_rp.startMode == NoStartMode)
|
|
|
|
m_rp.startMode = StartInternal;
|
2014-10-20 14:03:47 +02:00
|
|
|
}
|
|
|
|
|
2015-06-24 08:26:35 +02:00
|
|
|
// Re-used for Combined C++/QML engine.
|
|
|
|
DebuggerEngine *createEngine(DebuggerEngineType et, const DebuggerRunParameters &rp, QStringList *errors)
|
2011-02-24 16:50:15 +01:00
|
|
|
{
|
|
|
|
switch (et) {
|
|
|
|
case GdbEngineType:
|
2015-06-04 10:31:27 +02:00
|
|
|
return createGdbEngine(rp);
|
2011-02-24 16:50:15 +01:00
|
|
|
case CdbEngineType:
|
2015-06-24 08:26:35 +02:00
|
|
|
return createCdbEngine(rp, errors);
|
2011-02-24 16:50:15 +01:00
|
|
|
case PdbEngineType:
|
2015-06-04 10:31:27 +02:00
|
|
|
return createPdbEngine(rp);
|
2011-02-24 16:50:15 +01:00
|
|
|
case QmlEngineType:
|
2015-06-04 10:31:27 +02:00
|
|
|
return createQmlEngine(rp);
|
2011-02-24 16:50:15 +01:00
|
|
|
case LldbEngineType:
|
2015-06-04 10:31:27 +02:00
|
|
|
return createLldbEngine(rp);
|
2012-08-15 13:21:37 +02:00
|
|
|
case QmlCppEngineType:
|
2015-06-24 08:26:35 +02:00
|
|
|
return createQmlCppEngine(rp, errors);
|
2011-04-08 16:04:53 +02:00
|
|
|
default:
|
2015-06-24 08:26:35 +02:00
|
|
|
if (errors)
|
|
|
|
errors->append(DebuggerPlugin::tr("Unknown debugger type \"%1\"").arg(_(engineTypeName(et))));
|
2011-02-24 16:50:15 +01:00
|
|
|
}
|
2010-12-15 09:17:31 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-06-29 10:36:29 +03:00
|
|
|
void DebuggerRunControlCreator::createRunControl(Core::Id runMode)
|
2015-06-24 08:26:35 +02:00
|
|
|
{
|
|
|
|
if (runMode == DebugRunModeWithBreakOnMain)
|
|
|
|
m_rp.breakOnMain = true;
|
|
|
|
|
|
|
|
DebuggerEngine *engine = createEngine(m_rp.masterEngineType, m_rp, &m_errors);
|
|
|
|
if (!engine) {
|
|
|
|
m_errors.append(DebuggerPlugin::tr("Unable to create a debugger engine of the type \"%1\"").
|
|
|
|
arg(_(engineTypeName(m_rp.masterEngineType))));
|
|
|
|
m_rp.startMode = NoStartMode;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_runControl = new DebuggerRunControl(const_cast<RunConfiguration *>(m_runConfig), engine);
|
|
|
|
|
|
|
|
if (!m_runControl)
|
|
|
|
m_rp.startMode = NoStartMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// DebuggerRunControlFactory
|
|
|
|
//
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-07-23 11:23:52 +02:00
|
|
|
static bool isDebuggableScript(RunConfiguration *runConfig)
|
|
|
|
{
|
|
|
|
QString mainScript = runConfig->property("mainScript").toString();
|
|
|
|
return mainScript.endsWith(_(".py")); // Only Python for now.
|
|
|
|
}
|
|
|
|
|
2015-06-24 08:26:35 +02:00
|
|
|
class DebuggerRunControlFactory : public IRunControlFactory
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit DebuggerRunControlFactory(QObject *parent)
|
|
|
|
: IRunControlFactory(parent)
|
|
|
|
{}
|
|
|
|
|
|
|
|
RunControl *create(RunConfiguration *runConfig,
|
2015-06-29 10:36:29 +03:00
|
|
|
Core::Id mode, QString *errorMessage) override
|
2015-06-24 08:26:35 +02:00
|
|
|
{
|
|
|
|
QTC_ASSERT(runConfig, return 0);
|
|
|
|
QTC_ASSERT(mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain, return 0);
|
|
|
|
|
|
|
|
// We cover only local setup here. Remote setups are handled by the
|
|
|
|
// RunControl factories in the target specific plugins.
|
|
|
|
DebuggerRunControlCreator creator;
|
|
|
|
creator.enrich(runConfig, 0);
|
|
|
|
creator.createRunControl(mode);
|
|
|
|
if (errorMessage)
|
|
|
|
*errorMessage = creator.fullError();
|
|
|
|
return creator.m_runControl;
|
|
|
|
}
|
|
|
|
|
2015-06-29 10:36:29 +03:00
|
|
|
bool canRun(RunConfiguration *runConfig, Core::Id mode) const override
|
2015-06-24 08:26:35 +02:00
|
|
|
{
|
2016-01-25 15:00:20 +01:00
|
|
|
if (!(mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain))
|
|
|
|
return false;
|
|
|
|
return DeviceTypeKitInformation::deviceTypeId(runConfig->target()->kit())
|
|
|
|
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE
|
|
|
|
|| isDebuggableScript(runConfig);
|
2015-06-24 08:26:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
IRunConfigurationAspect *createRunConfigurationAspect(RunConfiguration *rc) override
|
|
|
|
{
|
|
|
|
return new DebuggerRunConfigurationAspect(rc);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
QObject *createDebuggerRunControlFactory(QObject *parent)
|
|
|
|
{
|
|
|
|
return new DebuggerRunControlFactory(parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Externally visible helper.
|
|
|
|
//
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used for direct "special" starts from actions in the debugger plugin.
|
|
|
|
*/
|
|
|
|
DebuggerRunControl *createAndScheduleRun(const DebuggerRunParameters &rp, const Kit *kit)
|
|
|
|
{
|
|
|
|
DebuggerRunControlCreator creator;
|
|
|
|
creator.m_rp = rp;
|
|
|
|
creator.enrich(0, kit);
|
2015-06-26 13:06:08 +02:00
|
|
|
creator.createRunControl(DebugRunMode);
|
2015-06-24 08:26:35 +02:00
|
|
|
if (!creator.m_runControl) {
|
|
|
|
ProjectExplorerPlugin::showRunErrorMessage(creator.fullError());
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
Internal::showMessage(rp.startMessage, 0);
|
|
|
|
ProjectExplorerPlugin::startRunControl(creator.m_runControl, DebugRunMode);
|
|
|
|
return creator.m_runControl; // Only used for tests.
|
|
|
|
}
|
|
|
|
|
2015-05-27 13:59:56 +02:00
|
|
|
} // namespace Internal
|
2015-06-04 10:31:27 +02:00
|
|
|
|
2015-06-24 08:26:35 +02:00
|
|
|
/**
|
|
|
|
* Main entry point for target plugins.
|
|
|
|
*/
|
2015-06-26 13:06:08 +02:00
|
|
|
DebuggerRunControl *createDebuggerRunControl(const DebuggerStartParameters &sp,
|
|
|
|
RunConfiguration *runConfig,
|
|
|
|
QString *errorMessage,
|
2015-06-29 10:36:29 +03:00
|
|
|
Core::Id runMode)
|
2015-06-04 10:31:27 +02:00
|
|
|
{
|
2015-06-24 08:26:35 +02:00
|
|
|
DebuggerRunControlCreator creator;
|
|
|
|
creator.initialize(sp);
|
2015-06-26 13:06:08 +02:00
|
|
|
creator.enrich(runConfig, 0);
|
|
|
|
creator.createRunControl(runMode);
|
2015-06-24 08:26:35 +02:00
|
|
|
if (errorMessage)
|
|
|
|
*errorMessage = creator.fullError();
|
|
|
|
if (!creator.m_runControl) {
|
|
|
|
Core::ICore::showWarningWithOptions(DebuggerRunControl::tr("Debugger"), creator.fullError());
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return creator.m_runControl;
|
|
|
|
}
|
|
|
|
|
2009-09-11 08:55:16 +02:00
|
|
|
} // namespace Debugger
|