Commit Graph

373 Commits

Author SHA1 Message Date
hjk
37db98db30 Debugger: Simplify TypeData setup and registration
Change-Id: Ib23249eae63901d614cbe33fe184f174a10efbe4
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-09-28 11:59:50 +00:00
hjk
2006d41680 Debugger: Store tdata as member in Type
Change-Id: I2e784be9a16914a30b08bdfbedb789d8a1d3f910
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-08 10:20:33 +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
b2b6577d5c Lldb: Use qtHookData to retrieve Qt version
Adds caching of Qt version information.

In case that qVersion() can not be found, use qtHookData[2] to retrieve
the Qt Library version number.

In case that also fails, we now use self.fallbackQtVersion instead
of just returning 0x50200.

Previously debugging apps in the iOS Simulator would fail to correctly
detect the Qt Version, as qVersion might be optimized out, especially
for very simple applications.

Change-Id: I9183c1e9793bd899f296a231c693cd5bc146ab96
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-08-25 06:24:15 +00:00
hjk
266adf7b1d Debugger: Delay template argument retrieval from native types
For performance reasons. They are often not needed.

Change-Id: I8a7bb03583b3ec2479a3691486c9c02f70ad014e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-08-22 13:26:02 +00:00
Marcus Tillmanns
06be8a4325 lldb: Fix type inspection for QMetaType template types
lldb's FindFirstType() expects template types to have specific
whitespaces set. QMetaType's "name" parameter does not contain
the necessary whitespaces.

This solves that by changing e.g.: "T<A,B<C,D>>"" to "T<A, B<C, D> >".

Change-Id: I7505db96b01d433408af1942cd81e50094833c06
Reviewed-by: hjk <hjk@qt.io>
2022-07-07 12:21:38 +00:00
Christian Stenger
d10f3f8342 Dumper: Fix map dumper for lldb
Change-Id: I8adab131632b2ca04a3de8094699ab43d2de03bb
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-05-10 06:19:25 +00:00
Alessandro Portale
16ced8a7d6 Debugger: Describe right SBError for failed remote-android connection
It is the result of the previously attempted SBPlatform.ConnectRemote()
which we want to see in the logs if the connection fails.

Change-Id: Iec2760257eb8bb8c6b1df8aa3a5c010302966c8f
Reviewed-by: hjk <hjk@qt.io>
2021-12-16 07:23:36 +00:00
Alex Richardson
ebc229a25b Debugger: fix QString printing in LLDB with python3
Before this change I was seeing all strings as
`<failed to decode '...' as 'utf16'>` when using LLDB bundled with CLion.
This error is misleading since the actual exception raised from the python
code was `'str' object has no attribute 'decode'`. To fix this, I updated
the hexdecode() method on Dumper to accept an optional encoding argument
and use that instead of the python2 str.decode().

Change-Id: Ic3afc786c42fd7384d9dc3117f0871837076c2ba
Reviewed-by: hjk <hjk@qt.io>
2021-08-16 09:34:28 +00:00
hjk
1fef4085bf Debugger: Support CLion based LLDB
Change-Id: Ie044def8c243a62734cc77a9eab29cbb1fa81e66
Done-by: Igor Lifanov
Task-number: QTCREATORBUG-14539
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-25 06:13:03 +00:00
Christian Stenger
03624f9a68 Debugger: Do not omit original stack
..if loading the qml stack failed, e.g. when using a Qt
without debug information.

Task-number: QTCREATORBUG-25554
Change-Id: Ibe2a051f4dc0a9d3c15a63f663f5934a476d6fc4
Reviewed-by: hjk <hjk@qt.io>
2021-05-07 04:21:21 +00:00
hjk
75ededf4a9 Debugger: Implement "Load QML Stack" feature for LLDB
Fixes: QTCREATORBUG-25554
Change-Id: Ieafa22581c294d9b993efe077354750a8f986424
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-06 14:07:12 +00:00
Eike Ziller
834b6c2da1 Merge remote-tracking branch 'origin/4.14' into 4.15
Change-Id: I9b4f24456b94381fb7427d60bd683069edf31360
2021-03-09 12:44:12 +01:00
Christian Stenger
33cafa0dcf LLDB: Drop secondary lookup of native types
Although already tried to lookup a native type with an
lldb internal mechanism we still tried to do it "manually"
again.
This secondary approach was needed at some point when lldb
had no integrated way to lookup a type inside all modules.
Lookups done manually will not provide a better result than
the lldb internal one.
The error output generated with this blocks debugging which
makes QC unusable at this state.
So, remove the secondary lookup completely.

Fixes: QTCREATORBUG-25185
Fixes: QTCREATORBUG-25217
Change-Id: Ibd8a125a89633c611bf750e0f1759c639717e1d2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2021-03-09 08:06:47 +00:00
hjk
89646aadce Utils: Don't raise SIGSTOP in the process stub
Previously, the starting inferior was sent a SIGSTOP to avoid
progress before the debugger could attach.

However, these signals are then also visible in the debugger and
need to be ignored as part of the startup handling in Creator.

The waiting effect can be achieved less intrusively by waiting
on a pipe read between fork() and exec().

Task-number: QTCREATORBUG-25073
Task-number: QTCREATORBUG-25082
Task-number: QTCREATORBUG-25227
Change-Id: Ie70b9eb5ea865f85411c26b0dbf377a019fec8d5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-09 08:06:21 +00:00
Eike Ziller
fee671dfbe Merge remote-tracking branch 'origin/4.14' into 4.15
Change-Id: Ifbfb495fff50b5bb27a12b204653cf1697820913
2021-03-05 17:18:43 +01:00
Christian Stenger
bf0154e50f LLDB: Do not print warnings to Locals
Change-Id: I552f75ebbb57c4af30582aa764fec75aa08df340
Reviewed-by: hjk <hjk@qt.io>
2021-03-01 15:13:00 +00:00
Christian Stenger
88ef74d0f9 LLDB: Fixup filtering out function signatures
Amends 2f67d75ca4.

Task-number: QTCREATORBUG-25185
Task-number: QTCREATORBUG-25217
Change-Id: Ic22d67d742273f9a8944c64df4c8a0647c4157f4
Reviewed-by: hjk <hjk@qt.io>
2021-03-01 15:12:54 +00:00
Eike Ziller
c55e59cb77 Merge remote-tracking branch 'origin/4.14'
Change-Id: Ib9512b4fc5e17b04ca4be79fc315e79a52d06497
2021-02-22 12:19:58 +01:00
Christian Stenger
2f67d75ca4 Debugger: Avoid looking up function signatures
Looking up function signatures ends up in massive
stderr output which blocks the debugger for ages, so omit
them as long we are not sure where they originate.

Task-number: QTCREATORBUG-25185
Task-number: QTCREATORBUG-25217
Change-Id: I9b022d2194a6cb61651ee0648be526fc94a02da9
Reviewed-by: hjk <hjk@qt.io>
2021-02-22 06:21:39 +00:00
hjk
c2e3e0419d Debugger: Prepare delayed type creation for DumperBase.Values
Change-Id: I283bcdec178e0a860bef71753cd29cc283a58391
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-21 11:21:01 +00:00
hjk
e09867d7de Debugger: Do not limit inferior output chunks to 1024 chars with LLDB
Task-number: QTCREATORBUG-24667
Change-Id: Ie59db04b0c1e46c4c06a1761eee3859ae18bcf7f
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: David M. Cotter <dave@kjams.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-01-04 06:49:48 +00:00
hjk
b288cb6706 Debugger: Fix template type alias handling for LLDB
Case like 'template<typename T> using TVector = std::vector<T>'
end up only as 'TVector' in the debug info. This is unsuitable
as an id in our type info caching as this would only allow one
type layout for all specializations, which is not the case for
e.g. std::vector<bool>.

The solution is to mangle the target type into the id, as already
done for GDB.

This makes the Typedef2 dumper test pass.

Change-Id: I11538bbf6431f61a11c18366a2a2b4911cdc2e0e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-12-11 12:20:23 +00:00
hjk
d4ed07eb87 Debugger: Change/improve LLDB display of enums in some cases
This fixes the Internal2, EnumFlags and EnumInClass tests on Linux.

The values lose now the previously hand-crafted Class:: prefixes,
but the context is clear from the type column, and it's what LLDB
developers (and potentially users) consider normal.

Change-Id: I09e41f7b4fb4f078ef3f535fe650d06e7c2a0331
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2020-12-11 11:37:11 +00:00
hjk
14035584d8 Debugger: Fix CharArray dumper and test for LLDB
Change-Id: If12936fa863633b1ca85e712f8395e8ab4a0d69c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-12-11 09:35:37 +00:00
hjk
e556463dc7 Debugger: Fix value endianness of register data with LLDB
Fixes: QTCREATORBUG-25009
Change-Id: I4de44cee6ef322791e3f4058a369548bfb210e77
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-12-01 10:09:44 +00:00
Jeremy Ephron
b9323cccc0 Debugger: Use GetName instead of GetDisplayTypeName
In the newest version of LLDB, they remove anonymous and inline
namespaces from their display name, which breaks all debugger helper
code on Macs with the newest version of Xcode, since Qt Creator logic
determines libc++ vs. libstdc++ by the presence of the "__1" inline
namespace.

Change-Id: I139d0654ffbc9dec2e42b40eaad92ea2e3c067c0
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-01 10:29:12 +00:00
hjk
a50f1baf5d Debugger: Change LLDB value creation hack
... to something that works with LLDB 12.

Task-number: QTCREATORBUG-24596
Change-Id: Ib2f8255d45a02fa3d2c737864994397f587e9b15
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-09-15 08:45:32 +00:00
Orgad Shaneh
fd32b222ee LLDB: Escape strings for correct parsing
Sample broken output:
>result={token="9",lldbid="1",valid="1",hitcount="0",threadid="0",oneshot="0",
condition="",enabled="1",valid="1",ignorecount="0",locations=[
{locid="1",function="foo()",enabled="1",resolved="0",valid="1",ignorecount="0",
file="F:\Projects\test\main.cpp",line="5",addr="4199979"},],
file="F:\Projects\test\main.cpp",line="5"}@

When parsed as GdbMi value, the strings are expected to be escaped.

Change-Id: Idb923516c1cf6e25b970ad08fae977bdf1045b4b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-09-03 07:39:50 +00:00
Eike Ziller
b18711da91 Merge remote-tracking branch 'origin/4.12' into 4.13
Conflicts:
	share/qtcreator/debugger/lldbbridge.py

Change-Id: Ia444f6424fb35b9a539e157afcee868161535272
2020-07-06 16:23:13 +02:00
Eike Ziller
d0e3f5ca98 Fix debugging C++ on iOS devices
Partially revert 7f958700a0 for 'remote-ios'.
The original commit changed the way attaching to a remote server or process
works, attempting to make it work with lldb-server on a remote linux device.
That breaks connecting to the debugging server on iOS devices.

Fixes: QTCREATORBUG-23995
Change-Id: I7a793fa73a564a4ef19cf82e13c2ad50d4247ee3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-06 09:18:40 +00:00
Christian Stenger
9e4eafccd2 Dumper: Fix python code for Xcode 10.1
Change-Id: I65797bac8b668ce85082eccf6520147a2a4c5680
Reviewed-by: hjk <hjk@qt.io>
2020-06-11 12:58:32 +00:00
hjk
63655081c3 Debugger: Mark a few more sub items as expandable
... and remove some of the now implicit putNumChild() calls.
Also, adapt docs.

Change-Id: I1ab1dafada95a1703cd6a9ba5b9e7e4166b48cd9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-02 13:02:25 +00:00
hjk
c6007f5a2c Debugger: Funnel some LLDB message to the AppOutputPane
This could be extended to the other bridges, not done in this patch.

Change-Id: I620290049b7c95f8e3fb7584d4ca99a42fd343d4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-18 06:47:10 +00:00
hjk
73865034c6 Android: Use adb:// in ConnectRemote
This is apparently the right thing to do anyway and also helps to
select the right emulator or device when multiple ones are connected.

In that situation otherwise an error

  "Expected a single connected device, got instead 2 -
    try setting 'ANDROID_SERIAL'"

would occur.

Change-Id: I650a221d1a321d4dd9035411f85c7a68244c20e2
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2020-05-15 11:37:35 +00:00
Christian Stenger
dd9bed93f0 Dumper: Fix Python 3 support
Change-Id: I3b981a0418b2a407adfbdbab5f6b73176aeb588f
Reviewed-by: hjk <hjk@qt.io>
2020-05-14 13:16:13 +00:00
hjk
a6e1894274 Debugger: Report LLDB error if bridge could not attach to process
Change-Id: Id54c0e21d7d803505b45f92ecf0a208771d10b81
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-05-13 09:08:18 +00:00
hjk
ca862e3fff Debugger: Fix LLDB listing registers when no frame is selected
Change-Id: I6c3d193a2622ed07c34e68bf8b5780d55520e4f2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-12 05:52:08 +00:00
hjk
9403c7c916 Debugger: Consolidate LLDB startup code a bit
Change-Id: I0c19a76ad6f1e7b4602b9bd2157cc6855e049402
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-07 15:12:33 +00:00
hjk
310c954779 Debugger: Make sure to not select frame -1 with LLDB
This can appear as (non-existing) preferred frame index in backtraces
consisting only of frames without debug info. Fall back to top most
frame in that case.

Change-Id: Id7bb941d5fc3080aff3853cebb7b92afdd0ba4ea
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-07 09:04:28 +00:00
hjk
54dd137902 Debugger: Make LLDB attach to local process work (again?)
Change-Id: I48ec7b5251db490d1c8e17affb3c1dc1ce22bece
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-07 08:02:44 +00:00
hjk
e73f05253e Debugger: Simplify LLDB bridge startup
No need to start the debugger event loop if the engine setup fails

Change-Id: I6bdeda0d2609c79aa5fafff7bc4b373a0bf14fbd
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-07 07:39:29 +00:00
hjk
2dfa539b96 Debugger: Avoid race condition on setting initial LLDB breakpoints
Breakpoints inserting is async, so they did end up when the process
was running already.

This adds an extra roundtrip. Better, but more intrusive solution
might be to set the initial breakpoints synchronously, but that
would touch all engines.

Change-Id: Ia728a9c5ae8f1d6d29d3cc02b9e2d04952091fe9
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-07 07:12:46 +00:00
hjk
7d3c6f7c02 Android: Start lldb-server and attach
Change-Id: Id7c45d9161d3389e9de419835c312d87916a34bc
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-04-22 08:12:48 +00:00
hjk
80f3f34c96 Debugger: Pass symbol file to LLDB and use it
Instead of guessing from the executable.

Change-Id: I5f57020446bc5e0f7915dac487a32d673eb97952
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-04-03 10:02:47 +00:00
hjk
7f958700a0 Debugger: Make LLDB work a bit with remote Linux
The device on remote side *has* to configure (/usr/bin/)lldb-server as
"GDB server executable" in the device settings.

A real gdbserver does not work.

Change-Id: I045ffb60a824e06ee683d8bdfffeb480a580af5f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-04-02 15:50:19 +00:00
David Schulz
472797a1d1 Dumper: avoid redundant labeling
Change-Id: I85581cfe34a60e7f8a3e3590358443a15b7d2d4c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-03-02 12:14:22 +00:00
David Schulz
0776340ad8 Dumper: unify Codestyle
generated with autopep8 and the introduced setup.cfg

Change-Id: I5b55a7937f2cde81be59d2b434e94ada1a4af5ab
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-02-28 08:35:05 +00:00
David Schulz
4422805cec Dumper: replace xrange with range
Change-Id: I09b3dd4da548643e927dbc5bb3130c28a746396b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-26 10:26:55 +00:00
David Schulz
44db8e2eab Dumper: replace import * with explicit imports
Using imports like

 from foo import *

is considered as bad habit and it reduces
static code analysis usability.

Change-Id: I56a175f4c7b231e2b8e486bd9d1c65543720f56a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-02-25 13:22:50 +00:00