blob: c236ab32f240d5af434e48ab56591d0423c4377f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
// Copyright (C) 2016 Denis Shienkov <denis.shienkov@gmail.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "baremetaldebugsupport.h"
#include "baremetalconstants.h"
#include "baremetaldevice.h"
#include "baremetaltr.h"
#include "debugserverprovidermanager.h"
#include "idebugserverprovider.h"
#include <debugger/debuggerkitinformation.h>
#include <debugger/debuggerruncontrol.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <utils/portlist.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
using namespace Debugger;
using namespace ProjectExplorer;
using namespace Utils;
namespace BareMetal::Internal {
class BareMetalDebugSupport final : public Debugger::DebuggerRunTool
{
public:
explicit BareMetalDebugSupport(ProjectExplorer::RunControl *runControl)
: Debugger::DebuggerRunTool(runControl)
{
const auto dev = qSharedPointerCast<const BareMetalDevice>(device());
if (!dev) {
reportFailure(Tr::tr("Cannot debug: Kit has no device."));
return;
}
const QString providerId = dev->debugServerProviderId();
IDebugServerProvider *p = DebugServerProviderManager::findProvider(providerId);
if (!p) {
reportFailure(Tr::tr("No debug server provider found for %1").arg(providerId));
return;
}
if (RunWorker *runner = p->targetRunner(runControl))
addStartDependency(runner);
}
private:
void start() final
{
const auto dev = qSharedPointerCast<const BareMetalDevice>(device());
QTC_ASSERT(dev, reportFailure(); return);
IDebugServerProvider *p = DebugServerProviderManager::findProvider(
dev->debugServerProviderId());
QTC_ASSERT(p, reportFailure(); return);
QString errorMessage;
if (!p->aboutToRun(this, errorMessage))
reportFailure(errorMessage);
else
DebuggerRunTool::start();
}
};
BareMetalDebugSupportFactory::BareMetalDebugSupportFactory()
{
setProduct<BareMetalDebugSupport>();
addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE);
addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE);
addSupportedRunConfig(BareMetal::Constants::BAREMETAL_RUNCONFIG_ID);
addSupportedRunConfig(BareMetal::Constants::BAREMETAL_CUSTOMRUNCONFIG_ID);
}
} // BareMetal::Internal
|