Handle gdb.LazyString in DAP

Andry pointed out that the DAP code did not properly handle
gdb.LazyString results from a pretty-printer, yielding:

    TypeError: Object of type LazyString is not JSON serializable

This patch fixes the problem, partly with a small patch in varref.py,
but mainly by implementing tp_str for LazyString.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
This commit is contained in:
Tom Tromey
2023-10-04 11:22:05 -06:00
parent 8836926927
commit ba0725dfa0
6 changed files with 170 additions and 2 deletions

View File

@ -173,7 +173,7 @@ class VariableReference(BaseReference):
def to_object(self):
result = super().to_object()
result[self.result_name] = self.printer.to_string()
result[self.result_name] = str(self.printer.to_string())
num_children = self.child_count()
if num_children is not None:
if (