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.

http://llvm-reviews.chandlerc.com/D2496

Files:
  scripts/Python/python-typemaps.swig

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';
 #endif
-   $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) {
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';
 #endif
-   $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) {
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to