[Lldb-commits] [PATCH] D68734: update SBDebugger::SetInputFile() etc to work on native Files

Lawrence D'Anna via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 9 16:03:28 PDT 2019


lawrence_danna marked an inline comment as done.
lawrence_danna added inline comments.


================
Comment at: lldb/include/lldb/API/SBDebugger.h:97-102
+  SBError SetInputFile(FileSP file);
+
+  SBError SetOutputFile(FileSP file);
+
+  SBError SetErrorFile(FileSP file);
+
----------------
lawrence_danna wrote:
> lawrence_danna wrote:
> > clayborg wrote:
> > > Are these really for public consumption? I would hope not, and might add then as protected and friend in any code that needs to use them? At the very least a comment specifying these are for internal use. Does SBFile not have a way to construct with a FileSP? Maybe these are not needed if that is the case?
> > They are //kind of// for public consumption.    They're impossible to use from a C++ client, because they can't see the definition of lldb_private::File.
> > 
> > But the SWIG wrappers can bind against them.     They will convert a native python file
> > into a FileSP.
> > 
> > That way SetInputFile works just like SetInputFileHandle works, except it doesn't have the bugs and limitations that SetInputFileHandle has.     Normally you can just use the FileSP version, and not create a SBFile.    But in some cases creating a SBFile manually is required, such as if you want to control how the file object is translated from python into C++.
> > 
> > 
> If I mad them protected, with a friend declaration, the friend would have to be some name that is auto-generated by SWIG.
@clayborg, you can see the same thing happening with FileSP already in `SBFile.i`, and `SBCommandReturnObject.i`.    My plan is to convert all the `FILE*` interfaces in the swig files into `FileSP`, and ultimately delete the `FILE*` typemap.    From python's perspective then new bindings will work the same way as the old, and the `FILE*` methods will still be there for C++ clients.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68734/new/

https://reviews.llvm.org/D68734





More information about the lldb-commits mailing list