Commit Graph

268 Commits

Author SHA1 Message Date
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
hjk
e2144db165 Debugger: Pass native gdb.Value to native gdb pretty printers
Task-number: QTCREATORBUG-20770
Change-Id: I6ea92faf0c9314c50da05356fa9004f87124111a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-07-17 09:10:03 +00:00
Christian Stenger
a7fba990f4 Debugger: Fix Qt namespace detection for gdb8
Task-number: QTCREATORBUG-19620
Change-Id: Ieb7a8bc8cfeb8ba4331436ef6652437c0971c356
Reviewed-by: hjk <hjk@qt.io>
2018-07-06 10:10:05 +00:00
Christian Stenger
65a4333f2c Dumper: Fix detection of Qt namespace
Task-number: QTCREATORBUG-19620
Change-Id: Icca654714b70c69522b51998be21cff80bc29fac
Reviewed-by: hjk <hjk@qt.io>
2018-07-02 10:17:48 +00:00
hjk
d66e8b6ea0 Debugger: Remove some spurious '.report' content from dumper output
No real damage, the parser on the Creator side is apparently robust
enough. Still no need to add this.

Change-Id: I8329a55c44f866070fb3df48c3a22000ee33e848
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-03-23 13:03:35 +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
58f457f405 Debugger: Also extract Qt namespaces for libinfixed Qt build
GDB-only for now.

Task-number: QTCREATORBUG-19620
Change-Id: I2ca3a927623ec0df742fed65048e8a3bcfa5cee2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-01-22 13:59:42 +00:00
Christian Stenger
1d2049bffc Dumper: Fix typo
Change-Id: I2d7bbe88c4d1552dba505003020c86a406821f72
Reviewed-by: hjk <hjk@qt.io>
2017-12-13 05:43:35 +00:00
hjk
58c329cd03 Debugger: Re-introduce namespace detection for Qt 4
It's apparently still in use.

Change-Id: I89d04c6b3afff8014334e3543c3f3b77bf52d130
Task-number: QTCREATORBUG-19135
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-10-23 09:51:45 +00:00
hjk
5b2a46e3a0 Debugger: Fix typo in namespace extraction debugging code
Change-Id: I24e70a25105b9fbef625ca633ebdf715749f10f3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-10-23 07:23:51 +00:00
Eike Ziller
3d9cf954e2 Merge remote-tracking branch 'origin/4.4'
Conflicts:
	src/plugins/debugger/debuggerdialogs.cpp
	src/plugins/debugger/gdb/remotegdbserveradapter.cpp

Change-Id: I1ae77869887a8d9ef2a33439f2733315db9e0cf0
2017-09-19 12:10:26 +02:00
hjk
360609eb7a Debugger: Add to solib-search-path, don't replace it
Task-number: QTCREATORBUG-18812
Change-Id: I0fb8d81d55e9928bd3825c510a11ab426ec082c6
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-09-13 10:09:28 +00:00
Eike Ziller
d8fd5292f1 Merge remote-tracking branch 'origin/4.4'
Conflicts:
	src/tools/clangbackend/ipcsource/clangiasyncjob.cpp
	src/tools/clangbackend/ipcsource/clangjobrequest.cpp
	src/tools/clangbackend/ipcsource/clangjobrequest.h

Change-Id: Ib8602530663813ade418f995dfd2a736908cfe75
2017-08-15 10:07:51 +02:00
hjk
6ae77f7daa Debugger: Fix editing of std::{w,}string, QString, QByteArray
... as well as std::vector and QVector

Change-Id: I7fd33be9917a17414149813c28316166b8de9be7
Task-number: QTCREATORBUG-18681
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-08-09 05:34:11 +00:00
Thiago Macieira
d6b6a88753 Debugger: print QFlags and bitfields as hex
It's a lot more useful to see in Qt Creator:
  QAbstractFileEngine::FlagsMask (0xff00000)

Than
  QAbstractFileEngine::FlagsMask (267386880)

Change-Id: I8d96dea9955d4c749b99fffd14cd690574b433e5
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-07-11 23:57:19 +00:00
hjk
1a16caf221 Debugger: Don't list static members of items in arrays
To properly access a static member we need a nativeValue which we
don't have in the expansion of an array.

Not showing static members in that case is a compromise between
LLDB behavior (never show statics) and showing something wrong
(see the linked bug report)

Task-number: QTCREATORBUG-18366
Change-Id: I688779224a89d4ecbc47dd5623922efb32be9c4c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-07-05 08:17:42 +00:00
Orgad Shaneh
a9145e67ba Debugger: Prettify values for enum bitfields
Change-Id: I55329bba1864c9ebbbcb3b3bf1b940346507f8cd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-06-12 10:40:46 +00:00
Orgad Shaneh
d7d415491a Dumper: Fix type of lvalue for bitfields on GDB
Change-Id: Ic0e82fc012eb1277a74ff2e63fdc0a13caaf5f1c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-06-07 07:37:47 +00:00
Orgad Shaneh
e9491870bd Dumper: Do not use None for bitpos
It causes an exception when being divided

Noticed with boost::icl::interval_set.

Change-Id: I5629436c3c1ba10e7b67bb05d720329f4c61eafe
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-06-06 07:13:05 +00:00
Orgad Shaneh
8204014007 Debugger: Fix unnamed typedef resolution
typedef enum { Value } Unnamed;
struct Foo { Unnamed u; };

int main()
{
    Foo foo;
    return 0; // Expand foo -> not accessible
}

Change-Id: I4231314ef92bb1896d287ae5eb3200d4d53cf4db
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-05-30 05:48:48 +00:00
hjk
1e9cc97220 Debugger: Improve handling of static members in shared objects
Change-Id: I4978094dc5dcd0e57bb6790cfc8476a9db77724d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-05-02 10:22:14 +00:00
hjk
81d9315587 Debugger: Add a boost::variant dumper
This requires making template argument extraction a bit more robust

GCC 5.4.1 created debug info only reports the first argument for
boost::variant<int, bool>:

    #include <boost/variant/variant.hpp
    int main() { boost::variant<int, float> v = 1; return 0; }

    py print(gdb.parse_and_eval('v').type)

      -> boost::variant<int, float>

    py print(gdb.parse_and_eval('v').type.template_argument(0))

      -> int

    py print(gdb.parse_and_eval('v').type.template_argument(1))

       -> Traceback (most recent call last):
          File \"<string>\", line 1, in <module>
          RuntimeError: No argument 1 in template.
          Error while executing Python code.

Change-Id: Iedca8b073078c93449ab61bb2cab05d6cd9803ba
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-04-26 09:23:18 +00:00
hjk
758e50fa45 Debugger: Catch some exceptions related to optimized out values
These could be triggered by declared but undefined and unused
static data members.

Task-number: QTCREATORBUG-18030
Change-Id: I941e8cbe8ce18dca737e59472ed0ee19ace44072
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-04-25 07:58:13 +00:00
hjk
53ff0e1ca1 Debugger: Add a workaround for bad gcc debug info generation
Gcc does not write out full type names with 'using template ...', see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80466

This is in most cases harmless for Creator as dumpers are triggered
independently of template arguments. However, if the dumper takes
different code path based on the template argument type, as is
e.g. needed for std::vector<bool>, wrong results are produced,
as the type cache only used the template base name as type id.

Work around by mangling the id of the un-typedef-ed type into
the type id of a typedef, which, in case of templates contain
the full parameter list.

Change-Id: I63c59cccdc186b09ff780e9dfd57b0ad668ae98f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-04-20 09:15:59 +00:00
David Schulz
86edeb9722 Debugger: Use native value for pointer dereference
Change-Id: Ibde6ff382e7adc0c196837c9eba04391c0a2c3a0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-03-28 09:22:28 +00:00
hjk
61501042bc Debugger: Simplify Qt namespace guessing code
We get proper notification when QtCore is loaded now, and we either
got it, or not.

Change-Id: I9485126d9b15b8d859ba440f3ba1623f03527ef8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-03-15 11:36:18 +00:00
hjk
68a4a3db94 Debugger: Use gdb provided hooks to track loaded shared objects
Change-Id: I4f3cce56910e0e737febaf0ff442956b78b19c30
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-03-15 11:34:58 +00:00
David Schulz
e41befd4f7 Debugger: Check also for Qt5Core(d).dll on Windows
Change-Id: Ic078a165d35c316cb12d08ca84913b4b07143aa4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2017-03-14 13:07:23 +00:00
hjk
fb213b5826 Debugger: Use a named tuple for Dumper.Field
Makes it clear that this is meant to be immutable and is supposedly
faster.

Task-number: QTCREATORBUG-17823
Change-Id: Ie5d67b793e0bc4f704981d5161efc12bcc22100a
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-03-09 08:20:46 +00:00
David Schulz
530f7972eb Debugger: Optimize QObject::staticMetaObject lookup
Change-Id: I8c06472ce4e33b7c4203934d93b9cc8c8ae95ce2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-03-07 09:46:23 +00:00
David Schulz
aafb17ae83 Debugger: Add enum value dumper to cdbbridge
Change-Id: I40f1556599be7581eeab0c75b034696ac22a7131
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-03-01 10:07:49 +00:00
Eike Ziller
e724934393 Merge remote-tracking branch 'origin/4.2'
Conflicts:
	doc/src/qtquick/creator-tutorial-create-qq-project.qdocinc
	doc/src/qtquick/qtquick-creating.qdoc
	doc/src/qtquick/qtquick-uiforms-tutorial.qdoc
	share/qtcreator/welcomescreen/qtcreator_tutorials.xml
	src/plugins/git/gitgrep.cpp
	src/shared/qbs

Change-Id: I6f4d168d888d9547c3af0819f79cc9ebb4186ca0
2017-02-14 15:32:04 +01:00
Orgad Shaneh
0c9f23db96 GDB: Fix printing of flag enums
It worked with plain GDB (parse_and_eval), and was broken by
696b2d4261.

Change-Id: Ibc143efdbd90681a2f9f4d84b75063eb98078f2b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-02-13 08:08:41 +00:00
Orgad Shaneh
696b2d4261 Debugger: Fix extremely slow enum name resolving
Task-number: QTCREATORBUG-17598
Change-Id: Ib32586c0513ce058301c1187e263c17b0a716f94
Reviewed-by: hjk <hjk@qt.io>
2017-02-08 16:55:17 +00:00
Eike Ziller
589fedf455 Merge remote-tracking branch 'origin/4.2'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri
	src/plugins/projectexplorer/kitinformation.cpp

Change-Id: I94299b069418586db97d1d596a252794e4037556
2016-12-20 17:14:19 +01:00
Christian Stenger
c14c1cfc16 Dumper: Fix expected symbol when using procedure linking table
Change-Id: Ib0aee418d515d58e6ad949a7cc86b21edb3bed80
Reviewed-by: hjk <hjk@qt.io>
2016-12-19 16:31:28 +00:00
hjk
fb57391767 Debugger: Make gdbbridge fetchVariable output similar to lldbbridge's
Change-Id: I11fc7d163dbd6b7deb5e88cac65dc61df3352411
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-12-19 10:37:16 +00:00
hjk
996a697094 Debugger: Fix QObject property extraction in namespaced Qt builds
Bail out on error results as early as possible.

The accessor always exists in libQt5Core, but it can't be found
when using a wrongly mangled name. Use the right one, and add
another sanity check before actually using the function.

Change-Id: I57975be188ca6b03836c0968e59d9603b0eecf27
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-12-16 09:00:03 +00:00
hjk
5c2a7b57e4 Debugger: Mimic parts of lldbbridge in gdbbridge
Make code more similar for later sharing.

Change-Id: I260e10ba1b613dfcebc45bb1a268b6fcebbde353
Reviewed-by: hjk <hjk@qt.io>
2016-12-16 07:41:34 +00:00
hjk
c2eada278e Debugger: Fix Window grabbing on GDB
Needs to make namespace detection work without valid frame

Task-number: QTCREATORBUG-17326
Change-Id: Ia7c7017db4ef384d4f246e11a5601d01f4f366f1
Reviewed-by: hjk <hjk@qt.io>
2016-12-15 17:22:18 +00:00
Christian Stenger
983936f975 Dumper: Fix QObject detection when using procedure linkage tables
Change-Id: I3ac9889b822cb30d2ccdb6a7e2452e753cc3f2df
Reviewed-by: hjk <hjk@qt.io>
2016-12-02 14:44:08 +00:00
hjk
dc2724a3f7 Debugger: Allow QObject property extraction without debug info
Task-number: QTCREATORBUG-16908
Change-Id: I1e1e9d91a6317808610f39868383b67e5c80a9a4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-12-02 13:26:00 +00:00
hjk
2275d68373 Debugger: Switch on QObject name display by default
... and use the option to govern general QObject guts display.

This allows people to completely avoid the performance impact
of attempted QObject display and still makes the feature
more prominent for our favorite use case.

Change-Id: I1e53b6448f646ab7eea9168a3cd24c77769e6328
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-12-02 11:23:46 +00:00
Christian Kandeler
00f9ee1a3e Debugger: Better fix to extract Qt namespace with GDB
Done-with: Christian Kandeler
Change-Id: Idf34bee297677e837085d55297a0d6e6341dd2c7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-11-24 16:21:21 +00:00
hjk
b26400e8ef Debugger: Workaround gdb.lookup_symbol ignoring QArrayData::shared_null
There have been cases observed where 'p QArrayData::shared_null' finds
valid symbols that are not found using gdb.lookup_symbols. The cause
for that is unknown.

Apply an expensive workaround by checking for (the equivalent of)
a working 'p QArrayData::shared_null' but execute it only when
a libQt5Core was found. This keeps the overhead for non-Qt setups
at a bearable (unsuccessful) iteration over known shared object
names.

Change-Id: Id398673b938d3c3a72c24317abdbefbe793e54df
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-11-16 09:32:42 +00:00
hjk
77fe2959ce Debugger: Fix a few return value types in putCallItem uses
Change-Id: If66fb7bf6726dd8ec3f630d11c004ac24fae4d06
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-11-14 07:37:09 +00:00
hjk
e94c87f1a7 Debugger: More quote cosmetics
That's a follow-up to 88e79e16a6a91

Change-Id: I19725bca1c547bd961094f2d00e85e170b2be33e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-11-11 12:56:48 +00:00
hjk
ae4d3c52e6 Debugger: Sanitize report of timings
Use Python's list and dict output directly, instead of
a manually stringified version thereof. Also, report
milliseconds instead of microseconds.

Change-Id: Ibcbdea732e7ecc58fd672bc5da794832215865b4
Reviewed-by: hjk <hjk@qt.io>
2016-11-10 20:14:25 +00:00
hjk
5fb2dc6e47 Debugger: Some dumper code cosmetics
Mostly quotes, remove some unneeded comments, ...

Change-Id: Ie3f410ac84e6cfe48e7971af948326abc21f2554
Reviewed-by: hjk <hjk@qt.io>
2016-11-10 19:59:47 +00:00
hjk
75be7de6f4 Debugger: Make dynamic type lookup more robust
... in builds without debug information.

Change-Id: I3842736aebe5b7c6b46d0ea1eec540dc3c088920
Reviewed-by: hjk <hjk@qt.io>
2016-11-10 19:22:25 +00:00