aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/python
AgeCommit message (Collapse)AuthorFilesLines
2025-01-08libstdc++: Make GDB skip over some library functions [PR118260]Jonathan Wakely1-0/+5
libstdc++-v3/ChangeLog: PR libstdc++/118260 * python/hook.in: Run 'skip' commands for some simple accessor functions.
2025-01-02Update copyright years.Jakub Jelinek5-5/+5
2024-11-28libstdc++: Reorder printer registrations in printers.pyJonathan Wakely1-4/+5
Register StdIntegralConstantPrinter with the other C++11 printers, and register StdTextEncodingPrinter after C++20 printers. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py: Reorder registrations.
2024-10-16libstdc++: Fix Python deprecation warning in printers.pyJonathan Wakely1-6/+13
python/libstdcxx/v6/printers.py:1355: DeprecationWarning: 'count' is passed as positional argument The Python docs say: Deprecated since version 3.13: Passing count and flags as positional arguments is deprecated. In future Python versions they will be keyword-only parameters. Using a keyword argument for count only became possible with Python 3.1 so introduce a new function to do the substitution. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (strip_fundts_namespace): New. (StdExpAnyPrinter, StdExpOptionalPrinter): Use it.
2024-08-27libstdc++: Do not use std::vector<bool>::reference default ctor [PR115098]Jonathan Wakely1-0/+3
This default constructor was made private by r15-3124-gb25b101bc38000 so the pretty printer tests need a fix to stop using it. There's no conforming way to get a default-constructed 'reference' now, e.g. trying to access an element of a default-constructed std::vector<bool> will trigger an assertion. Remove the tests, but leave a comment in the printer code about handling it. libstdc++-v3/ChangeLog: PR libstdc++/115098 * python/libstdcxx/v6/printers.py (StdBitReferencePrinter): Add comment. * testsuite/libstdc++-prettyprinters/simple.cc: Do not default construct std::vector<bool>::reference. * testsuite/libstdc++-prettyprinters/simple11.cc: Likewise.
2024-01-17libstdc++: Implement C++26 std::text_encoding (P1885R12) [PR113318]Jonathan Wakely1-0/+17
This is another C++26 change, approved in Varna 2023. We require a new static array of data that is extracted from the IANA Character Sets database. A new Python script to generate a header from the IANA CSV file is added. The text_encoding class is basically just a pointer to an {ID,name} pair in the static array. The aliases view is also just the same pointer (or empty), and the view's iterator moves forwards and backwards in the array while the array elements have the same ID (or to one element further, for a past-the-end iterator). Because those iterators refer to a global array that never goes out of scope, there's no reason they should every produce undefined behaviour or indeterminate values. They should either have well-defined behaviour, or abort. The overhead of ensuring those properties is pretty low, so seems worth it. This means that an aliases_view iterator should never be able to access out-of-bounds. A non-value-initialized iterator always points to an element of the static array even when not dereferenceable (the array has unreachable entries at the start and end, which means that even a past-the-end iterator for the last encoding in the array still points to valid memory). Dereferencing an iterator can always return a valid array element, or "" for a non-dereferenceable iterator (but doing so will abort when assertions are enabled). In the language being proposed for C++26, dereferencing an invalid iterator erroneously returns "". Attempting to increment/decrement past the last/first element in the view is erroneously a no-op, so aborts when assertions are enabled, and doesn't change value otherwise. Similarly, constructing a std::text_encoding with an invalid id (one that doesn't have the value of an enumerator) erroneously behaves the same as constructing with id::unknown, or aborts with assertions enabled. libstdc++-v3/ChangeLog: PR libstdc++/113318 * acinclude.m4 (GLIBCXX_CONFIGURE): Add c++26 directory. (GLIBCXX_CHECK_TEXT_ENCODING): Define. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Use GLIBCXX_CHECK_TEXT_ENCODING. * include/Makefile.am: Add new headers. * include/Makefile.in: Regenerate. * include/bits/locale_classes.h (locale::encoding): Declare new member function. * include/bits/unicode.h (__charset_alias_match): New function. * include/bits/text_encoding-data.h: New file. * include/bits/version.def (text_encoding): Define. * include/bits/version.h: Regenerate. * include/std/text_encoding: New file. * src/Makefile.am: Add new subdirectory. * src/Makefile.in: Regenerate. * src/c++26/Makefile.am: New file. * src/c++26/Makefile.in: New file. * src/c++26/text_encoding.cc: New file. * src/experimental/Makefile.am: Include c++26 convenience library. * src/experimental/Makefile.in: Regenerate. * python/libstdcxx/v6/printers.py (StdTextEncodingPrinter): New printer. * scripts/gen_text_encoding_data.py: New file. * testsuite/22_locale/locale/encoding.cc: New test. * testsuite/ext/unicode/charset_alias_match.cc: New test. * testsuite/std/text_encoding/cons.cc: New test. * testsuite/std/text_encoding/members.cc: New test. * testsuite/std/text_encoding/requirements.cc: New test. Reviewed-by: Ulrich Drepper <drepper.fsp@gmail.com> Reviewed-by: Patrick Palka <ppalka@redhat.com>
2024-01-11libstdc++: Add GDB printer for std::integral_constantJonathan Wakely1-0/+20
libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdIntegralConstantPrinter): Add printer for std::integral_constant. * testsuite/libstdc++-prettyprinters/cxx11.cc: Test it.
2024-01-03Update copyright years.Jakub Jelinek5-5/+5
2023-11-15libstdc++: Fix std::deque::operator[] Xmethod [PR112491]Jonathan Wakely1-4/+8
The Xmethod for std::deque::operator[] has the same bug that I recently fixed for the std::deque::size() Xmethod. The first node might have unused capacity at the start, which needs to be accounted for when indexing into the deque. libstdc++-v3/ChangeLog: PR libstdc++/112491 * python/libstdcxx/v6/xmethods.py (DequeWorkerBase.index): Correctly handle unused capacity at the start of the first node. * testsuite/libstdc++-xmethods/deque.cc: Check index operator when elements have been removed from the front.
2023-11-14libstdc++: Fix std::deque::size() Xmethod [PR112491]Jonathan Wakely1-5/+8
The Xmethod for std::deque::size() assumed that the first element would be at the start of the first node. That's only true if elements are only added at the back. If an element is inserted at the front, or removed from the front (or anywhere before the middle) then the first node will not be completely populated, and the Xmethod will give the wrong result. libstdc++-v3/ChangeLog: PR libstdc++/112491 * python/libstdcxx/v6/xmethods.py (DequeWorkerBase.size): Fix calculation to use _M_start._M_cur. * testsuite/libstdc++-xmethods/deque.cc: Check failing cases.
2023-10-04libstdc++: Correctly call _string_types functionTom Tromey1-1/+1
flake8 points out that the new call to _string_types from StdExpAnyPrinter.__init__ is not correct -- it needs to be qualified. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdExpAnyPrinter.__init__): Qualify call to _string_types.
2023-10-04libstdc++: _versioned_namespace is always non-NoneTom Tromey2-11/+7
Some code in the pretty-printers seems to assume that the _versioned_namespace global might be None (or the empty string). However, doesn't occur, as the variable is never reassigned. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py: Assume that _versioned_namespace is non-None. * python/libstdcxx/v6/xmethods.py (is_specialization_of): Assume that _versioned_namespace is non-None.
2023-10-04libstdc++: Define _versioned_namespace in xmethods.pyTom Tromey1-0/+2
flake8 pointed out that is_specialization_of in xmethods.py looks at a global that wasn't added to the file. This patch correct the oversight. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/xmethods.py (_versioned_namespace): Define.
2023-09-28libstdc++: Use Python "not in" operatorTom Tromey1-3/+3
flake8 warns about code like not something in "whatever" Ordinarily in Python this should be written as: something not in "whatever" This patch makes this change. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (Printer.add_version) (add_one_template_type_printer) (FilteringTypePrinter.add_one_type_printer): Use Python "not in" operator.
2023-09-28libstdc++: Remove std_ratio_t_tupleTom Tromey1-8/+0
This removes the std_ratio_t_tuple function from the Python pretty-printer code. It is not used. Apparently the relevant parts were moved to StdChronoDurationPrinter._ratio at some point in the past. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (std_ratio_t_tuple): Remove.
2023-09-28libstdc++: Remove unused locals from printers.pyTom Tromey1-2/+1
flake8 pointed out some unused local variables in the libstdc++ pretty-printers. This removes them. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdExpOptionalPrinter.__init__, lookup_node_type): Remove unused variables.
2023-09-28libstdc++: Remove unused Python importsTom Tromey2-3/+0
flake8 pointed out some unused imports. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py: Don't import 'os'. * python/libstdcxx/v6/__init__.py: Don't import 'gdb'.
2023-09-28libstdc++: Use gdb.ValuePrinter base classTom Tromey1-597/+606
GDB 14 will add a new ValuePrinter tag class that will be used to signal that pretty-printers will agree to the "extension protocol" -- essentially that they will follow some simple namespace rules, so that GDB can add new methods over time. A couple new methods have already been added to GDB, to support DAP. While I haven't implemented these for any libstdc++ printers yet, this patch makes the basic conversion: printers derive from gdb.ValuePrinter if it is available, and all "non-standard" (that is, not specified by GDB) members of the various value-printing classes are renamed to have a leading underscore. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py: Use gdb.ValuePrinter everywhere. Rename members to start with "_".
2023-09-28libstdc++: Refactor Python Xmethods to use is_specialization_ofJonathan Wakely1-12/+24
This copies the is_specialization_of function from printers.py (with slight modification for versioned namespace handling) and reuses it in xmethods.py to replace repetitive re.match calls in every class. This fixes the problem that the regular expressions used \d without escaping the backslash properly. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/xmethods.py (is_specialization_of): Define new function. (ArrayMethodsMatcher, DequeMethodsMatcher) (ForwardListMethodsMatcher, ListMethodsMatcher) (VectorMethodsMatcher, AssociativeContainerMethodsMatcher) (UniquePtrGetWorker, UniquePtrMethodsMatcher) (SharedPtrSubscriptWorker, SharedPtrMethodsMatcher): Use is_specialization_of instead of re.match.
2023-09-28libstdc++: Reformat Python codeJonathan Wakely1-47/+75
Some of these changes were suggested by autopep8's --aggressive option, others are for readability. Break long lines by splitting strings across multiple lines, or introducing local variables to hold results. Use raw strings for regular expressions, so that backslashes don't need to be escaped. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py: Break long lines. Use raw strings for regular expressions. Add whitespace around operators. (is_member_of_namespace): Use isinstance to check type. (is_specialization_of): Likewise. Adjust template_name for versioned namespace instead of duplicating the re.match call. (StdExpAnyPrinter._string_types): New static method. (StdExpAnyPrinter.to_string): Use _string_types.
2023-09-28libstdc++: Format Python docstrings according to PEP 357Jonathan Wakely2-97/+112
libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py: Format docstrings according to PEP 257. * python/libstdcxx/v6/xmethods.py: Likewise.
2023-09-27libstdc++: Fix format string in StdChronoTimeZoneRulePrinterJonathan Wakely1-1/+1
libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdChronoTimeZoneRulePrinter): Fix incorrect number of replacement fields.
2023-09-12libstdc++: Format Python code according to PEP8Jonathan Wakely2-263/+446
These files were filtered through autopep8 to reformat them more conventionally. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py: Reformat. * python/libstdcxx/v6/xmethods.py: Likewise.
2023-08-24libstdc++: Add pretty printer for std::localeJonathan Wakely1-0/+45
Print the locale's name, except when it uses the same named C locale for all categories except one, in which case print something like: std::locale = "en_GB.UTF-8" with "LC_CTYPE=en_US.UTF-8" libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdLocalePrinter): New printer class. * testsuite/libstdc++-prettyprinters/locale.cc: New test.
2023-08-24libstdc++: Declutter std::optional and std:variant pretty printers [PR110944]Jonathan Wakely1-2/+1
As the PR says, including the template arguments in the GDB output of these class templates can result in very long names, especially for std::variant. You can use 'whatis' or other GDB commands to get details of the type, we don't need to include it in the value. We could consider including the type if it's not too long, but I think consistency is better (and we already omit the template arguments for std::vector and other class templates). libstdc++-v3/ChangeLog: PR libstdc++/110944 * python/libstdcxx/v6/printers.py (StdExpOptionalPrinter): Do not show template arguments. (StdVariantPrinter): Likewise. * testsuite/libstdc++-prettyprinters/compat.cc: Adjust expected output. * testsuite/libstdc++-prettyprinters/cxx17.cc: Likewise. * testsuite/libstdc++-prettyprinters/libfundts.cc: Likewise.
2023-08-11libstdc++: Handle invalid values in std::chrono pretty printersJonathan Wakely1-1/+6
This avoids an IndexError exception when printing invalid chrono::month or chrono::weekday values. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdChronoCalendarPrinter): Check for out-of-range month an weekday indices. * testsuite/libstdc++-prettyprinters/chrono.cc: Check invalid month and weekday values.
2023-05-09libstdc++: Fix <chrono> pretty printers and add testsJonathan Wakely1-18/+26
This fixes a couple of errors in the printers for chrono types, and adds tests to ensure they keep working. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdChronoDurationPrinter): Print floating-point durations correctly. (StdChronoTimePointPrinter): Support printing only the value, not the type name. Uncomment handling for known clocks. (StdChronoZonedTimePrinter): Remove type names from output. (StdChronoCalendarPrinter): Fix hh_mm_ss member access. (StdChronoTimeZonePrinter): Add equals sign to output. * testsuite/libstdc++-prettyprinters/chrono.cc: New test.
2023-03-10libstdc++: Fix GDB Xmethod for std::shared_ptr::use_count() [PR109064]Jonathan Wakely1-1/+4
libstdc++-v3/ChangeLog: PR libstdc++/109064 * python/libstdcxx/v6/xmethods.py (SharedPtrUseCountWorker): Remove self-recursion in __init__. Add missing _supports. * testsuite/libstdc++-xmethods/shared_ptr.cc: Check use_count() and unique().
2023-01-16Update copyright years.Jakub Jelinek5-5/+5
2023-01-05libstdc++: Fix <chrono> printers for Python 2 [PR108212]Jonathan Wakely1-2/+17
The datetime.timezone.utc singleton doesn't exist in Python 2, but we can create it ourselves by deriving from datetime.tzinfo. libstdc++-v3/ChangeLog: PR libstdc++/108212 * python/libstdcxx/v6/printers.py (_utc_timezone): New global variable. (StdChronoTimePointPrinter::to_string): Use it.
2022-12-22libstdc++: Add GDB printers for <chrono> typesJonathan Wakely1-4/+261
libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdChronoDurationPrinter) (StdChronoTimePointPrinter, StdChronoZonedTimePrinter) (StdChronoCalendarPrinter, StdChronoTimeZonePrinter) (StdChronoLeapSecondPrinter, StdChronoTzdbPrinter) (StdChronoTimeZoneRulePrinter): New printers.
2022-11-16libstdc++: Fix std::any pretty printerJonathan Wakely1-3/+28
The recent changes to FilteringTypePrinter affect the result of gdb.lookup_type('std::string') in StdExpAnyPrinter, causing it to always return the std::__cxx11::basic_string specialization. This then causes a gdb.error exception when trying to lookup the std::any manager type for a specliaization using that string, but that manager was never instantiated in the program. This causes FAILs when running the tests with -D_GLIBCXX_USE_CXX11_ABI=0: FAIL: libstdc++-prettyprinters/libfundts.cc print as FAIL: libstdc++-prettyprinters/libfundts.cc print as The ugly solution used in this patch is to repeat the lookup for every type that std::string could be a typedef for, and hope it only works for one of them. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdExpAnyPrinter): Make expansion of std::string in manager name more robust.
2022-11-16libstdc++: Improve comments on pretty printer codeJonathan Wakely1-6/+14
libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (is_specialization_of): Fix incorrect terminology in docstring and describe arguments. (FilteringTypePrinter): Add default argument for new parameter, enhance docstring.
2022-11-16libstdc++: Fix gdb FilteringTypePrinterFrançois Dumont1-35/+49
Once we found a matching FilteringTypePrinter instance we look for the associated typedef and check that the returned Python Type is equal to the Type to recognize. But gdb Python Type includes properties to distinguish a typedef from the actual type. So use gdb.types.get_basic_type to check if we are indeed on the same type. Additionnaly enhance FilteringTypePrinter matching mecanism by introducing targ1 that, if not None, will be used as the 1st template parameter. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (FilteringTypePrinter): Rename 'match' field 'template'. Add self.targ1 to specify the first template parameter of the instantiation to match. (add_one_type_printer): Add targ1 optional parameter, default to None. Use gdb.types.get_basic_type to compare the type to recognize and the type returned from the typedef lookup. (register_type_printers): Adapt calls to add_one_type_printers.
2022-11-14libstdc++: Fix installation of python files for debug libJonathan Wakely2-0/+2
libstdc++-v3/ChangeLog: * python/Makefile.am (install-data-local): Use mkdirs_p for debug libdir. * python/Makefile.in: Regenerate.
2022-11-13libstdc++: Implement C++20 <format> [PR104166]Jonathan Wakely1-0/+27
This doesn't add the newer C++23 features like formatting ranges and escaped string prsentation types. However, C++23 extended floating-point types are supported, as are 128-bit integers. It could do with more tests. libstdc++-v3/ChangeLog: PR libstdc++/104166 * include/Makefile.am (std_headers): Add <format>. * include/Makefile.in: Regenerate. * include/precompiled/stdc++.h: Add <format>. * include/std/format: New file. * python/libstdcxx/v6/printers.py (StdFormatArgsPrinter): New printer for std::format_args. * testsuite/std/format/arguments/args.cc: New test. * testsuite/std/format/error.cc: New test. * testsuite/std/format/formatter.cc: New test. * testsuite/std/format/functions/format.cc: New test. * testsuite/std/format/functions/format_to_n.cc: New test. * testsuite/std/format/functions/size.cc: New test. * testsuite/std/format/functions/vformat_to.cc: New test. * testsuite/std/format/parse_ctx.cc: New test. * testsuite/std/format/string.cc: New test. * testsuite/std/format/string_neg.cc: New test.
2022-10-29libstdc++: Don't use gstdint.h anymoreArsen Arsenović1-1/+0
libstdc++-v3/ChangeLog: * configure.ac: Stop generating gstdint.h. * src/c++11/compatibility-atomic-c++0x.cc: Stop using gstdint.h. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * config.h.in: Regenerate. * configure: Regenerate. * doc/Makefile.in: Regenerate. * include/Makefile.in: Regenerate. * libsupc++/Makefile.in: Regenerate. * po/Makefile.in: Regenerate. * python/Makefile.in: Regenerate. * src/Makefile.in: Regenerate. * src/c++11/Makefile.in: Regenerate. * src/c++17/Makefile.in: Regenerate. * src/c++20/Makefile.in: Regenerate. * src/c++98/Makefile.in: Regenerate. * src/filesystem/Makefile.in: Regenerate. * src/libbacktrace/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate.
2022-10-11libstdc++: Allow emergency EH alloc pool size to be tuned [PR68606]Jonathan Wakely1-0/+1
Implement a long-standing request to support tuning the size of the emergency buffer for allocating exceptions after malloc fails, or to disable that buffer entirely. It's now possible to disable the dynamic allocation of the buffer and use a fixed-size static buffer, via --enable-libstdcxx-static-eh-pool. This is a built-time choice that is baked into libstdc++ and so affects all code linked against that build of libstdc++. The size of the pool can be set by --with-libstdcxx-eh-pool-obj-count=N which is measured in units of sizeof(void*) not bytes. A given exception type such as std::system_error depends on the target, so giving a size in bytes wouldn't be portable across 16/32/64-bit targets. When libstdc++ is configured to use a dynamic buffer, the size of that buffer can now be tuned at runtime by setting the GLIBCXX_TUNABLES environment variable (c.f. PR libstdc++/88264). The number of exceptions to reserve space for is controlled by the "glibcxx.eh_pool.obj_count" and "glibcxx.eh_pool.obj_size" tunables. The pool will be sized to be able to allocate obj_count exceptions of size obj_size*sizeof(void*) and obj_count "dependent" exceptions rethrown by std::rethrow_exception. With the ability to tune the buffer size, we can reduce the default pool size on 32-bit and 16-bit targets. Most users never need to throw 1kB exceptions in parallel from hundreds of threads after malloc is OOM. The users who do need that can use the tunables to select larger sizes. The old defaults can be chosen at runtime by setting GLIBCXX_TUNABLES to: 64-bit: glibcxx.eh_pool.obj_count=64:glibcxx.eh_pool.obj_size=112 32-bit: glibcxx.eh_pool.obj_count=32:glibcxx.eh_pool.obj_size=104 Or approximated by configuring with: 64-bit: --with-libstdcxx-eh-pool-obj-count=252 32-bit: --with-libstdcxx-eh-pool-obj-count=94 libstdc++-v3/ChangeLog: PR libstdc++/68606 * Makefile.in: Regenerate. * acinclude.m4 (GLIBCXX_EMERGENCY_EH_ALLOC): New macro. * configure: Regenerate. * configure.ac: Use GLIBCXX_EMERGENCY_EH_ALLOC. * crossconfig.m4: Check for secure_getenv. * doc/Makefile.in: Regenerate. * doc/xml/manual/configure.xml: Document new configure options. * doc/xml/manual/evolution.xml: Document addition of tunables. * doc/xml/manual/using_exceptions.xml: Document emergency buffer and tunables. * doc/html/*: Regenerate. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am: Use EH_POOL_FLAGS. * libsupc++/Makefile.in: Regenerate. * libsupc++/eh_alloc.cc (EMERGENCY_OBJ_SIZE): Define in units of sizeof(void*) not including the ABI's exception header. (EMERGENCY_OBJ_COUNT): Define as target-independent calculation based on word size. (MAX_OBJ_COUNT): Define macro for upper limit on pool size. (pool) [_GLIBCXX_EH_POOL_STATIC]: Use fixed-size buffer. (pool::buffer_size_in_bytes): New static member function. (pool::pool): Parse GLIBCXX_TUNABLES environment variable to set pool size at runtime. (pool::in_pool): Use std::less<void*> for total order. (__freeres) [_GLIBCXX_EH_POOL_STATIC]: Do nothing. (__cxa_free_exception, __cxa_free_dependent_exception): Add [[unlikely]] attributes. * po/Makefile.in: Regenerate. * python/Makefile.in: Regenerate. * src/Makefile.in: Regenerate. * src/c++11/Makefile.in: Regenerate. * src/c++17/Makefile.in: Regenerate. * src/c++20/Makefile.in: Regenerate. * src/c++98/Makefile.in: Regenerate. * src/filesystem/Makefile.in: Regenerate. * src/libbacktrace/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate.
2022-10-03libstdc++: Fix gdb pretty printers when dealing with std::stringFrançois Dumont1-3/+18
Since revision 33b43b0d8cd2de722d177ef823930500948a7487 std::string and other similar typedef are ambiguous from a gdb point of view because it matches both std::basic_string<char> and std::__cxx11::basic_string<char> symbols. For those typedef add a workaround to accept the substitution as long as the same regardless of __cxx11 namespace. Also avoid to register printers for types in std::__cxx11::__8:: namespace, there is no such symbols. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (Printer.add_version): Do not add version namespace for __cxx11 symbols. (add_one_template_type_printer): Likewise. (add_one_type_printer): Likewise. (FilteringTypePrinter._recognizer.recognize): Add a workaround for std::string & al ambiguous typedef matching both std:: and std::__cxx11:: symbols. * testsuite/libstdc++-prettyprinters/cxx17.cc: Remove obsolete \#define _GLIBCXX_USE_CXX11_ABI 0. * testsuite/libstdc++-prettyprinters/simple.cc: Likewise. Adapt test to accept std::__cxx11::list. * testsuite/libstdc++-prettyprinters/simple11.cc: Likewise. * testsuite/libstdc++-prettyprinters/whatis.cc: Likewise. * testsuite/libstdc++-prettyprinters/80276.cc: Likewise and remove xfail for c++20 and debug mode. * testsuite/libstdc++-prettyprinters/libfundts.cc: Likewise.
2022-09-29libstdc++: [_GLIBCXX_INLINE_VERSION] Add gdb pretty print for _GLIBCXX_DEBUGFrançois Dumont1-0/+4
In _GLIBCXX_DEBUG mode containers are in std::__debug namespace but not template parameters. In _GLIBCXX_INLINE_VERSION mode most types are in std::__8 namespace but not std::__debug containers. We need to register specific type printers for this combination. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (add_one_template_type_printer): Register printer for types in std::__debug namespace with template parameters in std::__8 namespace.
2022-09-22libstdc++: Remove useless gdb printer registrationsFrançois Dumont1-5/+0
libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py: Remove ptinter registration for non-existing types std::__debug::unique_ptr, std::__debug::stack, std::__debug::queue, std::__debug::priority_queue.
2022-09-14libstdc++: Add pretty printer for std::stringstreamsPhilipp Fent1-0/+56
To display (o-,i-)stringstreams in the common case, we just print the underlying stringbuf, without the many ios_base members. In the unconventional case that the underlying streambuf was redirected, we report the redirected target. Signed-off-by: Philipp Fent <fent@in.tum.de> libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (access_streambuf_ptrs): New helper function. (StdStringBufPrinter, StdStringStreamPrinter): New printers. (build_libstdcxx_dictionary): Register stringstream printers. * testsuite/libstdc++-prettyprinters/debug.cc: Check string streams. * testsuite/libstdc++-prettyprinters/simple.cc: Likewise. * testsuite/libstdc++-prettyprinters/simple11.cc: Likewise.
2022-08-04Adjust index number of tuple pretty printerUlrich Drepper1-2/+2
The tuple pretty printer uses 1-based indeces which is quite confusing considering the access to the same values with the std::get functions uses 0-based indeces. This patch changes the pretty printer since this is not a guaranteed API. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (class StdTuplePrinter): Use zero-based indeces just like std:get takes.
2022-05-26libstdc++: Fix atomic and error_code printers for versioned namespaceJonathan Wakely1-3/+12
This fixes the printers to work with std::__8::atomic and std::__v8::ios_errc and std::__v8::future_errc. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdErrorCodePrinter): Make lookup for ios_errc and future_errc check versioned namespace. (StdAtomicPrinter): Strip versioned namespace from typename.
2022-05-26libstdc++: Fix printing of std::span for versioned namespaceFrançois Dumont1-2/+2
libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdSpanPrinter.__init__): Strip typename from version namespace.
2022-05-26libstdc++: Fix printing of std::atomic<shared_ptr<T>> for versioned namespaceJonathan Wakely1-1/+2
libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (SharedPointerPrinter): Strip versioned namespace from the template argument too.
2022-04-27libstdc++: Add pretty printer for std::atomicJonathan Wakely1-3/+50
For the atomic specializations for shared_ptr and weak_ptr we can reuse the existing SharedPointerPrinter, with a small tweak. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (SharedPointerPrinter): Add support for atomic<shared_ptr<T>> and atomic<weak_ptr<T>>. (StdAtomicPrinter): New printer. (build_libstdcxx_dictionary): Register new printer. * testsuite/libstdc++-prettyprinters/cxx11.cc: Test std::atomic. * testsuite/libstdc++-prettyprinters/cxx20.cc: Test atomic smart pointers.
2022-04-25libstdc++: Add pretty printer for std::initializer_listPhilipp Fent1-2/+22
Re-using the std::span printer, this now shows the contents of the initializer list instead of the pointer and length members. Signed-off-by: Philipp Fent <fent@in.tum.de> libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdSpanPrinter._iterator): Rename as iterator. (StdInitializerListPrinter): Define new printer. (build_libstdcxx_dictionary): Register new printer. * testsuite/libstdc++-prettyprinters/cxx11.cc: Check printer for initializer_list.
2022-04-19libstdc++: Add pretty printer for std::spanPhilipp Fent1-0/+38
This improves the debug output for C++20 spans. Before: {static extent = 18446744073709551615, _M_ptr = 0x7fffffffb9a8, _M_extent = {_M_extent_value = 2}} Now with StdSpanPrinter: std::span of length 2 = {1, 2} Signed-off-by: Philipp Fent <fent@in.tum.de> libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdSpanPrinter): Define. * testsuite/libstdc++-prettyprinters/cxx20.cc: Test it.
2022-02-17libstdc++: Make std::error_code printer more robustJonathan Wakely1-17/+93
This attempts to implement a partial workaround for the GDB bug https://sourceware.org/bugzilla/show_bug.cgi?id=28856 which causes GDB to crash when printing a frame with a std::error_code argument. By recognising the known error categories defined in the library and hardcoding their names we do not need to call cat->name() on the category. This has the additional benefit of also working when debugging a core file rather than a running process. For those known categories we can also cast the int value to the corresponding error code enum (e.g. future_errc) so that we show an enumerator instead of just an integer. For program-defined categories we just use the name of the dynamic type to identify the category, and print the value as an integer. Once the GDB bug is fixed and the virtual name() function can be called safely, that would be preferable. For now it's better to have an imperfect printer that doesn't crash GDB. This rewritten StdErrorCodePrinter needs gdb.Value.dynamic_type, so is only registered if that is supported, which means GDB 7.7 and later. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdErrorCodePrinter): Replace code that call cat->name() on std::error_category objects. Identify known categories by symbol name and use a hardcoded name. Print error code values as enumerators where appopriate. * testsuite/libstdc++-prettyprinters/cxx11.cc: Adjust expected name of custom category. Check io_errc and future_errc errors.