Commit Graph

347 Commits

Author SHA1 Message Date
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
David Schulz
e17c96cf11 Dumper: move global enums and functions to utils
Change-Id: I11f5f0d970cd23a5fd907d33daa3cb8a441d0c58
Reviewed-by: hjk <hjk@qt.io>
2020-02-24 07:47:40 +00:00
Alexandru Croitor
850ae600fb [lldb] Fix lldbridge.py to work in standalone lldb on macOS 10.15
Change-Id: I6220e426e3556d68dcb318d709f3573601c1aa96
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-01-16 09:38:16 +00:00
Christian Stenger
fefdbdfcd8 Debugger: Do not waste CPU when using LLDB
Fixes: QTCREATORBUG-23311
Change-Id: I5b1c40663c7977322e806af2e0393a3730e70049
Reviewed-by: hjk <hjk@qt.io>
2020-01-14 10:02:13 +00:00
hjk
08149a7c34 Debugger: Improve assignment to simple expressions with LLDB
Task-number: QTCREATORBUG-22696
Change-Id: Ifa084046ff83ba071c9e96a4221d7b4a09bfc22f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-26 08:48:54 +00:00
hjk
4013f0cdf0 Debugger: Use Python 3 prints also in pure LLDB bridge code
Task-number: QTCREATORBUG-22955
Change-Id: I762acd289c50fe5817b3e6e915f35c2388c74d44
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
(cherry picked from commit 7f29fa2030)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-09-25 13:18:06 +00:00
Christian Stenger
9a5826d19c Debugger: Fix debugging with LLDB 1100.x
Tweak handling for LLDB provided by Xcode 11 slightly,
as the state handling of the process went astray when
using the debugger Python 3 based.

Task-number: QTCREATORBUG-22955
Change-Id: Ie070049d210a570993507ed940d141237aab89ce
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-09-25 13:17:53 +00:00
hjk
54e3d06c5e Debugger: Do not add spurios empty element to LLDB args
Fixes: QTCREATORBUG-22975
Change-Id: Ibd5db32af9adb90f5d191e4fdcd2be751bd2b412
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-23 08:02:19 +00:00
hjk
5b33660a57 Debugger: Allow spaces in arguments with LLDB
Change-Id: Iebc6f7975e9a306805911ed18eb4689074abd891
Task-number: QTCREATORBUG-22811
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-08-06 08:07:25 +00:00
Christian Stenger
32ce4d5071 Lldb: Fix event handling for newer Xcode and faster machines
If the system or the running inferior produces output while
fetching data the output did interfere with the state handling
of the debugger engine which in turn lead to a complete
inconsistent state of the debugger where the states of the
debugger bridge and the debugger engine (QC internal) assumed
complete different states.
Circumvent by explicitly ignoring the state for inferior output
on stdout or stderr.

Change-Id: I81aa0bacd41de4266a9278c66fed908dd72c9d44
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-02 12:29:35 +00:00
Alessandro Portale
5311708845 python scripts: Use "not in" operator to test membership
As per suggestion from Pyls, this changes
  if not needle in haystack:
to
  if needle not in haystack:

Change-Id: I4a482604e13e61ecee9e02935479632419710ff7
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-05-10 05:53:39 +00:00
Christian Stenger
31e549a7dc Debugger: Improve lldb breakpoint handling
Inform QC about changed breakpoints on the LLDB side.

Fixes: QTCREATORBUG-21997
Change-Id: Icec25725f92d8a0b47f7dab2971c0c5eb5b23757
Reviewed-by: hjk <hjk@qt.io>
2019-03-06 05:43:12 +00:00
Eike Ziller
868160f215 Merge remote-tracking branch 'origin/4.8'
Change-Id: Ia8fed69168d87afafdb5acf4de4d5d30f9b4ebf5
2019-01-31 08:38:13 +01:00
hjk
ac1d6d0bc8 Debugger: Fix Attach to process and Run in Terminal
LLDB 6.x and 7.x

Change-Id: I127ed1e14ccdd239646673f2460be46da22d4965
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-01-23 14:24:57 +00:00
hjk
587bd782aa Debugger: Reduce the amount of ignored stop messages with LLDB
This is a workaround for excess messages from the early LLDB 3.x times.
LLDB 6.0 is ok with and without this workaround, LLDB 7.0 does not
produce the excess messages anymore and the workaround leads to
real stop messages e.g. after a breakpoint hit being ignores.

Change-Id: I2fad014eb92e066b00dbfe590fe62c543e5343f4
Task-number: QTCREATORBUG-21615
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-01-23 12:56:12 +00:00
hjk
d22a6d29e8 Debugger: Make *__int128_t also available with LLDB
Change-Id: I114458e18e461596966d5ef1b8f38f3c5d8d5ee5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-01-21 11:43:56 +00:00
hjk
d4e79230d8 Debugger: Make LLDB startup failures more verbose
Fixes: QTCREATORBUG-19612
Change-Id: I7c8ebe3ec734265c8df8a684ccd6bb8991ea8390
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-12-11 12:08:06 +00:00
Alexandru Croitor
18c6048099 Debugger: Fix thread switching when using lldb on macOS
The SetSelectedThreadByID method expects an integer, and not
a string.

Fixes: QTCREATORBUG-21563
Change-Id: Ibd5538a3214b73d7e87e66b59d6b9af0b93effeb
Reviewed-by: hjk <hjk@qt.io>
2018-11-27 11:00:40 +00:00
hjk
afe5699f8d Debugger: Show module in stack frames also for LLDB
Change-Id: I2b20b83bedf98a1b0eb17519fb4bec536e48dbaf
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-11-22 13:25:24 +00:00
Christian Stenger
84576d3098 Dumper: Fix displaying enums with LLDB
Prioritize displaying as enum if a type is known
to be an enum. Otherwise this would just end up
get displayed as string representation of its value.
Enable respective dumper tests.

Change-Id: I3e5406e14a68f02741b6144bb54528b72cc8192d
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: hjk <hjk@qt.io>
2018-11-19 14:22:45 +00:00
Christian Stenger
deef478b38 Dumper: Fix activating frame for lldb
...when being attached to core file.

Change-Id: I4f8364285d756bae53b4a14ca8feb74f7fdaacfb
Reviewed-by: hjk <hjk@qt.io>
2018-11-14 10:09:05 +00:00
hjk
402991498f Debugger: Fix assignment to QString etc with LLDB
Task-number: QTCREATORBUG-21353
Change-Id: Ie3655738c249240d9fbf17e054fc8f79a284efd4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-11-12 12:31:46 +00:00
hjk
3ca343dd90 Debugger: Remove some dead code in lldbbridge.py
Change-Id: I368252f7ca83f66962f9c1d0e1726a77320fc886
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2018-11-09 12:30:53 +00:00
Alexandru Croitor
de32a631c3 [Debugger] Fix bitfield values to show up correctly using lldbengine
The bitpos value returned by lldb is the bit offset relative to the
beginning of the type, there is no need to do an extra modulus
operation.

Adjust dumper test to add the previously failing case.

The failing case happens when the class containing the bitfield has
more members in front of the bitfield.

Change-Id: I93678f78e6799843558ec53342a0ed49cac74f48
Reviewed-by: hjk <hjk@qt.io>
2018-11-08 15:12:10 +00:00
hjk
c016c6737b Debugger: Fix LLDB start with complex command lines
Fixes: QTCREATORBUG-21433
Change-Id: I1a248272566eac7f5fd07a8346500d245b62fbfa
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-11-08 14:21:21 +00:00
hjk
2556d4b44b Debugger: Implement disabling/enabling subbreakpoints with LLDB
Change-Id: Iaad8716b98d632e5a933b7f5b26549c7cb885ea7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-11-06 07:37:15 +00:00
Alexandru Croitor
89fe2681f7 [Debugger] Add dumpers for Python "PyObject"s
The dumper calls PyObject_Repr and shows the result of that as the
value of a PyObject.

It also adds three new sub fields to show the object class (type),
super class (base class), and the meta type (the type of the class
object).

Change-Id: I0612833321f6d2b50826588e775cfa12e1db28e4
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-10-19 11:17:36 +00:00