- Jan 08, 2025
-
-
Jonathan Wakely authored
libstdc++-v3/ChangeLog: PR libstdc++/118260 * python/hook.in: Run 'skip' commands for some simple accessor functions.
-
- Jan 02, 2025
-
-
Jakub Jelinek authored
-
- Nov 28, 2024
-
-
Jonathan Wakely authored
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.
-
- Oct 16, 2024
-
-
Jonathan Wakely authored
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.
-
- Aug 27, 2024
-
-
Jonathan Wakely authored
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.
-
- Jan 17, 2024
-
-
Jonathan Wakely authored
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>
-
- Jan 11, 2024
-
-
Jonathan Wakely authored
libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdIntegralConstantPrinter): Add printer for std::integral_constant. * testsuite/libstdc++-prettyprinters/cxx11.cc: Test it.
-
- Jan 03, 2024
-
-
Jakub Jelinek authored
-
- Nov 15, 2023
-
-
Jonathan Wakely authored
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.
-
- Nov 14, 2023
-
-
Jonathan Wakely authored
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.
-
- Oct 04, 2023
-
-
Tom Tromey authored
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.
-
Tom Tromey authored
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.
-
Tom Tromey authored
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.
-
- Sep 28, 2023
-
-
Tom Tromey authored
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.
-
Tom Tromey authored
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.
-
Tom Tromey authored
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.
-
Tom Tromey authored
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'.
-
Tom Tromey authored
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 "_".
-
Jonathan Wakely authored
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.
-
Jonathan Wakely authored
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.
-
Jonathan Wakely authored
libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py: Format docstrings according to PEP 257. * python/libstdcxx/v6/xmethods.py: Likewise.
-
- Sep 27, 2023
-
-
Jonathan Wakely authored
libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdChronoTimeZoneRulePrinter): Fix incorrect number of replacement fields.
-
- Sep 12, 2023
-
-
Jonathan Wakely authored
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.
-
- Aug 24, 2023
-
-
Jonathan Wakely authored
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.
-
Jonathan Wakely authored
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.
-
- Aug 11, 2023
-
-
Jonathan Wakely authored
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.
-
- May 09, 2023
-
-
Jonathan Wakely authored
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.
-
- Mar 10, 2023
-
-
Jonathan Wakely authored
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().
-
- Jan 16, 2023
-
-
Jakub Jelinek authored
-
- Jan 05, 2023
-
-
Jonathan Wakely authored
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.
-
- Dec 22, 2022
-
-
Jonathan Wakely authored
libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdChronoDurationPrinter) (StdChronoTimePointPrinter, StdChronoZonedTimePrinter) (StdChronoCalendarPrinter, StdChronoTimeZonePrinter) (StdChronoLeapSecondPrinter, StdChronoTzdbPrinter) (StdChronoTimeZoneRulePrinter): New printers.
-
- Nov 16, 2022
-
-
Jonathan Wakely authored
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.
-
Jonathan Wakely authored
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.
-
François Dumont authored
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.
-
- Nov 14, 2022
-
-
Jonathan Wakely authored
libstdc++-v3/ChangeLog: * python/Makefile.am (install-data-local): Use mkdirs_p for debug libdir. * python/Makefile.in: Regenerate.
-
- Nov 13, 2022
-
-
Jonathan Wakely authored
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.
-
- Oct 28, 2022
-
-
Arsen Arsenović authored
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.
-
- Oct 11, 2022
-
-
Jonathan Wakely authored
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.
-
- Oct 03, 2022
-
-
François Dumont authored
Since revision 33b43b0d 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.
-
- Sep 29, 2022
-
-
François Dumont authored
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.
-