This is an archive of the discontinued LLVM Phabricator instance.

[lldb/Reproducers] Decode run-length encoding in GDB replay server.
ClosedPublic

Authored by JDevlieghere on Mar 13 2020, 2:15 PM.

Details

Summary

The GDB replay server sanity-checks that every packet it receives matches what it expects from the serialized packet log. This mechanism tripped for TestReproducerAttach.py on Linux, because one of the packets (jModulesInfo) uses run-length encoding. The replay server was comparing the expanded incoming packet with the unexpanded packet in the log. As a result, it claimed to have received an unexpected packet, which caused the test to fail.

This patch addresses that issue by expanding the run-length encoding before comparing the packets.

Diff Detail

Event Timeline

JDevlieghere created this revision.Mar 13 2020, 2:15 PM

Share RLE-decoding logic.

This revision is now accepted and ready to land.Mar 13 2020, 2:36 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2020, 9:15 AM
shafik added a subscriber: shafik.Mar 16 2020, 10:28 AM
shafik added inline comments.
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
1374

This line feels cryptic. Why 3 and ' '. Maybe two lines would be better, still have to think carefully about order of operations too.

The code is using three representations for characters: char literals, raw integers and hex. Maybe use hex everywhere would be more consistent.