This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add an option to specify a VFS overlay
AbandonedPublic

Authored by JDevlieghere on Sep 1 2021, 3:44 PM.

Details

Summary

Add the ability to specify a VFS overlay to the command line driver. The motivation for this functionality is to facilitate testing. Jim has a patch where we want to simulate a remote debugging situation where a binary doesn't exist for locally (i.e. for LLDB) but does exist remotely (i.e. for debugserver).

LLDB already uses a virtual file system for the reproducers. This patch is mainly focussed on being able to initialize the FileSystem with a VFS specified on the command line.

One limitation here is that, unlike clang, you can only specify a single VFS overlay. This is caused by the FileSystem having to devitualize the path, which requires it to know whether the VFS is a RedirectingFileSystem. We wouldn't have this issue if LLDB were to only manipulate files through LLVM's memory buffer abstraction, but when the same issue came up for the reproducers, that was deemed too intrusive. As this functionality is really meant for development and testing, I'm not too concerned about that.

Diff Detail

Event Timeline

JDevlieghere created this revision.Sep 1 2021, 3:44 PM
JDevlieghere requested review of this revision.Sep 1 2021, 3:44 PM
jingham accepted this revision.Sep 7 2021, 3:05 PM

LGTM

lldb/source/API/SBDebugger.cpp
878

These two are just reformatting, right? I can't see any actual difference.

This revision is now accepted and ready to land.Sep 7 2021, 3:05 PM
JDevlieghere abandoned this revision.Nov 9 2021, 9:01 AM

Looks like there's an easier way to test this, so no need to add another SB API.