Commit Graph

20 Commits

Author SHA1 Message Date
hjk
3b5ecac238 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-08-17 12:35:15 +00:00
hjk
1567679b81 Debugger: Tighten Perspective interface
Pass id in constructor, so it can be const.

Change-Id: Id33fe19c4416109af8aa05a3ed0a09918eeb5cdf
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-08-13 08:42:52 +00:00
hjk
f45f1a8cef Debugger: Make perspective toolbar items part of the perspective
This simplifies the toolbar setup and removes the need for the
stack of toolbar widgets.

The actions themselves have been owned by the plugin already,
so nothing changed in this respect.

Change-Id: I44754e16c8fc2acc53633dd9d560b1e732eece27
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-08-06 11:12:44 +00:00
hjk
e9eb1a6437 Debugger/Perspectives: Go back to QPointer<QObject>
Lifetime of the pointed-to object may end before that of
the plugin, so unique_ptr is the wrong choice.

This amends 01f2b982a2.

Change-Id: I76b9ac78348d2ae1e7eff0693b091dbe8475ab93
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-08-02 08:56:20 +00:00
hjk
01f2b982a2 Debugger: Move ownership of perspective dock widgets to plugins
Similar to the previous patch, but affecting more plugins: with dynamic
perspectives lifetime is better managed close to the code that knows how
to (re-)construct the items.

Change-Id: I0e7bfcf769d198ec2afa88b972be900baa1b6a46
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-08-01 11:27:21 +00:00
Ivan Donchevskii
be3e848c0f Clang: Don't analyze same file multiple times
Diagnostics do not depend much on project parts. But
having the same file twice can result in duplicated
diagnostics which later can cause the same fix-it
being applied twice and getting corrupted code.

Change-Id: Ie2809af7a54034b05df9383875f7c3123aea58e8
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-06-28 12:50:34 +00:00
Ivan Donchevskii
e99d09f846 Clang: Properly apply fix-its from header files
Diagnostic may also include fix-its for the header
which require different handling.

Task-number: QTCREATORBUG-20517
Change-Id: I3e745622801be3fa2856d968b0c7a2a2aeb89b50
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-06-28 09:11:49 +00:00
Ivan Donchevskii
2d97b5950c Clang: Add checkbox for fix-its column header
Make possible to select or deselect all fix-its.

Change-Id: I2ff88afb0c451092752ee2cd7c9f083e24033500
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2018-06-21 13:10:40 +00:00
Nikolai Kosjar
c6f12991b0 ClangTools: Avoid freezing UI for many items
...if new items are added to the model or if filter is used.

When items were added, we have called
ClangToolsDiagnosticModel::diagnostics() two times:
 * from DiagnosticFilterModel::filterAcceptsRow()
 * from ClangTidyClazyTool::handleStateUpdate()

However, this does not scale since diagnostics() creates a temporary.

Fix this by accessing the diagnostics or the count directly from the
tree.

Change-Id: I4c6a32e0076c1b4228ed1b1ff9222c9918f92c5c
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-29 12:51:51 +00:00
Nikolai Kosjar
bae61e08ea ClangTools: Fix applying fixits one by one
If a file had multiple fixits and only a subset was applied, the
remaining fixits in that file were invalidated. Fix this by adjusting
the locations of the not yet applied fixits.

Change-Id: I2c190412e871e9011c4d4a62ed938e76ad4cdf72
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-28 13:54:54 +00:00
Nikolai Kosjar
595f6980b7 ClangTools: Reflect state of fixits
...in the fixit column to avoid confusion.

As a side effect, add some error handling.

Change-Id: Ia30e9c9782f3c8021aedd2be7c682853a26d3f39
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-23 10:47:47 +00:00
Nikolai Kosjar
f083293c31 ClangTools: Adapt button state to checked fixits
"Apply Fixits" is disabled by default and enabled as soon as some fixits
are checked by the user.

Change-Id: I7e1345512b206f52d1e8628705c81c6b34dfb9ba
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-18 06:28:07 +00:00
Nikolai Kosjar
26b09af277 ClangTools: Allow applying fixits
Add a new column to the view that allows to check diagnostics with
fixits. The checked fixits can then be applied with the also new "Apply
Fixits" button in the toolbar.

Some corner cases are not yet handled:
 * File is open in editor
 * File changed in the mean time

Change-Id: I3d3f353a4150699a0d082f2a4348e331a4213bcf
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-16 07:10:39 +00:00
Nikolai Kosjar
887a0538cd CppTools: Allow filtering issues with line edit
...matching diagnostic text/description. Child items are excluded.

Change-Id: Ie7c50af59e0836f60b2ca3bbe50b11eb19398c61
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-15 13:29:53 +00:00
Nikolai Kosjar
9b74948a61 ClangTools: Allow selecting diagnostic config for project
When starting the Clazy/Tidy tool, allow to select the diagnostic
configuration for the run.

As a side effect, fix a race condition where the runner could end up
with no diagnostic config (removed during run) - copy the diagnostic
config instead of referencing/querying it by the id.

Change-Id: Iedafa8f31a3bbd233d65818fe8de16add1e4d443
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-15 07:26:22 +00:00
Nikolai Kosjar
5b5ff37b6f ClangTools: Add next/back buttons also for tidy/clazy
...copy/pasted from the static analyzer tool, which will vanish soon.

Change-Id: I33b6fb8519f9b84d0af3b5ca12c33d66d510c6bb
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-11 12:08:27 +00:00
Nikolai Kosjar
a10cd337c7 ClangTools: Rename some classes and files
...to some more generic names since they are not anymore specific to the
clang static analyzer.

 * ClangStaticAnalyzerDiagnosticView --> DiagnosticView
 * ClangStaticAnalyzerDiagnosticFilterModel --> DiagnosticFilterModel
 * ClangStaticAnalyzerPreconfiguredSesssionTest -->
    PreconfiguredSessionTests
 * clangstaticanalyzerprojectsettingswidget.* -->
   clangtoolsdiagnosticwidget.*

Change-Id: Ifd34f207d31dc24d6a97654aca76ff27b5025547
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-11 12:08:20 +00:00
Nikolai Kosjar
92ea3c93af ClangTools: Allow suppressing diagnostics for tidy/clazy
...copy/pasted from the static analyzer tool, which will vanish soon.

Change-Id: Ibbdd402b66af35b268896eff420bd1c6597d9ced
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-11 12:08:10 +00:00
Nikolai Kosjar
1bc605d050 ClangTools: Prompt for files to analyze
If the run button is clicked, the user is prompted to select the files
for analysis.

Change-Id: I21e4ee6b7c14392a8c1a901ac7aa1c9c16e30f0d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-11 10:48:53 +00:00
Ivan Donchevskii
219e23332e ClangTools: Add tool that runs clang-tidy and clazy
... over the whole project.
Generate and read serialized files to get diagnostics.

Change-Id: Iafc25fc70443107a040a995efc038aed35102bbf
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-04-26 13:02:19 +00:00