This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Fix python errors in gdbremote.py
ClosedPublic

Authored by ddcc on Mar 1 2022, 10:59 PM.

Details

Summary

Fix exceptions encountered while debugging gdb protocol

Diff Detail

Event Timeline

ddcc created this revision.Mar 1 2022, 10:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2022, 10:59 PM
ddcc requested review of this revision.Mar 1 2022, 10:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2022, 10:59 PM
kastiglione added inline comments.Mar 2 2022, 7:51 AM
lldb/examples/python/gdbremote.py
1224–1225

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?

ddcc added inline comments.Mar 2 2022, 4:29 PM
lldb/examples/python/gdbremote.py
1224–1225

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.

kastiglione accepted this revision.Mar 2 2022, 4:51 PM

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

lldb/examples/python/gdbremote.py
1224–1225

thanks for the explanation. My only suggestion is to handle that case explicitly, by checking that the response is not empty before decoding.

This revision is now accepted and ready to land.Mar 2 2022, 4:51 PM
This revision was automatically updated to reflect the committed changes.
ddcc marked an inline comment as done.Mar 2 2022, 7:48 PM