Handle gdb.LazyString in DAP
authorTom Tromey <tromey@adacore.com>
Wed, 4 Oct 2023 17:22:05 +0000 (11:22 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 16 Oct 2023 15:27:28 +0000 (09:27 -0600)
commitee81567c7cdf6aaae4b565c2afc3d4b798717177
treecbee986f38d57d67a8152f95f7239e0185a7817f
parent138c7d2661044d80dddc0445616aada039af1a95
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>
gdb/NEWS
gdb/python/lib/gdb/dap/varref.py
gdb/python/py-lazy-string.c
gdb/testsuite/gdb.dap/lazy-string.c [new file with mode: 0644]
gdb/testsuite/gdb.dap/lazy-string.exp [new file with mode: 0644]
gdb/testsuite/gdb.dap/lazy-string.py [new file with mode: 0644]