[Lldb-commits] [PATCH] D67891: remove File::SetStream(), make new files instead.

Lawrence D'Anna via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Sep 22 10:58:58 PDT 2019


lawrence_danna created this revision.
lawrence_danna added reviewers: JDevlieghere, jasonmolenda, zturner, jingham, labath.
Herald added a project: LLDB.

This patch removes File::SetStream() and File::SetDescriptor(),
and replaces most direct uses of File with std::shared_ptr<File>.
Instead of calling SetStream() on a file, we make a new file and
replace it.

My ultimate goal here is to introduce a new API class SBFile, which
has full support for python io.IOStream file objects.   These can
redirect read() and write() to python code, so lldb::Files will
a way to dispatch those methods.   Additionally it will need some form
of sharing and assigning files, as a SBFile will be passed in and
assigned to the main IO streams of the debugger.

In my prototype patch queue, I make File itself copyable and add a
secondary class FileOps to manage the sharing and dispatch.  In that
case SBFile was a unique_ptr<File>.
(here: https://github.com/smoofra/llvm-project/tree/files)

However in review, Pavel Labath suggested that it be shared_ptr instead.
(here: https://reviews.llvm.org/D67793)

In order for SBFile to use shared_ptr<File>, everything else should
as well.

If this patch is accepted, I will make SBFile use a shared_ptr
I will remove FileOps from future patches and use subclasses of File
instead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67891

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Core/IOHandler.h
  lldb/include/lldb/Core/StreamFile.h
  lldb/include/lldb/Host/File.h
  lldb/include/lldb/Host/FileSystem.h
  lldb/scripts/Python/python-typemaps.swig
  lldb/source/API/SBDebugger.cpp
  lldb/source/API/SBStream.cpp
  lldb/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/source/Commands/CommandObjectCommands.cpp
  lldb/source/Commands/CommandObjectExpression.cpp
  lldb/source/Commands/CommandObjectGUI.cpp
  lldb/source/Commands/CommandObjectMemory.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/CommandObjectType.cpp
  lldb/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/IOHandler.cpp
  lldb/source/Core/StreamFile.cpp
  lldb/source/Expression/REPL.cpp
  lldb/source/Host/common/File.cpp
  lldb/source/Host/common/FileCache.cpp
  lldb/source/Host/common/FileSystem.cpp
  lldb/source/Host/windows/Host.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp
  lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
  lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
  lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Target/ModuleCache.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/ThreadPlanTracer.cpp
  lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67891.221221.patch
Type: text/x-patch
Size: 76690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190922/30e742e5/attachment-0001.bin>


More information about the lldb-commits mailing list