Commit Graph

360 Commits

Author SHA1 Message Date
Michael Weghorn
0ab97e1159 Debugger: Show actual type for 'gchar *' elements etc
When 'char *' typedefs (and the like) are used, this makes
the actual (i.e. the typedef's) type name shown instead of the
one that the type is a typedef for.
For example, 'gchar' is shown as type for all elements of a 'gchar*'
when expanding that one in the debugger's locals or expressions view.

Original display of text representation for 'char *' typedefs etc.
had been added with commit 70c4889ac9
("Debugger: Show text representation for 'char *' typedefs etc",
2020-06-26). Move the typedef resolution one level down so the
original type name is still available for display.

This also extends the existing 'gchar *' test case accordingly.

Change-Id: I9558360b3bf96906d6dc39a63706bb8ce28c2f1c
Reviewed-by: hjk <hjk@qt.io>
2020-09-24 14:31:43 +00:00
Michael Weghorn
d86cf5e235 Debugger: Retrieve and remember int from native GDB value
When adding expressions for bitfield members in the
debugger's expression view, their corresponding 'gdb.Value'
does not expose the fact that those are actually bitfields,
so e.g. an 'int : 3' is exposed like a "normal" 'int'.

Previously, this would result in wrong values being
retrieved in the 'DumperBase::Value::integer()' function,
when trying to read the value from the corresponding
memory address.

To avoid this, retrieve the actual int representation
for numeric values from the corresponding native 'gdb.Value',
remember them and return that one, similar to how it
is already done for known bitfield members
(s. 'Dumper::memberFromNativeFieldAndValue').

The conversion from the 'gdb.Value' does not work
for integers of a size larger than 64 bits
(like '__int128' used in the "Int128" dumper test).
Therefore, just ignore conversion failures and don't
remember any value explicitly for those cases,
so the same handling as previously used is applied.
(At a quick glance, the reason seems to be that this
is because GDB's corresponding functions use 'int64'
as a return value of the relevant functions [1] [2],
but I did not look closer into what GDB does
internally.)

Corresponding tests will be added in a separate commit.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdbsupport/common-types.h;h=f5b2f3d249177acea77231c21c5601f959c18d2f;hb=f3034e25fa98d44b775970f40c9ec85eeae096e6#l33
[2] https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/python/py-value.c;h=6e29284aad11ff344789152a4f601b3474d86bb5;hb=f3034e25fa98d44b775970f40c9ec85eeae096e6#l1706

Fixes: QTCREATORBUG-24693
Change-Id: Idfc3390115e8796f3c778070c23424c3dbdfeddd
Reviewed-by: hjk <hjk@qt.io>
2020-09-24 13:11:47 +00:00
hjk
3e732396e7 Debugger: Recognize QChar as simple type
This avoids creating individual child items when expanding a QString.

Change-Id: I49382dcf947ee7ac0470415a71ab05ede5f71b29
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-09-24 11:55:01 +00:00
Jeremy Ephron
495c08a3eb Debugger: Don't hardcode dumper module names
Changed the dumpermodules list to be dynamically retrieved as all
<module_name>types.py files instead of a hardcoded list. I don't know of
any reason it should be a hardcoded list, and this allows for more than
one custom extra dumper file instead of having to specify one extra one
and/or use personaltypes.py. It seems strictly better.

The code used is confirmed to be compatible with all versions of Python.

Change-Id: Ic1988961d5cb7e6523e84afdd0e6c4ed2993ac97
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2020-09-10 17:53:25 +00:00
Orgad Shaneh
9a7535d9e9 Debugger: Support C structs in dumpers
The lookup for qdump function was done by "struct Foo" instead of just
"Foo".

Change-Id: I325d00910a0c13c5e67692737033531e18392247
Reviewed-by: hjk <hjk@qt.io>
2020-09-04 14:51:13 +00:00
Christian Stenger
57c6a32b10 Dumper: Fix dumping of enum values for cdb
Fixes the Bitfields test.

Change-Id: I2aab020f1dc8be40ab994586d0989452c80bb8e3
Reviewed-by: hjk <hjk@qt.io>
2020-07-31 13:09:02 +00:00
Orgad Shaneh
00e814fdd1 Debugger: Respect "Use Dynamic Object Type for Display"
Broke in 5efa84830b.

Task-number: QTCREATORBUG-24280
Change-Id: Ice4b9d826d2402efb354180886d35926a2513e5a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-03 09:07:46 +00:00
Michael Weghorn
70c4889ac9 Debugger: Show text representation for 'char *' typedefs etc
'tryPutSimpleFormattedPointer' takes care of nicely
showing the actual string representation of character
arrays if the innerType is one of 'char', 'signed char',
unsigned char', 'CHAR'.

To make this work for typedefs of those types as well,
first resolve the typedef before passing the value to
'tryPutSimpleFormattedPointer' from 'putFormattedPointerX'.

This e.g. improves the display of variables of type
'const gchar *'.

Fixes: QTCREATORBUG-24264
Change-Id: I477b6d7552f9c30c12d819aa5f37e64e4f444969
Reviewed-by: hjk <hjk@qt.io>
2020-06-26 14:14:23 +00:00
Eike Ziller
8b8ecfa28f Merge remote-tracking branch 'origin/4.12'
Conflicts:
	src/plugins/cmakeprojectmanager/fileapiparser.cpp

Change-Id: I39f8c2be859be043f506bef77de9bb5b42d38165
2020-06-15 11:30:34 +02:00
hjk
28d34d196e Debugger: Fix QJson dumper for Qt >= 5.15
Storage is internally based on QCbor now.

Since this works better when having dumpers for QCbor values,
add those, too, for Numbers, Strings, Arrays, Maps for now.
None of the custom types.

Fixes: QTCREATORBUG-23827
Change-Id: Idf281d859aaf8556d9895646bbc091af85b34157
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-06-08 09:34:35 +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
e87c301787 Debugger: Fix gdb command line use of dumpers
Fixes: QTCREATORBUG-24103
Change-Id: I4a771e3694879755c46623c8f089857437eb0fb5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-02 12:04:23 +00:00
hjk
e71c0b7fe2 Debugger: Drop unnecessary use of ModuleNotFoundError
That's Python 3 only, and doesn't add value here.

Change-Id: I9b1702ea8b0b0ddb090fdfc393228b4430da0b07
Task-number: QTCREATORBUG-24004
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-05-25 23:53:47 +00:00
hjk
7a63a47ef0 Debugger: Work around for gdb reporting zero array sizes in some cases
Task-number: QTCREATORBUG-23998
Change-Id: I101d032705b66faf50260067f6aa604214f09298
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-14 10:52:18 +00:00
hjk
65935ce03c Debugger: Fix startup when Python's json module is missing
Task-number: QTCREATORBUG-24004
Change-Id: I1c0563868374263f13cec3a8f40138bce71338d6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-05-11 10:35:32 +00:00
David Schulz
04da8f4178 Debugger: prevent calling functions on windows targets
This will result in a crashing gdb.

Fixes: QTCREATORBUG-23982
Change-Id: I59b65c5854bb4b7cbd59522a555388d1e833a560
Reviewed-by: hjk <hjk@qt.io>
2020-05-06 12:55:49 +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
d91d4aa759 Dumper: remove unused imports
Change-Id: I447c9697dbd631ab26358c193c274484e70a908d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-03-02 12:13:34 +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
Orgad Shaneh
5872c60a45 Dumper: Fix syntax error
Change-Id: I8e611b1cb358872d9e0c7302ed8a4d3e0b7d9f3c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-01-16 08:41:59 +00:00
hjk
dff4469baf Debugger: Use a more convenient way to create timing samples
Change-Id: I4ca983957c81a1f5f963a85b16a2d1b255b2cd2d
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-01-07 12:14:27 +00:00
Eike Ziller
0491c1c06c Merge remote-tracking branch 'origin/4.10'
Change-Id: I4a22cdf4d7d5aab2083d5f9f7baaa38e510f83fd
2019-09-23 12:31:58 +02:00
hjk
89a36c7232 Debugger: Show FORTRAN strings
Fixes: QTCREATORBUG-22976
Change-Id: Ib435b2692301fe2e2d3378623e99bbcf16e27e46
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-23 08:50:17 +00:00
hjk
db4cc731bb Debugger: Allow timestamp reporting on a sub-item level
Task-number: QTCREATORBUG-22896
Change-Id: I41252868e14f1e4d5dddc0d1c17c097cba6f5fe5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-13 09:07:18 +00:00
hjk
ae66f63390 Debugger: Disable QObject connection and signal display
Besides the announced change to QObject guts in a5a859e72 there has been
at least 6e0b5dadc and possibly more, so give up here.

Change-Id: I84201cef9f2a7515f082f4c3310bdc96f7a4216d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-31 12:18:02 +00:00
hjk
2abdc54147 Debugger: Avoid infinite loop in dumper
Change-Id: I71e89574a9eecc079b4d8e91da352fd2b7b0d9ab
Done-by: Xander (@bugreports.qt.io)
Task-number: QTCREATORBUG-22637
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-23 06:27:49 +00:00
hjk
93d2e3352c Debugger: Improve QObject dumper
Don't use two lookups for parent types and act on known null pointers.

While the machinery is robust enough to handle the result it's a
needless deviation in regular code path.

Change-Id: I6e50629cf554870a3ffb9f488f654e6ae557e5b3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-06-18 09:55:07 +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
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
hjk
bfee82fa2c Debugger: Add dumper for QSizePolicy
Change-Id: Ib4d2597229f2808fcf79e76a9590b0e07989bfb9
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-02-19 12:57:26 +00:00
hjk
f75a7fa036 Debugger: Support rvalue references in functions args with gdb
Change-Id: I5383ffa38f07e3f191619555a9e735c211b3dd8b
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-01-10 11:33:46 +00:00
hjk
5a8b198b9a Debugger: Fix display of multidimensional C arrays
Fixes: QTCREATORBUG-19356
Fixes: QTCREATORBUG-20639
Fixes: QTCREATORBUG-21677
Change-Id: Ie28b51c6caf526e125234959cbf11503d0683dc7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-12-17 09:42:56 +00:00
hjk
81b6d4f637 Debugger: Robustify QEvent dumpers
There's no need to go through unknown enum sizes here, they are known.
Also, make it work for namespaced Qt. Avoid casts to typedefs.

Change-Id: I9c6fc44a03a0c245f05957306a129f6902f8cf85
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2018-12-12 09:27:20 +00:00
Christian Stenger
8a21555235 Dumper: Remove unreachable code
Change-Id: Ic0e6c0b9d3d2e4e3a3bf8a63cce41ae23e1084bd
Reviewed-by: hjk <hjk@qt.io>
2018-11-19 14:22:57 +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
1787eef68f Dumper: Fix handling of bitfields for MinGW
Fixes: QTCREATORBUG-19742
Change-Id: I8723da875607e00a833cd5a1ccb748e7f8ed4314
Reviewed-by: hjk <hjk@qt.io>
2018-11-12 08:51:49 +00:00
Christian Stenger
ace6708b88 Debugger: Fix display of null references
Fixes: QTCREATORBUG-21210
Change-Id: I529f38aad9b93707e09ffdd28885e46c2cfd158c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-11-06 11:26:05 +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
hjk
089b50f7d3 Debugger: Fix display of upper half of short unsigned ints
Change-Id: Ie15c66c02c15420436b26c65af3cee9a19634e5c
Fixes: QTCREATORBUG-21038
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-10-02 10:12:33 +00:00
hjk
c3433519a6 Debugger: Add an explicit QObjectConnectionList dumper
Mostly for sanity reasons when debugging the QObject dumper itself.

Change-Id: I7d6267625f091788e73b0b28695e9b99e33ab3e3
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-09-17 08:53:43 +00:00
Eike Ziller
9f60cdcdaa Merge remote-tracking branch 'origin/4.7'
Change-Id: I15962a85b0cc37c5a00e15ef7eac0445aad6c295
2018-08-20 09:05:18 +02:00
Orgad Shaneh
98b6fd26bf Dumper: Fix enum display in nested types
When used in SubItem, enums were displayed as
"value of type E at address <addr>".

Change-Id: Ieecfb791126c6f63f272817afc6c8d05f28b9242
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-08-16 06:42:21 +00:00
Michael Weghorn
ec5e70eeda Make pretty-printing GDB's LazyString work
Qt Creator failed to properly display GDB's LazyString.

The problem was that GDB's 'PlainDumper::__call__' passed a 'gdb.Type',
while 'DumperBase::putCharArrayHelper' called methods that are only
defined for the custom and more abstract 'Type' type defined in 'dumper.py'.

As described at [1], GDB's 'LazyString.type' "holds the type that is
represented by the lazy string’s type. For a lazy string this is a pointer
or array type. To resolve this to the lazy string’s character type,
use the type’s target method."

In addition, 'gdb.Type' does not have a 'size()' method, just a 'sizeof'
member, s. [2].

Since all other uses of 'DumperBase::putCharArrayHelper' are passed
a "proper" type, extract the code common to the GDB case and all others
into a separate method and directly call this one for the GDB LazyString
case.

[1] https://sourceware.org/gdb/onlinedocs/gdb/Lazy-Strings-In-Python.html#Lazy-Strings-In-Python
[2] https://sourceware.org/gdb/onlinedocs/gdb/Types-In-Python.html#Types-In-Python

Task-number: QTCREATORBUG-20939
Change-Id: I16608668c9403b6d8e509dab17eb1788586f453e
Reviewed-by: hjk <hjk@qt.io>
2018-08-15 19:23:52 +00:00
Eike Ziller
428fcb476b Merge remote-tracking branch 'origin/4.6'
Conflicts:
	src/libs/utils/settingsaccessor.cpp
	src/plugins/autotest/autotestplugin.cpp
	src/plugins/git/gitclient.cpp
	src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
	src/plugins/qbsprojectmanager/qbsrunconfiguration.h

Change-Id: I65f143cad18af509a2621d6c5925abbd038ea70f
2018-04-13 10:54:42 +02:00
Orgad Shaneh
28fa43e45b Dumper: Return correct address on extractPointer for arrays
Change-Id: I8e25cca4553a8b69703ac0ffa80231f97cdef980
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-04-03 06:47:32 +00:00
hjk
a8a23110bf Debugger: Fix enum dumper
Make the hex display work with LLDB, fix GDB and LLDB test.

Change-Id: I529b5cdc908dbcba7270bc4574fa59a012fcacad
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-03-22 08:45:57 +00:00
hjk
80f98a7fb9 Debugger: Make QList as movable
Apparently changed in qtbase dafa3618d23.

Task-number: QTCREATORBUG-19812
Change-Id: I70f543c71cc2147cbd5ab33a070e1a35049f46a8
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-03-20 07:13:12 +00:00