Commit Graph

112 Commits

Author SHA1 Message Date
Eike Ziller
2a70bc1d09 Debugger: Fix build with Qt6
QStringRef gone.
ViewOptions changed.
MetaType register stream operators automatically.

Task-number: QTCREATORBUG-24098
Change-Id: Ibf98561af951aa5fc4ec483d18dafeaad02e07c3
Reviewed-by: hjk <hjk@qt.io>
2020-09-18 14:41:20 +00:00
hjk
430a33dcd9 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-07-06 06:07:13 +00:00
hjk
5dd2985a65 Debugger: Use QRegularExpression in QmlInspector
Change-Id: Ib359738c07a5531fe66656bce5ad42c39e4a9ab2
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2020-06-24 06:28:13 +00:00
Alessandro Portale
24a25eed14 Use isEmpty() instead of count() or size()
Change-Id: I0a89d2808c6d041da0dc41ea5aea58e6e8759bb4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-01-20 20:56:57 +00:00
Alessandro Portale
9904464074 Make various Q_LOGGING_CATEGORY's static
Change-Id: I43d3a198b0863d85a7fb305c7cb768f68acbd139
Reviewed-by: hjk <hjk@qt.io>
2020-01-15 14:54:10 +00:00
Ulf Hermann
2808f633ec Debugger: Further robustify QmlInspectorAgent
When (re-)querying the root contexts, make sure we clear the old queries
first. One of the QML engines in the target may have created an object,
causing the contexts to be re-queried while queries for other engines
are still running. This would cause mismatches between the m_engines and
m_rootContextQueryIds arrays. In turn, in onResult() we would access an
invalid index in the m_engines array. Furthermore, make the assert that
guards against such an invalid access a QTC_GUARD and log the pending
queries before they are cleared.

When the target replies to the now-invalid root context queries we will
end up in the default branch of onResult,
m_qmlEngine->expressionEvaluated(), and that one silently ignores
unknown query IDs.

Task-number: QTCREATORBUG-22654
Change-Id: I1fe4751ea3592eb26c494696bea3d84fa3e62617
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2019-12-02 11:09:35 +00:00
Orgad Shaneh
2aca0c1b28 Fix MSVC warnings
* Missing `this` captures
* Implicit size_t -> int conversion
* Unused argument
* Suppress warnings in clang headers

Change-Id: I7083ce6ab22ee22ecc1258539e77c790acc78df1
Reviewed-by: hjk <hjk@qt.io>
2019-09-11 15:20:34 +00:00
hjk
a6d3101207 Debugger: Robustify QmlInspectorAgent::onResult
Task-number: QTCREATORBUG-22654
Change-Id: I4bf0a17581ff3fcdc1a0b6dd9eb21fd2cf9b756c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-07-05 08:44:39 +00:00
hjk
317ab49793 Debugger: Code cosmetics
Move some constants to internalconstants.h or remove them entirely.

Change-Id: Iecd4def3b48130fb390bddf420da672d44e3d6b8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-02-21 07:56:58 +00:00
Alessandro Portale
710e57a628 Fix warning: "Use midRef() instead of mid()"
[-Wclazy-qstring-ref]

Change-Id: If8a0844b39377feb3772542559655854a92b93cd
Reviewed-by: hjk <hjk@qt.io>
2019-01-17 13:00:37 +00:00
Ulf Hermann
ba94e9eb01 QML Debugger: Do fetch engine properties
The properties of the engines themselves are interesting. However, in
order to properly display the engines, we need to always update the root
context for an engine after we update its properties. This is a good
idea anyway because there might be a reference to the engine somewhere
else in the object tree, and accidentally updating the engine would
clear its root context.

Change-Id: If905f4c32ba37106b5620b5af0e157e19ef8b295
Reviewed-by: hjk <hjk@qt.io>
2018-11-22 14:02:11 +00:00
Ulf Hermann
0eca4bce72 QML Debugger: Fix object hierarchy
Make sure to always find the correct parent and engine IDs for objects
to be inserted, and that root objects are always added as children of
their engines. As the root objects don't show up in the engine's
children(), but we adjust the root objects' parent IDs to point to the
engines, the root objects were sometimes shown as children of the
engines, and sometimes as top level root objects.

Furthermore, make sure not to fetch any parents of engines. Otherwise we
get a much more complicated object hierarchy than what we actually want
to see, and the invariant that each engine is at the root of the tree
breaks.

Change-Id: I6967f0b369149a8d6db3ab89f1479c942f6fcbf7
Reviewed-by: hjk <hjk@qt.io>
2018-11-22 14:01:46 +00:00
Ulf Hermann
eac0ab4974 Debugger: Add multi-engine support for QML inspector
The engines are listed as virtual root items for their contents. This
way, when we need an engineID we can walk up the tree of watch items and
the last valid one will be the engine.

Fixes: QTCREATORBUG-21486
Change-Id: Ib110457dc65523c1e2b75aa073f6cd399bbc9532
Reviewed-by: hjk <hjk@qt.io>
2018-11-21 10:48:02 +00:00
Ulf Hermann
2e6aa7a0ed QML Inspector: Use lists of int as selections
The inspector service natively supports multi-selection. Instead of
converting between multi and single selection all the time, just use the
multi selections and only collapse to one row when interacting with the
view.

Change-Id: Ie969225f955c61b306cfbec4973ffc724ef1e224
Reviewed-by: hjk <hjk@qt.io>
2018-11-20 14:05:08 +00:00
Ulf Hermann
d29e7a0371 QML Inspector: Simplify
Since we don't need to support the Qt Quick 1 clients anymore, we can
drop some code.

Change-Id: I7afcad8024392f058a35b3ed0d28d2172587552a
Reviewed-by: hjk <hjk@qt.io>
2018-11-20 14:05:02 +00:00
Ulf Hermann
40ad7ec995 QmlDebug: Remove outdated clients
The declarative* clients are only used with Qt Quick 1. We don't need
them anymore.

Change-Id: I102fe93b3acd4b23cc01aff5eb9f12540625fe5e
Reviewed-by: hjk <hjk@qt.io>
2018-11-19 08:27:25 +00:00
Eike Ziller
511bd64f3f Merge remote-tracking branch 'origin/4.8'
Change-Id: I0ff6f659b7ccd4ff5a79e422a1d54488508fe05f
2018-10-16 07:11:57 +02:00
Orgad Shaneh
bdc2b4b59f Remove hard-coded disabling of debug logs
Instead, set the default level of all logs to QtWarningMsg.

The call to setFilterRules overrides the user preferences in qtlogging.ini.

Change-Id: Id5f6cd550d14ff7f45ae04c5d3110e0bafb0f072
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-10-13 16:36:58 +00:00
Orgad Shaneh
147a3c27c4 Debugger: Strip QLatin1* where possible
Change-Id: Idcab23875b5dc2ecf55e3303f417b995e2252720
Reviewed-by: hjk <hjk@qt.io>
2018-10-13 16:32:31 +00:00
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
Alessandro Portale
0558db7b54 Debugger: Modernize
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init
modernize-use-equals-default

Change-Id: I91a6874f0d7b94e9079ab4ef07c23c60c80be9c0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-25 12:52:43 +00:00
Eike Ziller
c585e7091b Merge remote-tracking branch 'origin/4.7'
Change-Id: Ib288796892faf5345d2a150a5ce0dadf91552924
2018-06-04 16:33:03 +02:00
hjk
4feb2259d9 Debugger: Code cosmetics
Sprinkling in const and ranged for.

Change-Id: I5d11d57f64140021397c23734c7373544ebebb6f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-05-31 07:10:47 +00:00
Ulf Hermann
a5ec1097a0 Debugger: Support nested properties in QML inspector
There are various ways to generate nested arrays and objects in the QML
engine debug service. We can easily show them.

Task-number: QTBUG-68474
Change-Id: I3511a3f6f7631de4ab6a9d4b13ba9392ba4173dc
Reviewed-by: hjk <hjk@qt.io>
2018-05-29 12:55:51 +00:00
hjk
d47fdb934d Debugger: Change semantics of DebuggerEngine::masterEngine()
Make it return 'this' if 'this' is the master engine itself.
Adapt users.

Also do not let the QmlEngine try to beginConnection() when
the combined engine was isDying() already.

Change-Id: I308deae14a3c4966be381f321c0d9dfaf82c40d6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2017-12-15 11:50:01 +00:00
hjk
78513ecd8f Debugger: Split Expressions view into dock of its own
Change-Id: Ie86a5bd72c3140219f925835a065d9f6a3ae0ea4
Task-number: QTCREATORBUG-19167
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-11-06 11:53:57 +00:00
Ulf Hermann
eeb0358d65 Debugger: Re-add quotes to JS strings after editing
The quotes are stripped when the string is presented for editing, so
they have to be added back when we're done editing.

This is what we already did if we were talking to the inspector rather
than the V4 debugger.

In order for this to work, JS numbers need to be identified as numbers,
rather than strings. So, we have to add "number" to the types recognized
as float.

Change-Id: I2054f4ad36ec1d14fb2dfee3705a80c8ec84d5ac
Task-number: QTCREATORBUG-19032
Reviewed-by: hjk <hjk@qt.io>
2017-10-17 09:47:51 +00:00
hjk
a37c8add58 Debugger: Fix QmlInspector state update connection
Change-Id: I1693d593ec08c14c48b2c2800ce2f240f9e5f438
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-05-19 13:07:01 +00:00
hjk
e213585910 Debugger: Move part of engine startup to preparation phase
Change-Id: I414c356cd615096ee68588b839aaf975657fb7f9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-05-02 08:49:58 +00:00
Ulf Hermann
1df4757dae Qml Inspector: Don't ignore anonymous objects
Apparently the inspector service does not send a type string for all
objects. As the id string and the object name can also be empty, those
objects are anonymous then. Try to identify them by their source
location and if that doesn't work, just call them "<anonymous>".

Change-Id: I3bd3bad8b78c81ace95bfd7813cdd8bb0f5e14f2
Task-number: QTCREATORBUG-17741
Reviewed-by: hjk <hjk@qt.io>
2017-03-16 15:56:12 +00:00
Ulf Hermann
f94bb76eac QmlInspector: Refresh the view when SortStructMembers changes
This has the effect of sorting the members immediately, rather than
the next time something else changes.

Change-Id: I3f3cb261f1fb69b6b36914b811a431b045bb49ae
Task-number: QTCREATORBUG-16645
Reviewed-by: hjk <hjk@qt.io>
2016-11-03 15:13:27 +00:00
hjk
2b9edb35ea Debugger: Slim down public QmlInspectorAgent interface
Change-Id: Ia2f728029530dfe4e3f4cc9c18313453f4851bc4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2016-08-04 10:51:40 +00:00
hjk
7e73e9c48f Debugger: Remove unused WatchItem::state flag
Lately it was only set and read for debugging purposes. A mechanism
similar to the ChildrenNeeded state is still needed and available
through WatchItem::wantsChildren.

Change-Id: I78c85d65bc35810be420bd0418db9675473697cd
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2016-08-03 11:29:23 +00:00
Ulf Hermann
96e877d3ca Qml Inspector: Sort watch items if SortStructMembers is set
Change-Id: I94f3a9c24df52c1a5689ea6e73d81a526d12bdc4
Task-number: QTCREATORBUG-16645
Reviewed-by: hjk <hjk@qt.io>
2016-07-22 07:51:32 +00:00
Erik Verbruggen
ae7e03d51f Fix compilation.
There is no + operator that takes a QByteArray and a QString (or vice
versa).

Change-Id: I8734923cbbb0360bc20f9775d57801803782716f
Reviewed-by: hjk <hjk@theqtcompany.com>
2016-06-09 09:47:15 +00:00
hjk
726b907cc3 Debugger: Remove debuggerstringutils.h
With QT_RESTRICTED_CAST_FROM_ASCII making GdbMi etc operate on
QString is feasible again. Take this as opportunity to move
debugger encoding handling closer to a 'conversion on input and
output if needed, storage in QString only' scheme.

Change-Id: I2f10c9fa8a6c62c44f4e6682efe3769e9fba30f7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-06-09 08:09:46 +00:00
Tobias Hunger
397e7f4843 Update License according to agreement with Free Qt Foundation
* Update files in src/plugins

Change-Id: Ia5d77fad7d19d4bb3498e78661982f68729adb22
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:57:01 +00:00
hjk
7de7eb6bca Debugger: Work on WatchModel performance
Don't instantiate repeating boilerplate item data in some
cases (such as large arrays).

This makes it necessary to access parent WatchItems in
a lot more cases than before and needs another separation of
WatchItem/WatchModel code to keep the dumper autotests
in a functional state.

For a plain std::vector<int> with 1 mio items this reduces
 extraction time from more than 2 minutes to about 3 seconds.

Change-Id: I175c5f6ee90434a6e85342d8bb71bd10a04dd271
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2016-01-06 09:59:11 +00:00
Ulf Hermann
aeaddda37d QML Inspector: Don't misinterpret objects with ID 0
The invalid ID is -1 and we shouldn't send 0 to the engine debug
service by default as that will select some random object as context
for expression evaluation.

Change-Id: Ide245468f787cc449ff50ac846c7ff31620c01b4
Task-number: QTCREATORBUG-14931
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-12-15 11:34:04 +00:00
Ulf Hermann
d039237660 Qml Inspector: Implement and use setObjectIdList()
This way the items highlighted in Qt Creator are also marked in the
application when the inspector is active.

Change-Id: I89c3270cf5c108c1549ea01704bfd0e4b7a44ca5
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-12-09 10:33:02 +00:00
Ulf Hermann
f8f60a343b Qml Inspector: Add some coding style
Change-Id: I94e0c19734bee06531756df21aee26354a5aeaeb
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-12-09 09:19:09 +00:00
Ulf Hermann
47317eff60 QmlDebug: Rename some members of QmlDebugConnection
This is to adopt the naming to the code in src/qmldebug in
qtdeclarative. Once we can require a version of Qt that has qmldebug
for building QtCreator we can then remove our own version of this code.

Change-Id: I573f0703871b5812789c5c7a6287567d5c2875e6
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-11-19 11:32:42 +00:00
Christian Stenger
d11fc7bd72 Debugger:QML: Fix compile for Qt5.4
Change-Id: I5526dcd0ea5ba52675ae451721657ce003eab365
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-09-01 14:26:08 +00:00
Eike Ziller
3b1a966cc8 Merge remote-tracking branch 'origin/3.5'
Change-Id: Iebaabfc2f724cd493b7cab025406531cea5cd2dc
2015-09-01 12:57:51 +02:00
hjk
156320ff6c Debugger: Merge QmlInspectorAdapter into QmlInspectorAgent
There's a 1:1 relation, and the abstraction is not needed anymore.

Also remove some unused code.

Change-Id: I09a2522deb5d522f46ec7518d19978a038032fbb
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
2015-08-28 07:37:19 +00:00
hjk
fdbee2783a QmlInspector: Fix crash on engine ramp down
Task-number: QTCREATORBUG-14972
Change-Id: Ia2a508fab872ac4496c2cb3fa932186e8e29278d
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-08-26 10:44:59 +00:00
hjk
69bf5e4319 Debugger: Expand items in QML Inspector on first click
Task-number: QTCREATORBUG-14210
Change-Id: I4c4409476467bb7008cb6806018371e9134437a9
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-07-10 07:43:29 +00:00
hjk
d920ed9115 Debugger: Fix QmlInspector column width
Task-number: QTCREATORBUG-14192
Change-Id: Ic462bbcf07dc3c683b86e65628bae7ac8ac9249a
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-03-27 10:05:28 +00:00
hjk
b3f88df41d Debugger: Remove most remaining occurrences of WatchData
... in WatchHandler and DebuggerEngine interface.
Adjust using code.

Change-Id: I6371f3e96ba46a783e23a5767cdde24a10d3fce7
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-03-20 08:36:57 +00:00
hjk
b08e5a9bc3 Debugger: Reduce QML engine <-> watch handler interaction
Change-Id: Ia00f0747f40b18e99da2a7824d3e490291ab0b23
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-03-20 07:23:20 +00:00