This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [gdb-remote] Add eOpenOptionReadWrite for future gdb compat
ClosedPublic

Authored by mgorny on Jul 28 2021, 12:36 PM.

Details

Summary

Modify OpenOptions enum to open the future path into synchronizing
vFile:open bits with GDB. Currently, LLDB and GDB use different flag
models effectively making it impossible to match bits. Notably, LLDB
uses two bits to indicate read and write status, and uses union of both
for read/write. GDB uses a value of 0 for read-only, 1 for write-only
and 2 for read/write.

In order to future-proof the code for the GDB variant:

  1. Add a distinct eOpenOptionReadWrite constant to be used instead of (eOpenOptionRead | eOpenOptionWrite) when R/W access is required.
  1. Rename eOpenOptionRead and eOpenOptionWrite to eOpenOptionReadOnly and eOpenOptionWriteOnly respectively, to make it clear that they do not mean to be combined and require update to all call sites.
  1. Use the intersection of all three flags when matching against the three possible values.

This commit does not change the actual bits used by LLDB.

Diff Detail

Event Timeline

mgorny requested review of this revision.Jul 28 2021, 12:36 PM
mgorny created this revision.
This revision is now accepted and ready to land.Aug 4 2021, 12:08 PM
JDevlieghere added inline comments.Aug 5 2021, 12:15 AM
lldb/include/lldb/Host/File.h
47–61

nit: we should make these Doxygen /// comments and put them above enum values.

This revision was landed with ongoing or failed builds.Aug 9 2021, 3:35 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2021, 3:35 AM