2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-01-10 10:35:41 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-01-10 10:35:41 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-01-10 10:35:41 +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.
|
2011-01-10 10:35:41 +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.
|
2011-01-10 10:35:41 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-01-10 10:35:41 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2011-01-10 10:35:41 +01:00
|
|
|
|
2014-10-17 13:40:04 +02:00
|
|
|
#include "debugger_global.h"
|
2014-10-17 13:06:37 +02:00
|
|
|
#include "debuggerconstants.h"
|
2017-04-21 10:10:25 +02:00
|
|
|
#include "debuggerengine.h"
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
#include "terminal.h"
|
2014-10-17 13:06:37 +02:00
|
|
|
|
2011-01-10 10:35:41 +01:00
|
|
|
#include <projectexplorer/runconfiguration.h>
|
2017-05-09 10:25:11 +02:00
|
|
|
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
|
2011-01-10 10:35:41 +01:00
|
|
|
|
|
|
|
|
namespace Debugger {
|
2012-08-15 13:21:37 +02:00
|
|
|
|
2017-09-27 08:22:02 +02:00
|
|
|
namespace Internal {
|
|
|
|
|
class TerminalRunner;
|
|
|
|
|
class DebuggerRunToolPrivate;
|
|
|
|
|
} // Internal
|
|
|
|
|
|
2019-12-13 10:30:30 +01:00
|
|
|
class DebugServerPortsGatherer;
|
2017-10-19 14:23:43 +02:00
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
class DEBUGGER_EXPORT DebuggerRunTool : public ProjectExplorer::RunWorker
|
2017-04-21 10:10:25 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2019-03-12 17:04:08 +01:00
|
|
|
enum AllowTerminal { DoAllowTerminal, DoNotAllowTerminal };
|
2017-09-19 17:51:53 +02:00
|
|
|
explicit DebuggerRunTool(ProjectExplorer::RunControl *runControl,
|
2019-03-12 17:04:08 +01:00
|
|
|
AllowTerminal allowTerminal = DoAllowTerminal);
|
2018-05-07 15:06:53 +02:00
|
|
|
~DebuggerRunTool() override;
|
2017-04-21 10:10:25 +02:00
|
|
|
|
2017-08-24 18:40:37 +02:00
|
|
|
void startRunControl();
|
|
|
|
|
|
2017-04-21 17:20:57 +02:00
|
|
|
void showMessage(const QString &msg, int channel = LogDebug, int timeout = -1);
|
|
|
|
|
|
2017-04-27 09:53:07 +02:00
|
|
|
void start() override;
|
|
|
|
|
void stop() override;
|
2017-04-21 10:10:25 +02:00
|
|
|
|
2017-09-20 16:34:54 +02:00
|
|
|
bool isCppDebugging() const;
|
|
|
|
|
bool isQmlDebugging() const;
|
2017-05-04 12:12:27 +02:00
|
|
|
int portsUsedByDebugger() const;
|
|
|
|
|
|
2017-10-19 14:23:43 +02:00
|
|
|
void setUsePortsGatherer(bool useCpp, bool useQml);
|
2019-12-13 10:30:30 +01:00
|
|
|
DebugServerPortsGatherer *portsGatherer() const;
|
2017-10-19 14:23:43 +02:00
|
|
|
|
2017-08-24 16:53:31 +02:00
|
|
|
void setSolibSearchPath(const QStringList &list);
|
|
|
|
|
void addSolibSearchDir(const QString &str);
|
2017-07-05 15:17:38 +02:00
|
|
|
|
2017-07-07 19:11:32 +02:00
|
|
|
static void setBreakOnMainNextTime();
|
|
|
|
|
|
2017-08-24 15:46:23 +02:00
|
|
|
void setInferior(const ProjectExplorer::Runnable &runnable);
|
2019-06-20 17:19:12 +02:00
|
|
|
void setInferiorExecutable(const Utils::FilePath &executable);
|
2017-10-11 17:17:16 +02:00
|
|
|
void setInferiorEnvironment(const Utils::Environment &env); // Used by GammaRay plugin
|
2017-11-13 11:11:43 +01:00
|
|
|
void setInferiorDevice(ProjectExplorer::IDevice::ConstPtr device); // Used by cdbengine
|
2017-08-24 16:04:25 +02:00
|
|
|
void setRunControlName(const QString &name);
|
2017-08-24 19:30:35 +02:00
|
|
|
void setStartMessage(const QString &msg);
|
2017-08-24 15:46:23 +02:00
|
|
|
void addQmlServerInferiorCommandLineArgumentIfNeeded();
|
|
|
|
|
|
2017-08-24 19:30:35 +02:00
|
|
|
void setCrashParameter(const QString &event);
|
|
|
|
|
|
2017-08-24 16:53:31 +02:00
|
|
|
void addExpectedSignal(const QString &signal);
|
2019-05-28 13:49:26 +02:00
|
|
|
void addSearchDirectory(const Utils::FilePath &dir);
|
2017-08-24 16:53:31 +02:00
|
|
|
|
2017-08-24 15:46:23 +02:00
|
|
|
void setStartMode(DebuggerStartMode startMode);
|
|
|
|
|
void setCloseMode(DebuggerCloseMode closeMode);
|
|
|
|
|
|
2017-08-24 16:53:31 +02:00
|
|
|
void setAttachPid(Utils::ProcessHandle pid);
|
2017-08-24 19:30:35 +02:00
|
|
|
void setAttachPid(qint64 pid);
|
|
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
void setSysRoot(const Utils::FilePath &sysRoot);
|
2019-06-20 17:19:12 +02:00
|
|
|
void setSymbolFile(const Utils::FilePath &symbolFile);
|
2017-08-24 17:38:06 +02:00
|
|
|
void setRemoteChannel(const QString &channel);
|
2017-08-24 19:30:35 +02:00
|
|
|
void setRemoteChannel(const QString &host, int port);
|
2017-12-19 13:01:02 +01:00
|
|
|
void setRemoteChannel(const QUrl &url);
|
2019-11-11 12:37:50 +01:00
|
|
|
QString remoteChannel() const;
|
2017-08-24 15:46:23 +02:00
|
|
|
|
|
|
|
|
void setUseExtendedRemote(bool on);
|
2017-08-24 16:53:31 +02:00
|
|
|
void setUseContinueInsteadOfRun(bool on);
|
|
|
|
|
void setUseTargetAsync(bool on);
|
2017-08-24 17:38:06 +02:00
|
|
|
void setContinueAfterAttach(bool on);
|
2017-08-24 16:53:31 +02:00
|
|
|
void setSkipExecutableValidation(bool on);
|
2017-09-08 15:15:46 +02:00
|
|
|
void setUseCtrlCStub(bool on);
|
2017-09-12 12:38:31 +02:00
|
|
|
void setBreakOnMain(bool on);
|
|
|
|
|
void setUseTerminal(bool on);
|
2017-08-24 16:53:31 +02:00
|
|
|
|
2017-08-25 12:53:44 +02:00
|
|
|
void setCommandsAfterConnect(const QString &commands);
|
|
|
|
|
void setCommandsForReset(const QString &commands);
|
|
|
|
|
|
2019-06-04 09:29:42 +02:00
|
|
|
void setServerStartScript(const Utils::FilePath &serverStartScript);
|
2017-09-12 12:38:31 +02:00
|
|
|
void setDebugInfoLocation(const QString &debugInfoLocation);
|
|
|
|
|
|
2017-08-24 15:46:23 +02:00
|
|
|
void setQmlServer(const QUrl &qmlServer);
|
2018-08-20 11:33:05 +02:00
|
|
|
QUrl qmlServer() const; // Used in GammaRay integration.
|
2017-08-24 15:46:23 +02:00
|
|
|
|
2017-08-24 19:30:35 +02:00
|
|
|
void setCoreFileName(const QString &core, bool isSnapshot = false);
|
|
|
|
|
|
2017-08-24 17:38:06 +02:00
|
|
|
void setIosPlatform(const QString &platform);
|
|
|
|
|
void setDeviceSymbolsRoot(const QString &deviceSymbolsRoot);
|
|
|
|
|
|
2017-09-12 11:28:23 +02:00
|
|
|
void setTestCase(int testCase);
|
2017-09-12 12:38:31 +02:00
|
|
|
void setOverrideStartScript(const QString &script);
|
2017-09-05 13:17:43 +02:00
|
|
|
|
2019-08-26 14:19:07 +03:00
|
|
|
void setAbi(const ProjectExplorer::Abi &abi);
|
|
|
|
|
|
2017-09-27 08:22:02 +02:00
|
|
|
Internal::TerminalRunner *terminalRunner() const;
|
|
|
|
|
|
2017-04-21 10:10:25 +02:00
|
|
|
private:
|
2017-09-18 14:47:39 +02:00
|
|
|
bool fixupParameters();
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
void handleEngineStarted(Internal::DebuggerEngine *engine);
|
|
|
|
|
void handleEngineFinished(Internal::DebuggerEngine *engine);
|
2017-09-18 14:47:39 +02:00
|
|
|
|
2017-09-27 08:22:02 +02:00
|
|
|
Internal::DebuggerRunToolPrivate *d;
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
QPointer<Internal::DebuggerEngine> m_engine;
|
|
|
|
|
QPointer<Internal::DebuggerEngine> m_engine2;
|
2017-05-05 14:45:36 +02:00
|
|
|
Internal::DebuggerRunParameters m_runParameters;
|
2017-04-21 10:10:25 +02:00
|
|
|
};
|
|
|
|
|
|
2019-12-13 10:30:30 +01:00
|
|
|
class DEBUGGER_EXPORT DebugServerPortsGatherer : public ProjectExplorer::ChannelProvider
|
2017-05-09 10:25:11 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2019-12-13 10:30:30 +01:00
|
|
|
explicit DebugServerPortsGatherer(ProjectExplorer::RunControl *runControl);
|
|
|
|
|
~DebugServerPortsGatherer() override;
|
2017-05-09 10:25:11 +02:00
|
|
|
|
|
|
|
|
void setUseGdbServer(bool useIt) { m_useGdbServer = useIt; }
|
|
|
|
|
bool useGdbServer() const { return m_useGdbServer; }
|
2017-12-19 13:01:02 +01:00
|
|
|
QUrl gdbServer() const;
|
2017-05-09 10:25:11 +02:00
|
|
|
|
|
|
|
|
void setUseQmlServer(bool useIt) { m_useQmlServer = useIt; }
|
|
|
|
|
bool useQmlServer() const { return m_useQmlServer; }
|
2017-08-24 15:46:23 +02:00
|
|
|
QUrl qmlServer() const;
|
2017-05-09 10:25:11 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool m_useGdbServer = false;
|
|
|
|
|
bool m_useQmlServer = false;
|
|
|
|
|
};
|
|
|
|
|
|
2019-12-13 10:30:30 +01:00
|
|
|
class DEBUGGER_EXPORT DebugServerRunner : public ProjectExplorer::SimpleTargetRunner
|
2017-05-09 10:25:11 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2019-12-13 10:30:30 +01:00
|
|
|
explicit DebugServerRunner(ProjectExplorer::RunControl *runControl,
|
|
|
|
|
DebugServerPortsGatherer *portsGatherer);
|
2017-10-19 08:29:20 +02:00
|
|
|
|
2019-12-13 10:30:30 +01:00
|
|
|
~DebugServerRunner() override;
|
2017-05-09 10:25:11 +02:00
|
|
|
|
2017-10-19 08:29:20 +02:00
|
|
|
void setUseMulti(bool on);
|
|
|
|
|
void setAttachPid(Utils::ProcessHandle pid);
|
|
|
|
|
|
2017-05-09 10:25:11 +02:00
|
|
|
private:
|
2017-10-19 08:29:20 +02:00
|
|
|
Utils::ProcessHandle m_pid;
|
|
|
|
|
bool m_useMulti = true;
|
2017-05-09 10:25:11 +02:00
|
|
|
};
|
|
|
|
|
|
2019-12-13 10:30:30 +01:00
|
|
|
extern DEBUGGER_EXPORT const char DebugServerRunnerWorkerId[];
|
2017-05-09 10:25:11 +02:00
|
|
|
extern DEBUGGER_EXPORT const char GdbServerPortGathererWorkerId[];
|
|
|
|
|
|
2011-01-10 10:35:41 +01:00
|
|
|
} // namespace Debugger
|