diff options
| author | Tom Tromey <tromey@adacore.com> | 2025-11-04 08:56:08 -0700 |
|---|---|---|
| committer | Tom Tromey <tromey@adacore.com> | 2025-11-14 12:27:20 -0700 |
| commit | 3917afa371cff7df1d755386e7bb0ae803e2f94c (patch) | |
| tree | 2cb1b20ae5bd7b4855029f389dcfb6d2dc786aaa /gdb/python/lib | |
| parent | 4cea26197d336ec71e61bf2c705518b8751fc385 (diff) | |
| download | binutils-3917afa371cff7df1d755386e7bb0ae803e2f94c.tar.gz binutils-3917afa371cff7df1d755386e7bb0ae803e2f94c.tar.bz2 binutils-3917afa371cff7df1d755386e7bb0ae803e2f94c.zip | |
Reject negative children in DAP
This changes DAP to ignore the case where a pretty-printer returns a
negative number from the num_children method. It didn't seem worth
writing a test case for this.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33594
Reviewed-By: Ciaran Woodward <ciaranwoodward@xmos.com>
Diffstat (limited to 'gdb/python/lib')
| -rw-r--r-- | gdb/python/lib/gdb/dap/varref.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gdb/python/lib/gdb/dap/varref.py b/gdb/python/lib/gdb/dap/varref.py index d18197b8450..f5ffe34f7f5 100644 --- a/gdb/python/lib/gdb/dap/varref.py +++ b/gdb/python/lib/gdb/dap/varref.py @@ -21,7 +21,7 @@ import gdb import gdb.printing from .server import client_bool_capability -from .startup import DAPException, in_gdb_thread +from .startup import DAPException, in_gdb_thread, log # A list of all the variable references created during this pause. all_variables = [] @@ -226,6 +226,11 @@ class VariableReference(BaseReference): num_children = self._printer.num_children() if num_children is None: num_children = len(self.cache_children()) + elif num_children < 0: + # It doesn't make sense to have a negative number of + # children. + log("pretty printer returned negative children") + num_children = 0 self.count = num_children return self.count |
