summaryrefslogtreecommitdiff
path: root/libjava/classpath/gnu/java/beans/decoder/ArrayHandler.java
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2025-11-03 14:02:22 -0700
committerTom Tromey <tromey@adacore.com>2025-11-14 12:10:16 -0700
commitde124ffe1439d63e4531f8aaf3641bb8f4260c33 (patch)
tree4dafa2795cb6170e9a7f8179beab015d931dc1a1 /libjava/classpath/gnu/java/beans/decoder/ArrayHandler.java
parentf94a73e0fcedf7a05b04aa12beee57b9a82859a5 (diff)
Add 'num_children' method to relevant pretty-printers
A user pointed out that, in DAP mode, gdb would hang while trying to display a certain vector. See https://sourceware.org/bugzilla/show_bug.cgi?id=33594 This is caused by a combination of things: the vector is uninitialized, DAP requires a count of the number of children of a variable, and libstdc++ printers don't implement the 'num_children' method, so gdb tries to count children by iterating. In this case, the vector has a nonsensical size: (gdb) p myVector $1 = std::vector of length -34979931, capacity -33992726 This patch adds a 'num_children' method to a subset of the pretty-printers, in particular ones where I thought the length might be arbitrarily large and susceptible to being garbage when the object isn't initialized. I've also specifically added a check to the vector printer for the case where the length is negative. These container printers could be further improved by adding the 'child' method, allowing random access to child objects. However I haven't done that here. libstdc++-v3/ChangeLog * python/libstdcxx/v6/printers.py (StdVectorPrinter._bounds): New method. (StdVectorPrinter.to_string): Use it. (StdVectorPrinter.num_children): New method. (StdStackOrQueuePrinter.num_children): New method. (StdMapPrinter.num_children): New method. (StdSetPrinter.num_children): New method. (StdDequePrinter._size): New method. (StdDequePrinter.to_string): Use it. (StdDequePrinter.num_children): New method. (Tr1UnorderedSetPrinter.num_children): New method. (Tr1UnorderedMapPrinter.num_children): New method. (StdSpanPrinter.num_children): New method.
Diffstat (limited to 'libjava/classpath/gnu/java/beans/decoder/ArrayHandler.java')
0 files changed, 0 insertions, 0 deletions