Commit Graph

625 Commits

Author SHA1 Message Date
Marc Mutz
8eb4d52342 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
2022-10-07 13:47:53 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Marcus Tillmanns
e31d7b227e Debugger: Fix crash when showing characters > 0x7FFFFFFF
Change-Id: If9e1e235ea7b5288a29ca8f3a17e75dea3c57978
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-08-11 13:52:29 +00:00
Marcus Tillmanns
3af72077a0 Debugger: Fix crash when showing characters > 0xffff
Change-Id: I8eb1492f7ba9fbe846e18e7e93bd8ca57edf177d
Reviewed-by: hjk <hjk@qt.io>
2022-08-11 07:57:37 +00:00
Jarek Kobus
1b070bcb11 Drop Qt5: Debugger: Get rid of QOverload
Change-Id: Ic62a3173adeffdfa78a47849cf1ceaa4f59b8091
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-07-20 13:13:21 +00:00
Thiago Macieira
d4ed6d6129 Debugger: force qfloat16 to float to print
It'll get a _Float16 cast operator, which will cause ambiguous overloads:

watchhandler.cpp:782:24: error: ambiguous overload for ‘operator<<’ (operand types are ‘std::ostringstream’ {aka ‘std::__cxx11::basic_ostringstream<char>’} and ‘qfloat16’)

Change-Id: Ic44396b31ba04712aab3fffd16ff43d6616878f9
Reviewed-by: hjk <hjk@qt.io>
2022-07-09 05:44:00 +00:00
hjk
9894c6eaf0 Debugger: Convert to Tr::tr
Change-Id: I5d2475c790851c68f9997ac6af72b5eaca58482d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-07-08 12:32:38 +00:00
hjk
d3786a895b Debugger: Use some Tr::tr in WatchModel related classes
Change-Id: I1fcd0c5f342da4fd5ff52c19eb9f3f20a9bdcc5b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-07-07 08:52:11 +00:00
hjk
d1b7e90b7d Use Utils::setClipboardAndSelection() more often
Change-Id: I094f07cdb1e5e8c8026bb36d0a486719567641b9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-20 13:41:12 +00:00
Evgeny Shtanov
3b373eecd4 reformatCharacter: int to QChar conversion segfault
Debugger, watchhandler: incorrect type conversion:
Converting from `int` to `unsigned int` can lead to a situation where
the result is too large to be represented as a `QChar`.

Task-number: QTCREATORBUG-27107
Change-Id: I7873635f7a1ef29f62339ffe23b4dd84cb089e2b
Reviewed-by: hjk <hjk@qt.io>
2022-06-08 09:56:12 +00:00
Artem Sokolovskii
27fddc8dc7 Debugger: Remove foreach / Q_FOREACH usage
Task-number: QTCREATORBUG-27464
Change-Id: Ib49afb4d0283aeeffead6b31e1a3d0bcb9a7ae14
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-05-03 09:32:04 +00:00
Aaron Barany
03a0ed0786 Debugger: Use queued connection for menu actions
Pass the parent calling object to the addAction() functions and use a
queued connection. This prevents the following sequence of events:

1. The menu is dismissed when selecting a menu item.
2. The deletion gets queued via deleteLater().
2. The onTriggered action gets invoked and opens a dialog box.
3. The dialog box triggers the events to be processed.
4. The menu is deleted when processing the events, while still in the
   event function to handle the dismissal.

This only affected the watch menu since the others were leaked. Added
cleanup handlers for the other debugger menus to avoid leaking them.

Task-number: QTCREATORBUG-26989
Change-Id: Ifa2c52d7bea884c55d43fa545e3e2870301e4052
Reviewed-by: hjk <hjk@qt.io>
2022-02-07 20:20:58 +00:00
hjk
1abe76549e Debugger: Add support for two more floating point display formats
1. The `std::hexfloat` representation produced by `std::sstream`.
2. Breaking the number into a normalized value and a integral power of 2,
   as does the `std::frexp()` function.

M_PI looks like "0x1.921fb54442d18p+1" and "0.785398163397 * 2^2"
respectively.

Fixes: QTCREATORBUG-26793
Change-Id: Ib08ea9408f79201434eb75ec328b94ab933259a4
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-01-14 12:45:42 +00:00
Orgad Shaneh
28334638ab Debugger: Fix MSVC warning
warning: C4305: '/=': truncation from 'int' to 'IntType'

with q[u]int8 template argument.

Change-Id: I0f0063191b0e51ab79f94073ead65da86ea82440
Reviewed-by: hjk <hjk@qt.io>
2022-01-04 12:46:49 +00:00
hjk
e8ae475fcf Debugger: Add a "Char Code Integer"
Fixes: QTCREATORBUG-22849
Change-Id: Id601eb5cbe1211cff595f04b5910a21f1ba33128
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-01-03 12:45:39 +00:00
Andre Hartmann
f9f26570c9 Debugger: Add even more std and Qt char and int types
Make more stdint, quint and char types known to the debugger.

Task-number: QTCREATORBUG-26501
Change-Id: I1e757af2a495142fa37fe2b7cefec56690adbf08
Reviewed-by: hjk <hjk@qt.io>
2021-11-09 13:30:37 +00:00
Jarek Kobus
3562c5e96e Remove unneeded includes of QProcess from cpp files
QProcess wasn't used in these files.

Change-Id: I24900bcf312eb6ea1ca3bc0c753cebb505ec552b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2021-11-01 12:04:41 +00:00
Andre Hartmann
78a1beb06e Debugger: Improve handling of stdint types
* Make (u)intX_t known as integral type
* Handle uint8_t[] the same way as char[] and unsigned char[]

Task-number: QTCREATORBUG-26501
Change-Id: I1eac21be198f8107f088e56daf435b5bb3217120
Reviewed-by: hjk <hjk@qt.io>
2021-10-29 13:12:02 +00:00
Orgad Shaneh
5365dd531b Fix some MSVC warnings
* Implicit conversion of size_t to int
* Comparing bool with operator >

Change-Id: I4bc5bef57bfa0125b1c82953a7a2cfc24066bc8c
Reviewed-by: hjk <hjk@qt.io>
2021-10-15 06:22:23 +00:00
Andre Hartmann
a659f445c7 Debugger: Escape special chars in line annotation
By re-using the existing function quoteUnprintable()
and moving their code as escapeUnprintable() to
watchutils.

In contrast to the watches window, where the escaping
can be disabled by the context menu, the line annotations
are always escaped for simplicity.

Change-Id: I76adfd7cd70ec92ff0d7f7ea41fc30ae0057cad0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-29 11:09:04 +00:00
Miklós Márton
48383c16cb Add context menu to the separate debugger variable view window
Added a right click context menu to the tab bar of the separate
variable viewer window to being able to change the
variable display mode right there (without navigating
to the variable tree view in the main window).

Fixes: QTCREATORBUG-25762
Change-Id: Ida35f4f6d23f07e5ed45a9f2d51a5af970a95375
Reviewed-by: hjk <hjk@qt.io>
2021-05-26 06:57:54 +00:00
hjk
93a5803956 Debugger: Aspectify settings
Change-Id: I527be79965250b82a0928171b17aa93bac9fa2a0
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-03 07:39:17 +00:00
Michael Weghorn
f4dc3fd5c5 Debugger: Prepend '*'s for autodereferenced pointers
If automatic dereferencing of pointers is enabled, the
"Value" and "Type" columns for pointers hold the values for
the dereferenced pointers.

In order to have a consistent behavior for the "Name" column
as well, prepend '*'s to indicate that the variable/expression
has actually been dereferenced.
Add parantheses around the original expression if it doesn't
match a simple regex for variable names, to avoid that the
leading '*' changes the meaning of the expression
(so e.g. a dereferenced 'somepointer + 1' is displayed
as  '*(somepointer + 1)' rather than '*somepointer + 1').

This introduces a new 'autoderefcount' field to propagate the
information how many levels of dereferencing have taken
place from the Python to the C++ side, which is then
used to add the leading '*'s for the display name.

Fixes: QTCREATORBUG-20907
Change-Id: Ia9a41cb42e25ba72a6d980a765dbe2b454deb8c8
Reviewed-by: hjk <hjk@qt.io>
2021-02-22 09:36:45 +00:00
Alessandro Portale
b3686d410d Debugger: Use qAsConst with non-const Qt containers in range-loops
Change-Id: I7bd27f8317b62fe448e037d5a25e78b4c88c648d
Reviewed-by: hjk <hjk@qt.io>
2021-02-17 08:03:09 +00:00
hjk
79ade10c4a Debugger: Add an option to show simple values as text annotations
Change-Id: I726d8559d7e28abd776ce483d5f670be5af09412
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-01-20 09:45:03 +00:00
Alessandro Portale
b2a766a79a Don't access static functions/fields via instance
Courtesy of readability-static-accessed-through-instance

Change-Id: I71f54244f1e091315dac2943d9e1bfad6efa56a9
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-11-19 08:42:14 +00:00
hjk
2bfd515b03 Utils: Allow BaseTreeView users to hide columns manually
... using a context menu on the header views.

Use the feature in the debugger views where it was previously
un-intuitively available as part of the main context menu of
the view, but not in the header.

Task-number: QTCREATORBUG-24384
Change-Id: I3f030c3dd8ce35dc91bad921e37d2273bfe548b5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-11-10 14:28:39 +00:00
hjk
fcaa6801cf Utils: Start replacing SavedActions by QAction or Utils::Aspect
First mechanical step here is to derive SavedActions from BaseAspect
instead of QAction.

Change-Id: I2ec95883b825462c1d867f83cc2b3bd2c2732055
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-05 08:46:27 +00:00
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
Christian Stenger
e9c27cca34 Utils: Fix persisting of QRect
And pass explicitly a QVariant to the writer to avoid
unexpected behavior when trying to store the geometry
of a widget.
This resulted in a warning for any session where the
user had used the debugger at least once.

Change-Id: I5cb2352ab29ff7d2a64c84ffcdf040efe6d04b94
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2020-08-19 07:39:43 +00:00
Eike Ziller
d1a2de747e Debugger: Use dialogParent instead of mainWindow
Slipped through in 5b364de168

Change-Id: If316f7310b3861630b58ef9f8fb152cc30de8ef1
Reviewed-by: hjk <hjk@qt.io>
2020-06-03 11:45:48 +00:00
Christian Stenger
5104798b8c Check for selection support of clipboard
Setting the data on a non-supported MIME data will fail
and get deleted.
Checking beforehand gets rid of a warning printed by
QClipboard.

Change-Id: I5b5a371ce5b904f61a1aed5ea21a98908155357b
Reviewed-by: hjk <hjk@qt.io>
2020-05-14 13:19:18 +00:00
David Schulz
45e7b78dc3 Debugger: Add action to reset individual/type formats
Task-number: QTCREATORBUG-22922
Change-Id: Ic8d0dd1214c208869bebdd69feb2cca1213d30cd
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2020-04-07 07:26:39 +00:00
Eike Ziller
ed5e6a4999 Add some additional shortcuts for actions
Add Cmd+Shift+- for decreasing font size on macOS.
Do not add Cmd+= for increasing size, because it conflicts with the
existing shortcut for "Replace and Find Next".

Sprinkle some Backspace shortcuts in addition to Delete for removing
items. There are (laptop) keyboards that either do not have a designated
Delete key (requiring Fn+Backspace) or where the Delete key is not
conveniently located/sized, and there is no benefit in making the
distinction in that case anyhow.

Fixes: QTCREATORBUG-706
Fixes: QTCREATORBUG-13733
Change-Id: I06274a9810b82800ec6158a883c95d2a7ae2465e
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-03-17 09:39:37 +00:00
hjk
811f4a38da Use less nullptr for empty flags
Change-Id: Ic4eafdc8f204a432a752a97593380609a408a7de
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-01-21 13:28:26 +00:00
Tobias Hunger
5995569063 Debugger: Avoid potential nullptr access
Item may be a nullptr, so do not access it.

Change-Id: I3fdbe30dbbd451027c23c9ed06f08396f0ce215a
Reviewed-by: hjk <hjk@qt.io>
2020-01-20 10:00:36 +00:00
Eike Ziller
e16876df0c Merge remote-tracking branch 'origin/4.11'
Change-Id: Ieb0bb1ebab9a5efb42d15bbeac2cd4c46a6de962
2019-12-18 09:14:14 +01:00
Christian Stenger
e3338f2e8a Debugger: Avoid accessing nullptr
If the context menu is spawned while stepping
the user may be able to trigger some actions
that try to access an item that had been present
before, but after the stepping the items inside
the tree view usually got completely re-created.

Change-Id: I80029bc1272cfc8b78fe0ed5b1e0f36f29920631
Reviewed-by: hjk <hjk@qt.io>
2019-12-17 08:10:03 +00:00
hjk
4bd26c3e4b Debugger: Add ability to hide view columns
Not perfect, e.g. one would probably expect the items to
appear in the context menu of the header views, too, not
just on the main background of the view, but better than
nothing.

Task-number: QTCREATORBUG-23342
Change-Id: Ifdc44dcfd390112faa7b15bb8a51d809e42d7b29
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-12-13 08:07:31 +00:00
David Schulz
6325590815 Debugger: Use std style iterator
Change-Id: I6f6593aa18ec9da768876413ef2d5169bce635ca
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2019-11-26 09:45:34 +00:00
zarelaky
7e148d8a07 Debugger: Allow changing item format for all array elements
Change-Id: I05000102d4c6b185340581029006b9254c91fcb1
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2019-11-25 10:52:33 +00:00
Eike Ziller
a19d905ea5 Merge remote-tracking branch 'origin/4.10' into 4.11
Change-Id: I9b53d00dbc79d52e52f6e18761e6a6c6faec6c84
2019-10-08 15:21:12 +02:00
Antonio Di Monaco
f0bd0a8baf Debugger: Fix missing watch highlight when the value changes
This patch fixes a regression introduced by
e95fd876aa

Change-Id: I8cb277858ef6c63cd26c03417f9dfeb99d96cb45
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-10-08 08:11:20 +00:00
Eike Ziller
ac014e3875 Merge remote-tracking branch 'origin/4.10' into 4.11
Conflicts:
	src/plugins/projectexplorer/projectnodes.h

Change-Id: I10a749cca38c2d0929cf4d2b74ab089e14b6157b
2019-10-02 07:32:57 +02:00
hjk
312ff692b0 Debugger: Do not crash when displaying uninitialized QImages
Fixes: QTCREATORBUG-23031
Change-Id: I074cdaf509edac6e5659d2e976ed7188e8944d81
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-10-01 14:57:14 +00:00
Eike Ziller
21c2bf7e72 Merge remote-tracking branch 'origin/4.10'
Conflicts:
	src/plugins/python/CMakeLists.txt

Change-Id: I18808710dd99b97d4e1e7c3d223b7f814083de31
2019-08-12 17:04:12 +02:00
Eike Ziller
63c9c5124e Use common functions for handling ampersands/accelerators
Change-Id: I4c74a041a656ed547db0a7406f4306008a513879
Reviewed-by: hjk <hjk@qt.io>
2019-08-09 12:45:38 +00:00
hjk
e3b1106afa Compile fix with recent Qt dev
The reasoning in 1b4766e26c did not take into account that the scope
of QT_NO_JAVA_STYLE_ITERATORS may change over time, as done with
f70905448f6 in Qt base.

Change-Id: Ib1966ff26c4d36d5f62e149d6b45baa4aecf825d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-29 08:54:18 +00:00
hjk
32bbf2a3b3 Debugger: Introduce a tree level above stack frames
This level is meant to take the role of current thread handler
in the long run, allowing per-thread stackviews in each engine.

For now, the additional level holds just a single, invisible
dummy item playing the role of a "current thread".

Change-Id: Ief6131500fc1aa8902f2313038a65840b80b495b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-06-26 06:58:03 +00:00
hjk
e95fd876aa Debugger: Make the time stamp recording option work for single items
Should help to drill down to individual expensive dumpers.

Change-Id: I983ba075231784f71dd9d5c3bda375a3ee508bf6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-04-12 08:32:52 +00:00