Commit Graph

1446 Commits

Author SHA1 Message Date
hjk
6aab6f61b5 Debugger: Provider Qt version externally to bridges
Extracting within the bridges is expensive.

Change-Id: Icf69db4b112230cc23e331abc0b3eb0de1323f46
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-05-16 10:03:08 +00:00
Michael Weghorn
23b7ac84a9 Debugger: Use integer from native GDB value for typedef
Extend the solution from

    commit d86cf5e235
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Thu Sep 24 12:02:06 2020 +0200

        Debugger: Retrieve and remember int from native GDB value

to also retrieve the int representation for numeric values
from the corresponding native gdb.Value if a typedef to
an integer or bool type is used, not only when an integer
type is used directly.

This makes expressions for bifield members in the
debugger's expression view show the correct value
when the type of those bitfield members is a typedef
to an integer type.

Extend the "Bitfields" dumper test accordingly.

One real world example where incorrect values were
previously shown is GtkWidgetPrivate from the
GTK library [1].

[1] ebc84a6185/gtk/gtkwidgetprivate.h (L39-76)

Change-Id: Ib39e00ebbfc8d7d9ab10dc89af61f37ec41fb4ee
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-05-08 06:29:35 +00:00
hjk
67072d3f5b Debugger: Re-work bridges
The type cache has been split into smaller caches for individual
aspects. Type ids are now integral, not strings.

In addition, there is new supporting code for logging, timing and
profiling

Change-Id: I6db72a149650d42aecf8b899869c542b1303d43b
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-05-07 10:15:34 +00:00
hjk
de3841f138 Debugger: libc++ 16 dumper for string
Change-Id: Ic3eed66d7af54a0251ec58886b68dda611682bef
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2024-05-06 09:47:31 +00:00
Eike Ziller
a79f02ca4a Merge remote-tracking branch 'origin/13.0'
Change-Id: I77d3656aec10063a90095d5299b85304692d8b32
2024-05-06 08:14:24 +02:00
hjk
d3fb3a163c Debugger: Ignore stops in libart.so and other Android runtime specific places
From https://issuetracker.google.com/issues/240007217#comment17
"Some a background on the technical aspect of SEGVs:

Android Runtime (ART) uses SEGV for various internal purposes (it
triggers a SEGV and handles it without crashing the app, the app doesn't
know it happened). When the native debugger is connected, the debugger
must intercept all SEGV signals.

When running the debugger on Android API level 27 and newer, we make the
debugger skip these SEGV signals (i.e., forward them to be handled by
ART), because we know how to handle real SEGV signals inside ART.  For
older Android versions (26 or older), we did not have this support, so
the debugger stops at every SEGV (i.e., it cannot know if the signal is
a real crash or an ART-internal thing)."

Arguably, this should be caught by the LLDB Android platform bits, but...

Task-number: QTCREATORBUG-30759
Task-number: QTCREATORBUG-29928
Task-number: QTCREATORBUG-30080

Change-Id: I8cabe4a0675c596a9617520aff0d62ad11321f0e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2024-05-02 15:36:26 +00:00
hjk
b74f871b5b Debugger: Add a helper to visualize dumper profile data
A stripped-down and modified version of pyprof2calltree.

Change-Id: I9e37a4e13f312b40144394572ef6603bb2161487
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2024-04-16 07:14:16 +00:00
hjk
2a1d46bbfc Debugger: Move python2 supporting files out of normal bridge directory
They get in the way when working in that area.

Change-Id: Id59c83472a6ce093ca9b31ad9e94ec638b4a1df8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2024-04-08 08:25:08 +00:00
Robert Löhning
0cca4b283b Debugger: Fix calls to calloc
Change-Id: Id1ba0c4656eb611b6ac4269ebf9d141feb08d632
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-04-03 14:38:44 +00:00
hjk
87ca7882c1 Debugger: Fix QPair dumping
Task-number: QTCREATORBUG-30538
Change-Id: Iee17aec458d9ab69cd4349bedb26b1a2270ca41c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-03-19 16:00:23 +00:00
hjk
4ca8ad8293 Debugger: Fix breakpoint settings in assembler for LLDB
Setting the breakpoint actually worked, but it was reported back
using a wrong address, so it never went "red" in the disassembler view.

Change-Id: I4c2bd808705dfe793c0febf29b3e78b318dbae00
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2024-02-28 16:28:16 +00:00
David Schulz
a57a925b76 Debugger: defer type look up
Change-Id: I425c2bfc3c88ebf46af161c5434c0c05a3bb9c97
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2024-02-27 11:32:53 +00:00
David Schulz
88aacbb562 Debugger: fix char type dumper optimization
Change-Id: I600f4ddc9a4539e19b70664fd9354c17e64cd0d6
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2024-02-21 07:56:43 +00:00
David Schulz
c76fc8e1e5 Debugger: fix dumping char arrays
The calculation for the size of the memory to fetch for the dumper was
missing the char size information.

Amends a26aff7afd

Change-Id: I8ceb127efaf7effa94fc53e6782f75580ab8cdb4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2024-02-21 06:00:24 +00:00
hjk
a26aff7afd Debugger: Report full sizes instead of the elide setup
More direct communication of the meaning. Use 'length' when talking
about things like string lengths, and 'size' for sizes in bytes.

Task-number:  QTCREATORBUG-30065
Change-Id: Ifed84a5dab4ed890973c1abf4d427655eb50a61a
Reviewed-by: David Schulz <david.schulz@qt.io>
2024-02-13 17:01:23 +00:00
Michael Weghorn
4aaf7f2689 Debugger: Add debugging helper for std::tuple
Add debugging helper for std::tuple and add
a corresponding dumper test for it.

With this in place, the std::tuple variable and its elements
in the "tuple.cpp" sample program from QTCREATORBUG-25865 are
shown as expected on both, Linux (libstdc++) with GDB or LLDB and with
an MSVC build with CDB on Windows.

A debugging helper for libc++ had already been added in commit
34ff9c97e6.

Task-number: QTCREATORBUG-25865
Change-Id: I24b3d36b5daa26fd4fcb073c4df79015dfe752fc
Reviewed-by: hjk <hjk@qt.io>
2024-02-12 11:55:18 +00:00
David Schulz
a6eb6dd909 Debugger: try harder to find static meta object
Improves dumping of QObjects when the staticMetaObject is defined in a
different module than the object itself.

Change-Id: Ic02103016d14b4925978d8afeaf2dbcc5dcebf85
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2024-02-07 11:25:50 +00:00
Michael Weghorn
941ad80d60 Debugger: Add debugging helper for std::string_view
Add debugging helpers for std::string_view,
std::basic_string_view and std::u16string_view
and add a corresponding dumper test for them.

With this in place, values of the local variables in the
"string_view.cpp" sample program from QTCREATORBUG-25865 are
shown as expected on both, Linux with GDB or LLDB and with
an MSVC build with CDB on Windows.

Fixes: QTCREATORBUG-25865
Change-Id: If8959e3225d9ce7f427a65ff6f1f134d3ad48e91
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-02-07 07:47:13 +00:00
David Schulz
cf1e9db73b Debugger: ignore fields with a null address
cdb reports static members in fields sometimes with a null address.
Ignore those static entries since they cannot be visualized.

Change-Id: I0c58b2d75e95892185051e3c0a8dd9e6217596c3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2024-02-07 03:58:50 +00:00
Ilya Kulakov
05d7070178 debugger: Fix RecursionError when fetching Qt version
When working with statically linked Qt qVersion may not be available.
In that case Qt uses the qtHookData which has type of quintptr.
This type is subject to SyntheticChildrenProvider because lldb
hooks are set up via a regular expression.

When SyntheticChildrenProvider is instantiated, it tries to fetch
Qt version, which causes another instantiation which again recurses.

The fix is to bypass SyntheticChildrenProvider via GetNonSyntheticValue.

Change-Id: Id00cdb3d0a0895bb02e4b3e4504c574d89be2ed0
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-01-31 18:27:50 +00:00
Marcus Tillmanns
2f13651344 Debugger: Handle exception during output read
Fixes: QTCREATORBUG-30267
Change-Id: Iac45a532fc369ad410e78bb8c0516b97858b7af1
Reviewed-by: hjk <hjk@qt.io>
2024-01-30 14:00:21 +00:00
David Schulz
5117ca3280 Debugger: Adjust lldbbridge and test for lldb on windows
Since frame 0 points to the Windows DebugBreak function it does not hold
any usable locals, so we have to pass the correct frame to the
lldbbridge test infrastructure in order to get usable data.

Change-Id: I2595be87a718d73fda3429017efd564e5d0ed9be
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2024-01-03 10:06:21 +00:00
Cristian Adam
aec3e7dbf2 Debugger: Enable lldb with MSVC binaries
This commit will enable running of tst_dumpers on Windows using a MSVC
setup and lldb.exe as debugger.

Change-Id: I17611cc90ba2a04ec21aae11af16f1d0ff8e894f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-12-22 09:25:37 +00:00
Eike Ziller
2e280e1c50 Merge remote-tracking branch 'origin/12.0'
Conflicts:
	src/plugins/clangcodemodel/clangdfollowsymbol.cpp
	src/plugins/debugger/debuggerruncontrol.cpp
	src/plugins/projectexplorer/miniprojecttargetselector.cpp

Change-Id: I45b7fee1a1d784c44f2139fb1ede69190d23d6fd
2023-12-06 16:50:15 +01:00
hjk
311c95cfcc Debugger: Create a copy of the current dumper code
The current code supports Python 2 and Python 3 based debugger backends
(gdb, lldb) at the same time, but we'd like to drop Python 2 support
so we can take advantage of some of Python 3's goodies.

This copy here is not meant to be used in general but could perhaps be
used to replace the main code in situations that cannot use Python 3 yet.

Change-Id: I62273bc41b5a1e3a24720e167e64e4eac2e0c056
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-12-06 13:09:26 +00:00
Friedemann Kleint
332a742e0b pdb: Fix command line arguments
pdbbridge uses exec() on the main file which causes the inferior to
use its sys.argv. Inferiors using argparse would then fail since they
cannot make use of the working directory passed.

To fix this, append the inferior arguments separated by "--" and
change sys.argv accordingly.

Change-Id: I35caf4b3ec19c5259c0d4235787c03a3e592768a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-12-06 12:20:48 +00:00
David Schulz
8c337722d0 LLDB: check for msvc/windows target in lldbbridge
Change-Id: I404630592e021688628d02ec71ea00cb2db8358e
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-11-16 11:27:29 +00:00
Christian Stenger
cf88267011 Debugger: Adjust libcpp based optional dumper
There is no added value in providing the value of the
internal 'engaged' - just provide the value if possible.

Change-Id: I8c308902bf82c43e4238568fc9b185c3a3994b47
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-11-03 06:14:07 +00:00
Marcus Tillmanns
5becefbe72 Debugger: Fix QImage dumper
Change-Id: I423d139a16a8a08d9135a1d489c4d38ebac9c0f6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-11-02 13:58:01 +00:00
Christian Stenger
9893768461 Debugger: Fix dumping std::unique_ptr on macOS
Change-Id: If718201d0f32f1eb210bd0f786f62182225b94c8
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-11-01 14:19:37 +00:00
David Schulz
7f1eaff398 Debugger: improve std::unique_ptr dumper for cdb
Fixes: QTCREATORBUG-29739
Change-Id: Ia8808c54137c762c54ad28f576c9d3be921d7d9c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-11-01 14:16:44 +00:00
Marcus Tillmanns
53931b18ad Debugger: Fix QDateTime dumpers with TZ != UTC
Fixes it for Qt 5.4 and onwards hopefully.

Fixes: QTCREATORBUG-29737
Change-Id: Ic555e304a872dfbd458a95097e4e0b6a6632509a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-10-30 07:44:28 +00:00
Marcus Tillmanns
3f647a4bc5 Debugger: Fix lldb fetchFullBacktrace
Change-Id: Ib0a513ecd6c0a0094797fe987aeaddc57d0b5149
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-10-20 07:43:06 +00:00
hjk
2886b2b383 Debugger: Robustify gdb stack frame extraction
frame.older() might run into invalid debuginfo and throw.

Change-Id: Iba1d395f21719bf28184302427c7ab2435c6a663
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-10-18 09:48:23 +00:00
hjk
b26e12e199 Debugger: Add a dumper for Utils::Key
Change-Id: I7e586b622160d5b06a3971fec825521231c09522
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-10-17 07:11:14 +00:00
Tor Arne Vestbø
81d571468c lldb: Auto install pygdbmi if not found
It's quite awkward that the user has to manually install pygdbmi
for the LLDB summary provider to work. And if the user has python
from homebrew, their 'pip3 install pygdbmi' won't be seen by LLDB
either, causing confusion.

By automatically installing pygdbmi via the python3 interpreter we
know we're running under, we simplify this for the user.

The user can opt out by setting QT_LLDB_SUMMARY_PROVIDER_NO_AUTO_INSTALL
in the environment.

Change-Id: Iad7935fd77e6f56ddf719126ef7ad1cb1a024877
Reviewed-by: hjk <hjk@qt.io>
2023-10-02 13:27:20 +00:00
Tor Arne Vestbø
182d4540b3 lldb: Add summary provider basic debugging facility
Change-Id: I166ad0c2e7d4ed508b1f4a8eeaf5e1e2488a3b70
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-09-28 08:54:23 +00:00
Tor Arne Vestbø
7033bbf7e0 lldb: Set environment variable to detect when running lldb from Creator
Instead of relying on __name__ being 'lldbbridge', which can also
be the case if the lldbbridge.py script is imported into a plain
LLDB process, we can now look at the environment variable.

This also lets us break out early from __lldb_init_module
if the user has a `command script import llbdbridge.py`
in their .lldbinit, or is automatically loading the bridge
via the Qt Core debug script.

Change-Id: Id8168c692ef66ce50119b7426ca85c7bc99d9503
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-09-28 08:54:13 +00:00
Tor Arne Vestbø
4b29b43a2a lldb: Add summary providers using consistent module name
When the lldbbridge is imported from the debug_script.py in qtbase,
it's imported using the module name 'qt', to distinguish it from
when Qt Creator imports the bridge.

So when we add the synthetic child provider, we need to use the
'qt' module name. This fixes the warning:

  The provided class does not exist - please define
  it before attempting to use this synthetic provider

If for some reason the lldbbridge.py is imported into a LLDB session
directly, we mirror the 'lldbbrdige' module name to 'qt' as well,
so that the class reference still holds.

Change-Id: I531b10fd5e10eb0c2acd6014169a02ba3157c704
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-09-20 11:20:57 +00:00
Eike Ziller
a3ef2a6d00 Merge remote-tracking branch 'origin/11.0'
Conflicts:
	src/plugins/projectexplorer/miniprojecttargetselector.cpp

Change-Id: Ie831644eb1c69beed6791cbc67cbfb9309dcd351
2023-08-29 08:47:29 +02:00
Marcus Tillmanns
eb17f4c2bf Debugger: Improve libc++ std::string dumper
Use isLldb and isGdb instead of exception.
Uses name based lookup in case of gdb instead of try/except

Fixes: QTCREATORBUG-29526
Change-Id: I6c3aa94503a519331395bd4249c6bf6488c8333f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-08-28 11:41:08 +00:00
Orgad Shaneh
4ad3925da4 Merge remote-tracking branch 'origin/11.0'
Change-Id: I5cdff1f5db3fae89beef3d27316b21440541bb1c
2023-07-30 16:24:15 +03:00
Cristian Adam
e321b3d6fc Debugger: Allow usage of Python 2 based GDB versions
Amends 7a210c41b4

Fixes: QTCREATORBUG-29440
Change-Id: I5991f7954c4831b732ea2b391e5542fab96a308e
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-07-27 10:25:05 +00:00
Marcus Tillmanns
77edffe3cf Debugger: Support linux remote debugging with LLDB
Adds support for Linux remote debugging with lldb-server

Change-Id: I3ee08704a3116030111df75273a46a2e4888f98e
Reviewed-by: hjk <hjk@qt.io>
2023-07-06 14:22:50 +00:00
Eike Ziller
26e96bfad8 Merge remote-tracking branch 'origin/11.0'
Conflicts:
	src/plugins/debugger/debuggeritemmanager.cpp

Change-Id: I9d99d13feff9315f52eacbd84857c63cb69bf804
2023-07-03 10:24:09 +02:00
David Schulz
596cd204e1 Dumper: fix array 10000 format
Fixes: QTCREATORBUG-29196
Change-Id: I23ddb17ac3f378b6602057c1964ef5984b83e245
Reviewed-by: hjk <hjk@qt.io>
2023-06-30 07:47:27 +00:00
Eike Ziller
606be1f69f Merge remote-tracking branch 'origin/11.0' into work
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs

Change-Id: Ib4653a1ce75c7cce658f4bb843481de014d0fcf7
2023-06-26 12:12:58 +02:00
Marcus Tillmanns
456a019f2d Debugger: Don't spam app output
Only errors should be displayed in the App output.
Everything else is just noise.
To keep the information for debugging purpose we log it to the
Debugger Output View instead.

Fixes: QTCREATORBUG-27160
Change-Id: I37301edd2f6638e2b4152d1bf7b89a40c9c3c0af
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-06-26 07:40:58 +00:00
Marcus Tillmanns
31c6ff495a Debugger: Fix remote debugging macosx apps
Change-Id: I5328069ba9b82bb66dfa2c1e0d148a717d594a4b
Reviewed-by: hjk <hjk@qt.io>
2023-06-23 11:57:34 +00:00
hjk
1e7f68e296 Debugger: Fix Gdb CLI dumper output
Patch from hunk #2 in the report, hunk #1 was handled by 76260f8038.

Fixes: QTCREATORBUG-28659
Change-Id: I674b742869f8b834d039fbbfc599a3261d76b054
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-06-22 06:16:10 +00:00