162 Commits

Author SHA1 Message Date
Tom Tromey
58d926ac62 Handle access types in hash node
An indefinite hash map holds accesses to its key and value.  As these
are introduced by the map itself, it makes sense to automatically
dereference them.

TN: V518-039
Change-Id: I91412189d6c274eb3030355886d0bf8141cb07e4
2022-10-17 08:38:18 +00:00
Pierre-Marie de Rodat
1508448c43 containers/regular-map-access: new testcase
TN: V518-039
Change-Id: I5ef803143924cadb92da3b4a5667613a3b1629c3
2022-10-12 19:38:57 +00:00
Pierre-Marie de Rodat
305439776b Add py.typed so that gnatdbg users can easily use Mypy
TN: V707-013
Change-Id: Ief7bd7b5768a9a6444f0cff4a1ce5fb9df7ee07d
2022-07-07 11:41:13 +00:00
Pierre-Marie de Rodat
91fee792af setup.py: transition to setuptools
Also reformat it for black&flake8, and get the version number from the
VERSION file.

Change-Id: I5495a88f75bae224a21e4a125af4b4869b38727a
TN: V707-013
2022-07-07 11:41:10 +00:00
Pierre-Marie de Rodat
430a77d4ec gnatdbg: add type hints
Change-Id: Ib0f0cafe4927fc3c581f58d2e90a502b5b3a1544
TN: V707-013
2022-07-07 11:37:40 +00:00
Pierre-Marie de Rodat
446eef633d gnatdbg.maps: update matcher for GNAT.Dynamic_HTable.Simple_HTable
It seems that with recent GNAT versions, there is no longer a typedef
type layer around the table array type, so remove the corresponding
matcher layer.

TN: V605-001
Change-Id: I3c45ba2910a7a604042108ec0daf673f1361c7bc
2022-07-07 11:20:26 +00:00
Piotr Trojanek
4cc98050b8 Add pretty-printer for GNAT.Dynamic_HTables.Simple_HTable
TN: V605-001
Change-Id: I3773ff2fd4e0a554db5ac4fdc9c51ead4a1f7201
2022-06-20 12:17:47 +02:00
Piotr Trojanek
41d4a3e605 Fix copy-paste glitches in name of hashed cursor pretty-printers
no-tn-check

Change-Id: I12e06c552c0b4b5a5f99e2fc63d2e59cd72db226
2022-06-03 16:36:23 +02:00
Tom Tromey
361dac90fb Simplify string printing
Right now, gnat-gdb-scripts implements its own string formatting code,
I think so that it can also show the type and address in the output.
However, this is a bit verbose, and the experience with the C++
printers is that just showing the string data seems fine for users.

This patch simplifies the string printing to use lazy_string and use
the "string" display hint.  If we do want to restore the type and/or
address, it seems preferable to add this to gdb proper.

Change-Id: Id06781a3ae52bddc88a4c75ed8fa42de30ba15d8
no-tn-check
2022-06-01 12:16:36 +00:00
Tom Tromey
d23f217295 Remove parameters from super calls
In a review, Pierre-Marie pointed out that super calls don't need the
class name in Python 3.  This patch cleans this up throughout the
code.

no-tn-check

Change-Id: Ie45bf3a25a91586d36749626db50fe3103e84f9f
2022-06-01 12:14:52 +00:00
Tom Tromey
d843fd4988 Fix regession in self tests
My previous change introduced a regression, because it removed
register_pretty_printers but did not update one test that called this
explicitly.

no-tn-check

Change-Id: Iddeebe0fdfe4b737ccb20a5db4eacada0a03cbc6
2022-05-31 10:58:54 -06:00
Tom Tromey
d904300bdd Simplify registration and make printers Ada-specific
This patch simplifies pretty-printer registration.  In particular,
they are now simply registered globally.

In conjunction with this, the printers are now changed to only
activate when the current language is Ada.  This requires a small gdb
patch to expose this information; there is a patch pending for this.

I examined a few different approaches here, becase there are two
different problems to avoid.  One is that, with the new DWARF reader,
it's best to defer symbol lookups as long as possible -- a symbol
lookup requires waiting for the DWARF scan to finish, which introduces
a user-visible pause.  The second problem is that, because many Ada
programs are statically linked, the usual approach of a .py file
associated with a shared library would not work.  (We could use a
.debug_gdb_scripts section, but this has other issues.)

I settled on this approach as it seems to be reasonable, and provides
what users probably want anyway.

Change-Id: I40a598272143fd61ec3be685906f3b4812781907
TN: V518-040
2022-05-24 10:25:19 -06:00
Tom Tromey
4e61e7343e Add .flake8 and .pre-commit files
This adds .flake8 and .pre-commit files, to make it easier to share
the reformatting and checking configuration.  pep8.ini is removed in
favor of flake8.  I took the flake8 setup from gdb-testsuite.

no-tn-check
Change-Id: I1532c08e9731697a57d3714e3d07b84db4c1b5bd
2022-05-19 09:22:29 -06:00
Tom Tromey
c8645061b5 Two flake8 fixes in utils.py
flake8 does not like the use of a lambda in utils.py, preferring a
'def'.  It also prefers the use of a set comprehension rather than an
explicit call to 'set'.

no-tn-check
Change-Id: I8281118ba6baf7d3306b1f756e8870fe76f96e1d
2022-05-19 09:22:29 -06:00
Tom Tromey
c683bab47e Remove two unused imports
flake8 points out two unused imports -- remove these.

no-tn-check
Change-Id: Icc5284a19d8ec3e46fb9cc25cf6982415a4508b6
2022-05-19 09:22:29 -06:00
Tom Tromey
2bc47372f8 Run 'black' on gnatdbg/
This runs 'black' on the .py files in gnatdbg/.

no-tn-check
Change-Id: I25f135641054271d283ba350a977b4d1d7fe4539
2022-05-19 09:22:29 -06:00
Tom Tromey
0deda2f525 Fix a typo in README.md
This fixes a typo in README.md.

no-tn-check

Change-Id: Ia85e59009710859e942cc812c4ef60ad820f17e0
2022-05-17 10:07:55 -06:00
Pierre-Marie de Rodat
f6d252f680 Use gdb.Architecture.integer_type to fix big numbers handling on Windows
TN: UA19-042
Change-Id: I62cbdc5fdd8371b80edec0f27b136ba9ccde35e8
2021-11-03 14:41:05 +00:00
Pierre-Marie de Rodat
a1b255982b Put coverage report production code in a script file
Recently, GDB has started printing one ">" prompt per line in the
"python" command. For instance, when the input is:

    python
    pass
    pass
    pass
    end

GDB prints:

    >>>(gdb)
    [plus a trailing space, i.e. the main prompt]

Since this breaks the current regexp that matches GDB prompts ("^(gdb)
", so the pexpect machinery hangs), switch to using a script file
instead to workaround this problem.

TN: U622-042
Change-Id: I0e6d6cc23a6b8ed350c1bc695bbd79913a8adecf
2021-11-03 14:40:11 +00:00
Pierre-Marie de Rodat
261f784372 big-integers/big-reals: add XFAILs on Windows
Change-Id: I88d13b781bd9060d50fa330c752b027cdc9e264b
TN: UA19-042
2021-10-22 17:37:13 +02:00
Pierre-Marie de Rodat
64eb0739fa Add a .gitreview file
Change-Id: Iebf119b41ee15510d65f2da2f1c5c1836e41f7b2
no-tn-check

Change-Id: I3d5f60204f4a311a7b204ec8afab2943f7bcab9c
2021-10-20 15:40:53 +00:00
Pierre-Marie de Rodat
053d33f266 Add support for Ada 2022's Big_Integer and Big_Real
TN: UA19-042
Change-Id: If877215b73663e73cbb399b49702edb347dce08b
2021-10-20 15:39:52 +00:00
Pierre-Marie de Rodat
c81db28966 Testsuite: switch to Python3 and e3-testsuite
Also introduce a Mypy setup, to type-check the testsuite code (only that
for now).

Change-Id: Ib90b1ac7e344fb34c7560dc0ff32ca95e0705cd7
TN: U622-042
2021-10-13 11:48:31 +02:00
Pierre-Marie de Rodat
dd0d8a1cf7 Update type names in baselines after recent GDB improvements
GDB now exposes decoded type names through the Python API (foo.bar
instead of foo__bar): update baselines in relevant tests accordingly.

Change-Id: I1b3b75dcbeb766ee6bcffd695f6771a4f3930aa1
TN: N224-026
2021-06-17 16:18:53 +02:00
Tom Tromey
06ae420af9 Update expected results for minimal encodings
GNAT is switching to minimal encodings by default, and this change
affects the type names that are visible in gdb.  This patch updates
one test that now fails.

TN: U610-001
Change-Id: Ic678ab3b50ac83950f5a9ff29d3f3c0f4aa11b4f
2021-06-10 11:06:58 -06:00