[Lldb-commits] [PATCH] D120792: [lldb] Fix python errors in gdbremote.py

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 2 16:51:39 PST 2022


kastiglione accepted this revision.
kastiglione added a comment.
This revision is now accepted and ready to land.

other than the comment about the json, looks all good to me!



================
Comment at: lldb/examples/python/gdbremote.py:1224-1225
+        print(json.dumps(json_tree, indent=4, separators=(',', ': ')))
+    except json.JSONDecodeError:
+        return
 
----------------
ddcc wrote:
> kastiglione wrote:
> > I don't know this tool, but should it print the original json (`rsp`) if there's an issue when decoding the json? Or should it print a message saying invalid json was given?
> The contents of each packet are already printed earlier, this change only affects the "jThreadsInfo" message which is supposed to return a JSON response. But servers are allowed to return an empty response if they don't support a protocol message, which will fail to decode as valid JSON.
thanks for the explanation. My only suggestion is to handle that case explicitly, by checking that the response is not empty before decoding.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120792/new/

https://reviews.llvm.org/D120792



More information about the lldb-commits mailing list