mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-06 07:33:08 +00:00
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>
This commit is contained in:
@@ -21,7 +21,7 @@ import gdb
|
|||||||
import gdb.printing
|
import gdb.printing
|
||||||
|
|
||||||
from .server import client_bool_capability
|
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.
|
# A list of all the variable references created during this pause.
|
||||||
all_variables = []
|
all_variables = []
|
||||||
@@ -226,6 +226,11 @@ class VariableReference(BaseReference):
|
|||||||
num_children = self._printer.num_children()
|
num_children = self._printer.num_children()
|
||||||
if num_children is None:
|
if num_children is None:
|
||||||
num_children = len(self.cache_children())
|
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
|
self.count = num_children
|
||||||
return self.count
|
return self.count
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user