This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [gdb-remote] Add fallbacks for vFile:mode and vFile:exists
ClosedPublic

Authored by mgorny on Aug 10 2021, 4:03 AM.

Details

Summary

Add a GDB-compatible fallback to vFile:fstat for vFile:mode, and to
vFile:open for vFile:exists.

Diff Detail

Event Timeline

mgorny requested review of this revision.Aug 10 2021, 4:03 AM
mgorny created this revision.
labath added a comment.Sep 7 2021, 4:15 AM

It seems useful to note that these are only approximations, as they will fail for unreadable files, even though normally these operations should succeed. However, I think it is the best we can do given the limited set of supported operations (i.e., lack of stat(2) syscall and/or O_PATH argument to open(2)).

mgorny added a comment.Sep 7 2021, 9:38 AM

It seems useful to note that these are only approximations, as they will fail for unreadable files, even though normally these operations should succeed. However, I think it is the best we can do given the limited set of supported operations (i.e., lack of stat(2) syscall and/or O_PATH argument to open(2)).

Note as in mention in commit message, add a comment, add to documentation somewhere?

labath added a comment.Sep 8 2021, 1:21 AM

In the code and/or in the commit message.

mgorny updated this revision to Diff 371307.Sep 8 2021, 3:46 AM

Add fallback notes, as requested.

mgorny updated this revision to Diff 371653.Sep 9 2021, 10:40 AM

Undo extra comments. Fix wrong length of test GDB packet.

labath accepted this revision.Sep 10 2021, 12:52 AM
labath added inline comments.
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
3202–3203

This is exactly the use case that if-declarations (if (Optional<...> st = ...)were designed for.

This revision is now accepted and ready to land.Sep 10 2021, 12:52 AM
mgorny updated this revision to Diff 371842.Sep 10 2021, 2:26 AM
mgorny marked an inline comment as done.

Remove now-redundant platform connect from tests. Use if-declaration as requested.

This revision was landed with ongoing or failed builds.Sep 10 2021, 5:08 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 10 2021, 5:08 AM