<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi lldb-dev.<div class=""><br class=""></div><div class="">I want to be able to use LLDB inside of iPython, so I can have mixed python and LLDB debug session. </div><div class=""><br class=""></div><div class="">To this end, I’d like to update LLDB to have full support for python file objects, so the outputs of debugger commands can be redirected into iPython’s own streams.</div><div class=""><br class=""></div><div class="">This however, is difficult to do, because LLDB makes use of FILE* streams in a number of places. This presents two problems. The first is that there is no really</div><div class="">correct way to create SWIG typemaps that handle conversion to FILE* and get the ownership semantics correct. The second problem is that there is not a portable </div><div class="">way to make a FILE* with arbitrary callbacks for reading and writing. On Darwin and BSD there’s funopen, and on linux there’s something else, and I don’t know if </div><div class="">there’s any way on windows.</div><div class=""><br class=""></div><div class="">I made an attempt at this a while ago using funopen a while ago, here:</div><div class=""><div class=""><br class=""></div><div class=""><a href="https://reviews.llvm.org/D38829" class="">https://reviews.llvm.org/D38829</a></div></div><div class=""><br class=""></div><div class="">Zachary Turner suggested a more thorough approach. where instead of trying to use funopen to paper over all the use of FILE* streams, we should make </div><div class="">lldb_private::File capable of doing the dynamic dispatch and excise all the unnecessary FILE* stuff in favor of lldb_private::File. </div><div class=""><br class=""></div><div class="">That’s what I’ve done here: <a href="https://github.com/smoofra/llvm-project/tree/files" class="">https://github.com/smoofra/llvm-project/tree/files</a></div><div class=""><br class=""></div><div class="">I’ve posted the first few patches to phabricator for review.</div><div class=""><br class=""></div><div class=""><a href="https://reviews.llvm.org/D67793" class="">https://reviews.llvm.org/D67793</a></div><div class=""><a href="https://reviews.llvm.org/D67792" class="">https://reviews.llvm.org/D67792</a></div><div class=""><a href="https://reviews.llvm.org/D67789" class="">https://reviews.llvm.org/D67789</a></div><div class=""><br class=""></div><div class="">What do you think?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div></body></html>