From: Simon Farre <simon.farre.cx@gmail.com>
To: gdb-patches@sourceware.org
Cc: Simon Farre <simon.farre.cx@gmail.com>
Subject: [PATCH v1] gdb/DAP Fix LazyString not serializable exception
Date: Fri, 23 Jun 2023 10:37:25 +0200 [thread overview]
Message-ID: <20230623083725.12846-1-simon.farre.cx@gmail.com> (raw)
Fixed this bug in v1 of a patch that later got removed.
I couldn't reproduce the issue, but now I've found out what it is.
I've reproduced it by basically sending two evaluate requests, "source
prettyprinter.py" (the stdlib pretty printer, to be exact) and "py
register_libstdcxx_printers(gdb.current_objfile())" - i.e. the standard
library pretty printer registering.
That's when an exception is raised by the DAP Python code. It is most
likely because the pretty printers somewhere, for something, returns a
LazyString instead of string.
This patch will make variable references value always be str(...) to
make sure that it converts it to a value that can be serialiable by
json.dumps.
---
gdb/python/lib/gdb/dap/varref.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/python/lib/gdb/dap/varref.py b/gdb/python/lib/gdb/dap/varref.py
index 213151fd3d3..6b12da56c82 100644
--- a/gdb/python/lib/gdb/dap/varref.py
+++ b/gdb/python/lib/gdb/dap/varref.py
@@ -152,7 +152,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 (
--
2.41.0
reply other threads:[~2023-06-23 8:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230623083725.12846-1-simon.farre.cx@gmail.com \
--to=simon.farre.cx@gmail.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).