[Lldb-commits] [PATCH] D54020: [FileSystem] Open File instances through the FileSystem.

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 1 18:45:19 PDT 2018


JDevlieghere created this revision.
JDevlieghere added reviewers: labath, zturner, jingham, clayborg.
JDevlieghere added a project: LLDB.

This patch modifies how we open `File` instances in LLDB. Rather than passing a path or FileSpec to the constructor, we now go through the virtual file system. This is needed in order to make things work with the VFS.

The current implementation doesn't use the VFS yet. The reason is that in LLDB we mostly use FILE pointers or file descriptors to manipulate files. This is currently not supported by the VFS and I haven't decided to address this yet. The two alternative I see are:

- Having the VFS translate paths. This will only work for virtual file systems where the files actually reside on disk. This would be sufficient for the reproducer use case but lacks generality.
- Having the VFS provide FILE pointers. Still we wouldn't be able to completely support in-memory vfses. I believe on POSIX there's a way to have a file point to memory, but I don't think you can do that for a file descriptor. Also not sure if that would work on Windows?

Both options are incomplete and I don't have the bandwidth to change how LLDB deals with files. I'm currently leaning towards the first alternative because LLVM doesn't provide `FILE*` APIs and I don't think we should start adding them now. Also I don't want to extend the VFS for just LLDB as that's going to be a pain to hook up and maintain. Anyway, I'm open to suggestions!


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D54020

Files:
  include/lldb/Host/File.h
  include/lldb/Host/FileSystem.h
  include/lldb/Utility/FileSpec.h
  source/API/SBStream.cpp
  source/Commands/CommandObjectBugreport.cpp
  source/Commands/CommandObjectMemory.cpp
  source/Core/StreamFile.cpp
  source/Expression/REPL.cpp
  source/Host/common/File.cpp
  source/Host/common/FileCache.cpp
  source/Host/common/FileSystem.cpp
  source/Host/posix/FileSystem.cpp
  source/Host/windows/FileSystem.cpp
  source/Interpreter/CommandInterpreter.cpp
  source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  source/Target/ModuleCache.cpp
  source/Target/Platform.cpp
  source/Utility/FileSpec.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54020.172295.patch
Type: text/x-patch
Size: 30191 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20181102/887dbc69/attachment-0001.bin>


More information about the lldb-commits mailing list