aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.dap/lazy-string.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-10-04 11:22:05 -0600
committerTom Tromey <tromey@adacore.com>2023-10-16 09:27:28 -0600
commitee81567c7cdf6aaae4b565c2afc3d4b798717177 (patch)
treecbee986f38d57d67a8152f95f7239e0185a7817f /gdb/testsuite/gdb.dap/lazy-string.c
parent138c7d2661044d80dddc0445616aada039af1a95 (diff)
downloadbinutils-ee81567c7cdf6aaae4b565c2afc3d4b798717177.zip
binutils-ee81567c7cdf6aaae4b565c2afc3d4b798717177.tar.gz
binutils-ee81567c7cdf6aaae4b565c2afc3d4b798717177.tar.bz2
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>
Diffstat (limited to 'gdb/testsuite/gdb.dap/lazy-string.c')
-rw-r--r--gdb/testsuite/gdb.dap/lazy-string.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.dap/lazy-string.c b/gdb/testsuite/gdb.dap/lazy-string.c
new file mode 100644
index 0000000..9df48bf
--- /dev/null
+++ b/gdb/testsuite/gdb.dap/lazy-string.c
@@ -0,0 +1,23 @@
+/* Copyright 2023 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int
+main ()
+{
+ const char *the_string = "DEI";
+ return 0; /* STOP */
+}