[Lldb-commits] [PATCH] [LLDB] debugger.GetInputFileHandle() should not close the file

Ari Grant ari.grant at me.com
Tue Dec 31 16:33:57 PST 2013

Hi enrico,

Open LLDB and run:
(lldb) script print lldb.debugger.GetInputFileHandle()

This puts the debugger into a catatonic state and all interactions seem
to enter a black hole. The reason is that executing this commnand
actually *CLOSES* the input file handle and so all input is dropped on
the floor. Oof!

The fix is simple: flush a descriptor, instead of closing it, when
transferring ownership.

Note that this also fixes GetOutputFileHandle() and GetError*.

Test Plan: Execute 'script print lldb.debugger.GetInputFileHandle()' in
the debugger. See that the handle is correctly printed and that LLDB
remains response to all further commands.



Index: scripts/Python/python-typemaps.swig
--- scripts/Python/python-typemaps.swig
+++ scripts/Python/python-typemaps.swig
@@ -440,7 +440,7 @@
    else // if (flags & __SRW)
       mode[i++] = 'a';
-   $result = PyFile_FromFile($1, const_cast<char*>(""), mode, fclose);
+   $result = PyFile_FromFile($1, const_cast<char*>(""), mode, fflush);
 %typemap(in) (const char* string, int len) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2496.1.patch
Type: text/x-patch
Size: 469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20131231/afd1f689/attachment.bin>

More information about the lldb-commits mailing list